DSiWare Forum

Topic: Petit Computer

Showing 941 to 960 of 9,304

AuthorMessage
Avatar

portealmario

941. Posted:

Wheels2050 wrote:

portealmario wrote:

can somebody explain the conceps of hexidecimal numbers to me?

Hexadecimal is simply a different way of representing numbers. It's useful because computers 'think' in binary - i.e. think in factors of two. While we are used to using decimal numbers in everyday life, it's not a natural numbering system for computers.

First, let's review the decimal system. It has digits 0,1,2,3,.....,9. Now, the way we write a number in any base (be that decimal, binary, hexadecimal etc.) is in the form:

xyzw

If we are in base ten (decimal), we would write the number "one thousand, four hundred and sixty seven" as:

1467 (I know you know this, but I'm trying to keep things flowing well).

Now, what 1467 means is that we have:

1x1000 + 4x100 + 6x10 + 7x1.

1, 10, 100, 1000 etc. are all powers of ten. So we can write the above line as:

1x10^3 + 4x10^2 + 6x10^1 + 7x10^0

so as we read from right to left, each digit indicates the number of tens to the appropriate power that the number contains (so the rightmost is 7 lots of ten to the zero, 6 lots of 10 to the one etc.) Thus, we can write any integer number in this format. Note that the number:

0000000000000001467

is exactly the same number, but for convenience we just discard the left-most zeros.

You may be familiar with binary, which is a similar idea - we just replace the powers of ten with powers of two.

so:

1011011

would be:

1x2^6 + 0x2^5 + 1x2^4 + 1x2^3 + 0x2^2 + 1x2^1 + 1x2^0

which, if we work out the exponents of 2:

2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
2^4 = 16
2^5 = 32
2^6 = 64

So, sticking those back into our expanded formula above, we have:

1x64 + 0x32 + 1x16 + 1x8 + 0x4 + 1x2 + 1x1 = 91 (If I've done my maths correctly)

It's just like the decimal you're used to, just with powers of two.

Now, we can use those same ideas with hexadecimal - now our base is 16. So the right-most digit is the number of sixteen-to-the-zeros, the one to the left the number of sixteen-to-the-ones, etc.

If you look at our decimal numbering system, you'll quickly notice that we only have 10 digits. However, that poses a problem - how do you write the number "14" in hexadecimal?

14 is less than 16^1 (=16), so we need to write it as 14x16^0. However, how do we do that with a single digit? (which is the idea - a number should only have one 'digit' for each power of your base). Thus, it was decided to use the beginning of the alphabet. 0-9 are as normal, but we then start with "A" and go on. Thus, when reading hexadecimal, we find:

0-9 = as normal
A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

Thus, to write the number '14' in hexadecimal, we simply write Ex16^0 (or, as it is usually seen, just E). When reading hex, people automatically convert that to mean 14.

So, if we have the number: A48, what does that mean? Just like before, we have:

Ax16^2 + 4x16^1 + 8x16^0, which (remembering A=10) gives us: 10x256 + 4x16 + 8x1 = 2632 in decimal.

Hexadecimal is useful, because to write 2632 in binary, we would require: 101001001000, which is obviously much more unwieldy than A48. Thus, hex is seen a lot in computing.

One final thing is that it's not always obvious what base someone is using. If I write the number:

10011110

how do you interpret that? Is it decimal, is it binary, is it hex, or is it something else entirely? Often contextual clues will tell you, but to be sure there are a variety of schemes. Sometimes you'll see a subscript at the right-hand side of the number (so if the above was binary, it would have a little '2' in subscript on the right-hand side). A common way of denoting hex (such as in the C and C++ programming languages) is to precede it with "0x". Thus, if I wrote:

0x847,

you'd know that it's in hex and not the number "eight hundred and forty-seven".

I hope that helps!

EDIT: Bonus points for telling me what 0x847 is in decimal! :D

thanks alot! that really helped :)!
is it 2071?

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

AuthorMessage
Avatar

Discostew

942. Posted:

portealmario wrote:

is it 2071?

Almost. It's 2119.

(8 * 16^2)+(4 * 16^1)+(7 * 16^0)=2048+64+7=2119

"What fun is there in making sense?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

AuthorMessage
Avatar

81Rambler

943. Posted:

Man, I'm suprised this tread is still going as strong as it is. I'm glad interest in this game is still going on after all this time

I had a question though regarding random dungeon generation. It's basically an area I have little to no idea of how to handle and I was hoping to get a nudge in the right direction.

If anyone's played the Windows 3.1 game Castle of the Winds, I'd like to make my own version of it (with a rule set closer to that of DnD, but I'm still tossing around my own elements) but what I really liked was the style of room generation there in. Would anyone be able to guide me to an algorithm similar to what was used there? (I think the Mysterious Dungeon series used a similar method, typically larger rooms seperated by extended coridors, although I may shorten distances between each)

81Rambler

AuthorMessage
Avatar

KiwiFruit

944. Posted:

Hi, I'm almost ready to post my game. I have to organize the QR codes since there's 29 of them. There's 12 for the program, 5 for the sprite, 5 for BG tilesheet 1, 6 for BG tilesheet2, and 1 for color. I'll have the QR posted this weekend.

KiwiFruit

AuthorMessage
Avatar

pHUNTERq

945. Posted:

Discostew wrote:

Are you trying to access the GRP section like an array (with a range from 0 to 49151), indexing it with a single value? Try the following line...

VALUE=GSPOIT(IDX AND 255,IDX / 256)

Where IDX is the value that ranges from 0 to 49151. Increment IDX to get the very next byte, whether that is the next pixel on the line, or the first pixel on the next line.

About your method earlier. 2x3 may equal 6, but with a GRP file, acting like an image, getting data at (2,3) would actually use the formula ((y * 256)+x), making it ((3*256)+2)=770. So, with the line I displayed earlier, you can set IDX to 770, and increment IDX after you read each byte, and it'll increment sequentially, because 770 AND 255 = 2, and 770 / 256 = 3.0078 (but the GSPOIT function only accepts integers, so it floors it automatically to 3).

Alright, I implemented that into my program, it seems to be loading fine, but now I want to place a tile, or one pixel, within that 400 pixel range. So I would use the equation you said before to get the starting position, but then, what would I use to place that one pixel? Oh, and one more thing, I don't get how your using AND, I didn't know it could give numerical values, I thought it was just true or false. How does AND work? Or how does OR, XOR and NOT work with giving numerical values?

3DS Friend Code: 2105-8964-7467

AuthorMessage
Avatar

shadowwinds

946. Posted:

hello i need help building a ai like one from legend of zelda that will target and try to kill the player

omnomnomnom metaphorical cake
3ds friend code: 4640-0397-5198
current petit computer prodject: peticle:the epic pet battleing game

AuthorMessage
Avatar

Discostew

947. Posted:

pHUNTERq wrote:

Discostew wrote:

Are you trying to access the GRP section like an array (with a range from 0 to 49151), indexing it with a single value? Try the following line...

VALUE=GSPOIT(IDX AND 255,IDX / 256)

Where IDX is the value that ranges from 0 to 49151. Increment IDX to get the very next byte, whether that is the next pixel on the line, or the first pixel on the next line.

About your method earlier. 2x3 may equal 6, but with a GRP file, acting like an image, getting data at (2,3) would actually use the formula ((y * 256)+x), making it ((3*256)+2)=770. So, with the line I displayed earlier, you can set IDX to 770, and increment IDX after you read each byte, and it'll increment sequentially, because 770 AND 255 = 2, and 770 / 256 = 3.0078 (but the GSPOIT function only accepts integers, so it floors it automatically to 3).

Alright, I implemented that into my program, it seems to be loading fine, but now I want to place a tile, or one pixel, within that 400 pixel range. So I would use the equation you said before to get the starting position, but then, what would I use to place that one pixel? Oh, and one more thing, I don't get how your using AND, I didn't know it could give numerical values, I thought it was just true or false. How does AND work? Or how does OR, XOR and NOT work with giving numerical values?

Ok, GSPOIT is meant for reading, but for writing, you use GSET

GSET x-coor, y-coor, color

x-coor ranges from 0 to 255
y-coor ranges from 0 to 191
color ranges from 0 to 255 (meant to be a color from the palette)

To write like you would read (using IDX), do it like this

GSET IDX AND 255, IDX / 256, VALUE

As for AND, OR, etc. here is an easy to read interpretation of these bitwise operations (bit shifts not supports in Petit Computer).

http://en.wikipedia.org/wiki/Bitwise_operation

The reason why the use of AND would result in TRUE or FALSE is because with bitwise operations, a number that does not equal 0 is considered TRUE, and any number that equals 0 is considered FALSE. You'll have to read up on binary representation of numbers to understand why it works (though the link above should help with that).

Edited on by Discostew

"What fun is there in making sense?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

AuthorMessage
Avatar

pHUNTERq

948. Posted:

Alright thanks Disco :)

I'll have to start getting my feet wet in binary stuff, it seems useful.

In the meantime I'm going to fool around with random generation and see if I can randomly generate rooms or something. Might prove useful for my editor if someone doesn't feel like making a map, so they can just hit the random button and it will make one for them. I'll post whatever I come up with in the QR thread.

3DS Friend Code: 2105-8964-7467

AuthorMessage
Avatar

Javo118

949. Posted:

pHUNTERq wrote:

Alright thanks Disco :)

