Forums

Topic: Petit Computer

Posts 626 to 645 of 9,620

portealmario

So, I guess I will start a new project. Maybe there is an early version on the sd card. @ramstrong I am definately going to use that website, I have been trying to fiqure button use out for a long time, but when I see other people using it, it is too unfamilliar to recognize.

meng 😐
3ds friend code:1762-2769-7142

portealmario

@ramstrong I totally agree with your soapbox post
I think that someone should try to make a clone of minicraft for petit computer(I haven't learned enough to start myself). It is a game made by notch in 24 hours(with some similarities to minecraft) I'm sure someone(cough) @morphtroid (cough) could do it. It would be really cool to play it on the ds, and it would be easy to mod due to it's BASIC language. Do you think anyone would want to do it?

Edited on by portealmario

meng 😐
3ds friend code:1762-2769-7142

Sprite

Portealmario i feel so bad for you. I know what its like to lose all of your data. Mine was in a different circemstance so yours must feel 100 times worse. Hope ypu find a backup
EDIT: Hope you find a backup

Edited on by Sprite

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens.
Friend Code: 1075-1228-4183

81Rambler

Morphtroid wrote:

On an unrelated note, I bought "Atari's Greatest Hits Vol. 2" for the DS some days ago, it comes with a lot of "Petit Computer-izable" game ideas I can't wait to try when my new stylus arrives... It also comes with a BASIC compiler that I can't understand at all lol, but I already have Petit Computer for that.
If any of you want good & easy game ideas, I totally recommend you to play atari games.

I acctually picked that up for those reasons, that it included the Atari 400 emulator as well as... Atari Basic Programming (12 lines with a comically named 'Keyboard controller'), but back to the Atari 400 I was a bit curious how easy/difficult it would be to translate Basic code for the Vic20/Coimmodore64 to it as uses a similar peek/poke system (although some minor language changes would be made of course).

These sorts of collections are great places for inspiration though. My current project is currently inspired from Activision Anthology, which I should have some conceptual stuff up soon. Professor Layton was a pretty obvious inspiration for my first (as well as The 7th Guest), and some collections I could recommend to others are Atari Anthology and Intelivsion Lives.

Failing those Morphtroid I WILL be expecting a Petit Computer version of Atari Basic Programming ;p (joking, of course)

Edited on by 81Rambler

81Rambler

Tingle

So, I have another question. It's about the DIM command, and arrays. I just don't understand what they do. As in, the Petit Computer help automatically assumes I understand the word array. Would somebody oblige and explain to me the concept of an array and what it can be used for?

Tingle

Eel

@Rambler: I managed to do a little program with Atari Basic, but the terminal emulator really lacks some basic functions, like DPad support. To move around your code you need press a button combination every time you want to move a single space so it gets tiresome and boring, Petit Computer is clearly the superior choice. That doesn't means it's not fun to play around with though. It's fascinating in it's own historical kind of way. There are also tons of premade codes you can find online.

The 2600 BASIC game is pretty bad though... I may need to read the 27-pages instruction book again if I want to get anything from that one.

@Tingle:

Wikipedia wrote:

In computer science, an array data structure or simply an array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored so that the position of each element can be computed from its index tuple by a mathematical formula.[1][2][3]
For example, an array of 10 integer variables, with indices 0 through 9, may be stored as 10 words at memory addresses 2000, 2004, 2008, … 2036, so that the element with index i has the address 2000 + 4 × i.[4]
Arrays are analogous to the mathematical concepts of vectors, matrices, and tensors. Indeed, arrays with one or two indices are often called vectors or matrices, respectively. Arrays are often used to implement tables, especially lookup tables; the word table is sometimes used as a synonym of array.
Arrays are among the oldest and most important data structures, and are used by almost every program. They are also used to implement many other data structures, such as lists and strings. They effectively exploit the addressing logic of computers. In most modern computers and many external storage devices, the memory is a one-dimensional array of words, whose indices are their addresses. Processors, especially vector processors, are often optimized for array operations.
Arrays are useful mostly because the element indices can be computed at run time. Among other things, this feature allows a single iterative statement to process arbitrarily many elements of an array. For that reason, the elements of an array data structure are required to have the same size and should use the same data representation. The set of valid index tuples and the addresses of the elements (and hence the element addressing formula) are usually,[3][5] but not always,[2] fixed while the array is in use.
The term array is often used to mean array data type, a kind of data type provided by most high-level programming languages that consists of a collection of values or variables that can be selected by one or more indices computed at run-time. Array types are often implemented by array structures; however, in some languages they may be implemented by hash tables, linked lists, search trees, or other data structures.
The term is also used, especially in the description of algorithms, to mean associative array or "abstract array", a theoretical computer science model (an abstract data type or ADT) intended to capture the essential properties of arrays.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

ramstrong

@Morphtroid
Gee, I think you should link the article, instead of copy and paste.

@Tingle
This is part of "variable" concept. Also Indirection. :http://en.wikipedia.org/wiki/Indirection

The computer is just a bunch of numbers. A variable will occupy one of those numbers (or memory address). So, when you do something like A=10, that means somewhere in memory, say address#4532, it will have a value of 10. Also somewhere else, there will be an entry "&A=4532" <- this here is a pointer (indirection).

An array is simply a bunch of variables together. An example would be a row of ducks, Solar panel arrays, string is an array of characters, etc. A lot of times, we want a group of variables to denote the same thing, with several different elements. Taking an example of ducks, we can say, "Shoot the 3rd duck from the left" which something like DUCK[2]=TRUE. 3 is the reference number. If we take memory address of DUCK is #3231, then
&DUCK[0]=3231
&DUCK[1]=3232
&DUCK[2]=3233
&DUCK[3]=3234
&DUCK[4]=3235
and so on...

DUCK[2] because array starts from zero.

However, the computer will need to know how many DUCK variables are there, because, eventually, you want to put another variables after it. So, we use DIM, as in DIM DUCK[5], which means "Let there be 5 DUCK variables going from 0 to 4". BASIC takes care of the internal memory allocations so you don't have to worry about it. But you do need to declare how many elements an array have before it can be used. This is also why you can't resize the DIM because you'll be in danger of overwriting other variables. So, you CLEAR the memory first, before allocating variables using DIM.

The nice thing about it is that we can use a variable as reference. That means we can do this:
FOR I=0 TO 4
DUCK[I]=TRUE
NEXT
In this case, variable I is changed with in the loop, so DUCK[0],DUCK[1]...DUCK[4] are all set to TRUE.
We can also do this:
INPUT "CHOICE",N
CHOICE[N]=TRUE

Why variable "I"? It's tradition, same as we use the term "Debug" when we mean correcting errors. "Debug" means getting rid of bugs, in this case a moth. The variable I is used as convention because in FORTRAN, variable I to N defaults to integer, and we use integers (as opposed to real) in loops.

Edited on by ramstrong

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

ramstrong

Example of using Sprite Collision. Note that SPHITNO is set by the system automatically.

ACLS:CLEAR
MAXSP=19
SPSET 0,96,0,0,0,0
SPHOME 0,8,8
FOR I=1 TO MAXSP
SPSET I,64,0,0,0,0
SPHOME I,8,8
SPOFS I,255+RND(245)+5,RND(180)+5
NEXT

@LOOP
VSYNC 1
SPOFS 0,TCHX,TCHY

FOR SPNUM=1 TO MAXSP
IF SPCHK(SPNUM)==0 THEN GOSUB @MOVE
NEXT

IF SPHIT(0) THEN GOSUB @FLING
GOTO @LOOP

@FLING
BEEP 61
SPREAD(SPHITNO),X,Y
SPCHR SPHITNO,92
SPOFS SPHITNO,X+RND(225),Y+RND(95)-40,40
RETURN

@MOVE
SPREAD(SPNUM),X,Y
TX=TCHX:TY=TCHY
DX=TX-X:DY=TY-Y
DR=SQR(DX*DX-DY*DY)
SPOFS SPNUM,TX,TY,DR
SPCHR SPNUM,72
RETURN

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

LittleKing

Just wondering, but does anyone here have any background in software development, or experience with programming other than BASIC?

LittleKing

GrabSomeEyes

@Metabble_King if I remember correctly, @Morphtroid has had some experience outside of BASIC.
I think a few people here at least do a little outside of BASIC, but I can't really speak for them.
I can speak for Morphtroid, but none else.

Eos OS: http://conlogxl.forumotion.com/t12-eos-os-v10
3DS FC: 3695-0514-5044

Eel

Eh just mostly Game Maker and small school-related projects on other languages (C#, Java, etc). Nothing too serious.

The first real non-Game Maker language I used was actually BASIC in high school, my school was very outdated.
After BASIC we used old school Pascal and C. Fun times.
I was usually the only one who enjoyed programming though. Huh.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Shadow1364

Just posted my first program to the QR thread. Check it out and comment! ^-^

FC: 1934-1622-0902

LittleKing

Morphtroid wrote:

Eh just mostly Game Maker and small school-related projects on other languages (C#, Java, etc). Nothing too serious.

The first real non-Game Maker language I used was actually BASIC in high school, my school was very outdated.
After BASIC we used old school Pascal and C. Fun times.
I was usually the only one who enjoyed programming though. Huh.

Ah, thanks. Explains why you're so good at this! I was interested because some people here are pretty good at using Petit Computer and BASIC, so I thought maybe a few had done other stuff before. Having learned C as my first language and making a basic RPG battle engine in that, and then moving into Objective-C, it seems that BASIC is a better starting point than I thought. Through it you can learn about basic loops and subroutines, and do some pretty cool stuff without getting too complex. I always tend to write out anything more complex in pseudocode first, which, quite frankly, often looks kind of like BASIC! xD

I like programming since it allows one the freedom to create. If you think about it, you can basically make whole worlds! It's kind of like a step up from LEGO and K'Nex.

Just wondering, but how do you guys handle collision detection in BASIC games? In Obj-C I've had to make my own physics classes which work on my own prediction based collision algorithm to detect and limit positional offsets based on object velocities each frame so that objects don't overlap. Do you just see if sprites overlap and correct their positions so that they don't after the fact, or what? This seems most likely to me since most collision correction is post-collision, and not pre-collision.

LittleKing

Eel

I like programming since it allows one the freedom to create. If you think about it, you can basically make whole worlds! It's kind of like a step up from LEGO and K'Nex.

That is very true

About collisions, Smile Basic comes with its own set of sprite-based collision detection functions, it's pretty easy just look at the part of the manual that explains it (and if you have any further questions, feel free to ask them here).
I think the most basic form of detection is just checking if "sprite A" is "touching" "Sprite B", though there are other commands.
I haven't really experimented a lot with that. Maybe next time I do something with sprites.

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

ramstrong

Metabble_King wrote:

Just wondering, but how do you guys handle collision detection in BASIC games? In Obj-C I've had to make my own physics classes which work on my own prediction based collision algorithm to detect and limit positional offsets based on object velocities each frame so that objects don't overlap. Do you just see if sprites overlap and correct their positions so that they don't after the fact, or what? This seems most likely to me since most collision correction is post-collision, and not pre-collision.

Didn't I just post Sprite Collision Tutorial program? Anyway, if you don't want to correct their position after the fact, you can use SPCOLVEC to define velocities.

The truth is, for every BASIC dialect, there's still learning curve to be had. I have to learn Sprites and Background, for example, not having Game Maker experience. Also, the FOR loop abuse to act as Multi-line IF, WHILE, REPEAT are new to me. There are things that I've learned before, such as page flipping. But the most difficult thing to learn is overcoming prejudice. To think that if you know old BASIC, you'd be good at this, is to miss great opportunity to learn it well. I still have to learn MML as well, but really, I don't see how anybody can miss how to play MML once you have the strings. It's right on the help menu, and they give you the program to do it, instead of just a reference.

I do a lot of experimentations, but try to avoid real-time game for now. Some things I do know. Having experimented with GPAINT, I know that it can be very slow. Also, SPOFS with timing can be extremely useful. It allows you to create games with resolution longer than 1/60 per second. In effect, Uncle Sporky's inability to understand how SPOFS extension works is detrimental to his DQ map demo, stuttering with diagonal movement.

In reality, the games you see in stores features a lot of tricks to max out the device. It's not something a beginner can do easily. There are some exceptions. Tetris for one. Picross is also easy. I did the core Picross in a couple hours, and I have a version with editor built-in for making puzzles. So, it's what you want to do, really. Then do it. Then, either you optimize it proper, or you cut features until you're satisfied.

You know C language, so you should be good with this, too! C is not a big language, afterall. You need to build your own tools, right? This should be easy to do after that!

Petit Computer Journal
Old site http://ramstrong.blogspot.com

Let's just call a spade, a spade.

3DS Friend Code: 1091-7596-4855

Sprite

I'm having trouble doing something.
I tried loading my charecter with
CHRREAD("VEIN",VEIN),C$
I looked on morphiod's post on the tutorial to find this out but it says
Illegal rescource type (25, CHRREAD)
Could someone help me with this and tell me why it failed

I'm not saying let's kill all the stupid people, I'm just saying let's take off the warning labels, and see what happens.
Friend Code: 1075-1228-4183

Eel

Wait... Are you loading your character (Which I will assume is a sprite) with CHRREAD?

To load a sprite you need to use SPSET, look the manual to see the correct parameters. It's easy.

CHRREAD is used to other things. I don't think I have ever used it myself.

Of course I may be missing something... Could you rephrase your question with more information?

Edited on by Eel

Bloop.

<My slightly less dead youtube channel>

SMM2 Maker ID: 69R-F81-NLG

My Nintendo: Abgarok | Nintendo Network ID: Abgarok

Please login or sign up to reply to this topic