I'll have to start getting my feet wet in binary stuff, it seems useful.

In the meantime I'm going to fool around with random generation and see if I can randomly generate rooms or something. Might prove useful for my editor if someone doesn't feel like making a map, so they can just hit the random button and it will make one for them. I'll post whatever I come up with in the QR thread.

I just post a MapMaker on the QR threat, but I'm very inrterested on your generator, maybe it can help me for my v1.1 =)

btw i want to add you as friend on my 3ds, also Discostew, I add your fc already. Mine is 2921-9808-6856

Edited on by Javo118

3DS FC: 2921-9808-6856

AuthorMessage
Avatar

Sprite

950. Posted:

I put discostew and Javo118 on my friends list. Mine is 1075 1228 4183
3DS friends list by the way :)

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

AuthorMessage
Avatar

Javo118

951. Posted:

Sprite wrote:

I put discostew and Javo118 on my friends list. Mine is 1075 1228 4183
3DS friends list by the way :)

Added you =)
Try my app, that‛s my first app =P, want to know if I should make v1.1 hehe

3DS FC: 2921-9808-6856

AuthorMessage
Avatar

Hale-Bopp

952. Posted:

So, I've been lurking for a bit now, but I've had PC since it was released and I don't know about you guys, but it's my most 'played' software title on my 3DS right now, clocking in at over 160 hours. Ridiculous.

I've mostly been playing around with everyone's creations and working on a game of my own. Before PC, I hadn't touched BASIC since I was about 10 years old. That was over 25 years ago. I'm an old dude, heh. Anyways, since my knowledge of BASIC is very limited, I'm working on a fairly simplistic text adventure for now, but WOW have I learned a lot already in just the past few months alone. You guys are light years ahead of me, so I appreciate all that I'm learning from this thread alone along with just experimenting with my own ideas.

I love this program.

NNID: Hale-XF11

Twitter: HaleaciousB

AuthorMessage
Avatar

Discostew

953. Posted:

Hale-Bopp wrote:

So, I've been lurking for a bit now, but I've had PC since it was released and I don't know about you guys, but it's my most 'played' software title on my 3DS right now, clocking in at over 160 hours. Ridiculous.

I just went and checked how much time I spent on Petit Computer. The highest was OoT3D at 20.5 hours....until I began using PTC. PTC is showing at 241.5 hours!

@Sprite and @Javo118

I've added you both to my 3DS Friend List.

"What fun is there in making sense?"
Lazer Light Studios - Home of the MM2 PTC project

Pokemon 3DS Friend Safari - Ice - Spheal, Sneasel, Lapras

3DS Friend Code: 4425-1477-0127 | Nintendo Network ID: Discostew

AuthorMessage
Avatar

Javo118

954. Posted:

Hale-Bopp wrote:

So, I've been lurking for a bit now, but I've had PC since it was released and I don't know about you guys, but it's my most 'played' software title on my 3DS right now, clocking in at over 160 hours. Ridiculous.

I've mostly been playing around with everyone's creations and working on a game of my own. Before PC, I hadn't touched BASIC since I was about 10 years old. That was over 25 years ago. I'm an old dude, heh. Anyways, since my knowledge of BASIC is very limited, I'm working on a fairly simplistic text adventure for now, but WOW have I learned a lot already in just the past few months alone. You guys are light years ahead of me, so I appreciate all that I'm learning from this thread alone along with just experimenting with my own ideas.

I love this program.

I‛m not too experimented, but I will try to help you whit anything you need about PTC.
You should upload any creation yours =)

3DS FC: 2921-9808-6856

AuthorMessage
Avatar

Hale-Bopp

955. Posted:

Discostew wrote:

I just went and checked how much time I spent on Petit Computer. The highest was OoT3D at 20.5 hours....until I began using PTC. PTC is showing at 241.5 hours!

That's amazing! My 2nd most played title is Resident Evil: Revelaitons at about 80 hours. With such a difference in time played, I don't know if anything will ever top Petit for me, lol.

Javo118 wrote:

I‛m not too experimented, but I will try to help you whit anything you need about PTC.
You should upload any creation yours =)

I will definitely appreciate any and all help I can get when the time comes. I'd say I'm about 3/4 done with my game. Not enough yet that I want to share it just yet, but hopefully I can get more motivated to finish sooner rather than later. I'm a terrible procrastinator.

Edited on by Hale-Bopp

NNID: Hale-XF11

Twitter: HaleaciousB

AuthorMessage
Avatar

shadowwinds

956. Posted:

hey i just added Sprite to my friend list on my 3ds
my code is: 4640-0397-5198 :)
hey let me know if youve added me also i need help with making an ai system that acts mutch like a enemy from the legend of zelda: a link to the past

Edited on by shadowwinds

omnomnomnom metaphorical cake
3ds friend code: 4640-0397-5198
current petit computer prodject: peticle:the epic pet battleing game

AuthorMessage
Avatar

KiwiFruit

957. Posted:

@shadowwinds You can have an other sprite slowly home in to your character's position.

Spset 1,...,0
Spofs 1,herox,heroy,1

You can use the remainer %(Thank you PetiSnail for mentioning this awesome sign to help balance the load in my Witch game) function to slow down the enemy.

If MAINCTNL%4==4 then spofs 1,herox,heroy,1

Basically you want to put this in a loop along with your character's movement button, placement update etc. Sorry it is kinda vague. Hopefully it'll get you thinking of a solution.

KiwiFruit

AuthorMessage
Avatar

Hale-Bopp

958. Posted:

Anyone know a reliable way of converting MIDI files to MML for use in Petit? I've tried several programs and none of them seem to create code that's compatible with Petit. I get a bit lost in all the code these programs create, so editing them is very difficult to wrap my head around.

NNID: Hale-XF11

Twitter: HaleaciousB

AuthorMessage
Avatar

KiwiFruit

959. Posted:

ChangeV stated in the QR thread replying to shadowwind

Sure. you can use the MML music.
(It took several days to convert MID into MML format. MID file -> printout score with Final NotePad2012 -> wrote MML on paper -> petit Nyancat!)

I tried EDPCOMPO for Petit Computer. But I do wish it could print the MML to show so I could write it on paper, instead of figuring out how to extract from a GRP file.

I have a small program that I wrote that would BGMSETD the notes and then I can BGMPLAY 128 playback the music. I write the notes, D2D4R2, etc.Then when I'm finish, I would save the program. Copy one line, open the game I made, then paste, save game, then open music program, copy from another line, open game, paste, save game... etc. After that, I can still treak the music if needed. That's my method.

Edited on by KiwiFruit

KiwiFruit

AuthorMessage
Avatar

shadowwinds

960. Posted:

i cant seem to use this file converter to make music in my game (mostly becous i have not learned how to program mml yet) but if someone could tell me whats wrong with it also i checked the box that said: add spaces between notes
this is the midi file links:
http://www.castlevaniadungeon.net/Media/Midi/Bloody_Tears.mid
http://www.castlevaniadungeon.net/Media/Midi/Cross_Your_Heart...
this is the converters link:
http://www.netmftoolbox.com/tools/midi_to_mml.php

Edited on by shadowwinds

omnomnomnom metaphorical cake
3ds friend code: 4640-0397-5198
current petit computer prodject: peticle:the epic pet battleing game