gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > help!!! school project (tamagotchi)

#39283 - ghost Leinad - Wed Apr 06, 2005 11:49 pm

i need help with a project..or at least if you can gime me some ideas for this project...i need to do a tamagotchi(sort of) and i dont know how to...but i have some ideas...
well my tamagotchi will have the basics from the original tamagotchi you know,...food, exercise, cleaning, playing, medicine, and that all(no my tamagotchi will not sleep)

well...also the screen will show the status, time of the day(no real time) age of my tamagotchi...
well i think that will cover evrything of the basics
i think i need a function for everyone of the different buttons on screen...
and a very elaborate state funtion for deternime if my tamagotchi is happy,sad, sick,death or whatever.

if anybody already has done this project please help me...
or anybody has any ideas!!!

again sorry about my english

by the way i already finished my snake demo lol

pd: i have another question...you can only show 128 sprites at the same time right? and you need to specify where in the memory you wish to put the sprite, in intance memcpy(blablabla)
and specify a number for your sprite and its attributes... sprites[0].attributes=blablabla
well...can you reuse this numbers if you have more than 128 sprites...i ask that because some games seems like they have more than 128 sprites...or at least gimme the master definition of sprites coz i just dont get it :-S

#39286 - poslundc - Thu Apr 07, 2005 12:21 am

I think you'll have to ask a more specific question than "please help me" if you want to get any useful responses from people.

ghost Leinad wrote:
pd: i have another question...you can only show 128 sprites at the same time right? and you need to specify where in the memory you wish to put the sprite, in intance memcpy(blablabla)
and specify a number for your sprite and its attributes... sprites[0].attributes=blablabla
well...can you reuse this numbers if you have more than 128 sprites...i ask that because some games seems like they have more than 128 sprites...or at least gimme the master definition of sprites coz i just dont get it :-S


In terms of GBA hardware, a "sprite" (more technical term being "object") is a graphic generated from tiles in VRAM, and has properties like screen coordinates, width, height, optionally rotation and scaling, etc.

Generally speaking, you can display up to 128 of them on the screen in a single frame.

There is a way around this limitation, but it is very complicated and rarely used (since few games need to display more than 128 objects in a single frame).

Some games "simulate" extra objects by using the four background layers in various creative ways. In these cases, the nature of the game determines if it's possible or practical to do so.

Dan.

#39290 - ghost Leinad - Thu Apr 07, 2005 1:57 am

ok...then my question is...if somedoby has already done a tamagotchi clon or something with AI emotions please let me know
i will try to do it by myself and right now i got nothing, on the way i'll come to ask for more especifics questions because right now i dont have any...

i'll really appreciate any help you could give me...

and the second quetion...i know i can show "only" 128 sprites at the same time...but in the whole game can i have stored more than 128 or not?

ah and sorry if my english could seem rude somketimes but i can't express myself better than that :D...tanx

#39293 - sajiimori - Thu Apr 07, 2005 2:16 am

If you've only written a snake demo, I'd suggest some intermediate problems before Tamagotchi. Tetris, Breakout, and Pac Man are typical choices.

#39296 - tepples - Thu Apr 07, 2005 3:18 am

A handheld virtual pet (Tamagotchi, GigaPet, Pokemon Pikachu, etc) needs about four sprites: one for the character, perhaps two for the environment, and one for selecting an action. Remember that a sprite can address any of the sprite cels (images) in VRAM, and you can even load new cels into VRAM at any time.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39299 - sajiimori - Thu Apr 07, 2005 3:26 am

Lol, maybe I overestimated the complexity of such a task! The truth is I've never seen one. ;)

#39300 - tepples - Thu Apr 07, 2005 3:42 am

Go order a handheld virtual pet on eBay (or whatever your local counterpart is) and play with it to get an idea of how a virtual pet works.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39340 - yaustar - Thu Apr 07, 2005 6:31 pm

The problem i see coming is the need for a real time clock
_________________
[Blog] [Portfolio]

#39366 - ghost Leinad - Fri Apr 08, 2005 12:28 am

well...my clock is already workinl starting at 00:00 and it takes 16 minutes per day(is a really fast clock) but is just for an example...if i set mi framecounter to 60 my clock works on real time...

well that the last problem...

somebody can give an example of how can i reuse the VRAM for the sprites...I know I only need maybe 10 sprites as maximun to show on the screen

but to make an animated sprite, need i different intances of that sprite?
example...im already making the drawings...well i got one draw for my tamagotchi happy, one for mi tamagotchi sad and so on...(SIZE_64)but as far as i know i only can store in the VRAM 16 sprites this size but i need more space...
somebody wrote ...you can load newcels into VRAM at any time...how do i do that?

today i will try to make mi sprite change to make mi tamagotchi less boring...
another question...can i use the MODE_3 instead of MODE_4 the same way? what are the differences?

tanx for your coments

#39369 - tepples - Fri Apr 08, 2005 12:44 am

ghost Leinad wrote:
somebody wrote ...you can load newcels into VRAM at any time...how do i do that?

Here's everything you always wanted to know about sprite cel VRAM management.* For example, if you have a 16-color 64x64 pixel image, reserve 64 tiles (2 KB) of VRAM for it. To change the sprite cel, just copy a new cel from ROM on top of the VRAM that you have reserved.

By "real time clock", I think yaustar was referring to a clock like the one on the Pokemon cart, which keeps ticking even when the game system is turned off.


*but were afraid to ask
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39371 - ghost Leinad - Fri Apr 08, 2005 12:56 am

really thanks...

i got to go to the movies...but as soon as i get back, i read the entire document lol

ah, that kind of clock, i think you need to implement a very diferent function for that , but i dont want a real clock, just a timer...my project is only for demostratives purposes lol

by the way i downloaded a virtual tamagotchi and it has a clock synchronized to the OS...

#39403 - Lupin - Fri Apr 08, 2005 2:46 pm

Why do you need to do it on a GBA? I would choose a more simple platform if you don't know much about GBA.

You would at least want to save the status of your tamagochi to sram so that you can return any time.

I would just make all events random (e.g. generate a random number between ~10-20 and use this number as a minutes value, then just wait for ~10-20 minutes and after the time has passed you let the tamagochi ask for food ;)).
_________________
Team Pokeme
My blog and PM ASM tutorials

#39414 - tepples - Fri Apr 08, 2005 4:41 pm

Lupin wrote:
Why do you need to do it on a GBA? I would choose a more simple platform if you don't know much about GBA.

What platform is "more simple" than a GBA? You mean like the NES? A PC is certainly more complex ;-)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39417 - the_angry_monkey - Fri Apr 08, 2005 4:56 pm

I once made a monkey puncher tamigochi style clone for the Casio 9850G calculator http://perso.wanadoo.fr/cparules/games_action.html using Casio BASIC so the concept is actually quite easy to implement, but I agree I'd implement it on an easier platform.

#39422 - yaustar - Fri Apr 08, 2005 6:32 pm

tepples wrote:
Lupin wrote:
Why do you need to do it on a GBA? I would choose a more simple platform if you don't know much about GBA.

What platform is "more simple" than a GBA? You mean like the NES? A PC is certainly more complex ;-)

Probably not 'less simple' but 'less limitations'? And thanks tepples' I did mean a RTC on a pokemon cart :)
_________________
[Blog] [Portfolio]

#39424 - ghost Leinad - Fri Apr 08, 2005 7:12 pm

why the GBA?

well is because i like it...and i have two months to learn...
and i cant make a random generator because i need the use of some "AI".

for now my biggest problem is to fit all my sprites in the 16 kb of memory(im using the mode 4). but i think i already solve it...

let me know if im wrong...this is my theory....

my sprites are:
the tamagotchi
the buttons
pictures of an apple, a shower, a syringe and others

but in fact if i have more than one instance for the same sprite i can reuse the same space in memory for the new instance

to change my tamagotchi from happy to sad all i need to do is change the Data and use the same direction

i already tested this "behavior" to change a circle to a square using the same direction in memory but diferent Data and it works lol

so i can have in my ROM different instances from the same sprite and change them using a timer and this will create an animation (sort of) :S

ok...if you have any more ideas please let me know

ahhhhhhh....by the way..do you know any Mexican? (in this forum :D)

#39426 - expos1994 - Fri Apr 08, 2005 7:22 pm

Ok Tamagotchi. Like a virtual pet, right?

Why not have one big ol' structure with all his little attributes.

health
hunger
happiness
pissedoffedness
fatness
playfulness
attack
magic
defense.. etc, etc.

all of em on a scale of 1...1000 or whatever.

You feed him, and his hunger goes down, his health and fatness go up. You feed him too much and playfulness, health, etc goes down. Poke him with a stick and p-odedness goes up. Chop off his tail and it goes way up.

There you go. Make a couple versions of him. A fat one, a tough lookin one, a normal one. One with long hair (yeah, add a haircutting minigame..how fun). When his fatness gets too high, his sprites change to the fat ones, (that's where the hamster wheel mini-game comes in).

I've never played tamagotchi before. What else can you do?

Trade him with your buddies! link cable. yeah. Maybe you could have some kind of pet store, where you raise a bunch of different tomogotchi's and you try to get big bucks out of em so your character can buy a new scooter. (then you could have a bartering with customers mini-game. And also you could have a tomigotchi pet store basement cock-fighting mini-game, where you make em fight each other)

Sounds pretty sweet, do you need a partner?

#39428 - ghost Leinad - Fri Apr 08, 2005 7:55 pm

jajaja... your tamagotchi is a very alaborated one...

a tamagotchi is a virtual pet with emotions(virtual) and depending your actions your tamagotchi will be happy, sad, mad, sick, etz.
with a "not very complex" use of AI

have you ever played the sims? this monkesy has a very complex AI

well...i already have an structure holding some impotant facts like happines, cleaning, weight, hunger, age, discipline, health and that's all

with this options i will make the diferents emotions on my tmgotchi for example if mi tmgotchi gets older then its health will be lower or gets hungry faster

i have an baby, a young one and an adult
and 4 instances of every one of them(happy,sad,sick, and mad)

the minigame thing will be an extra...first i need my tamagotchi running
and then i'll add things like a save system or minigames for fun

the important thing is to show the diferents emotions because this is my goal...a pet with diferents emotions using some AI

and of course i need a partner, i will need all the help i can get lol

#39449 - tepples - Fri Apr 08, 2005 11:47 pm

Remember that for each sprite, you only need to store one cell in VRAM. You can keep the rest of the cels in ROM and then copy only the ones you need to VRAM. If you do it this way, then 16 KB of sprite cel VRAM is a lot.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#39453 - ghost Leinad - Sat Apr 09, 2005 12:37 am

i finally got it...yes teppes you're rigth 16 kb is a lot :D

check the next url for some images of my tamagotchi...




http://groups.msn.com/chimbombospump/tamagotchi.msnw?Page=Last

the letters on the right are shorts for hunger,discipline, happyness,health, clean...time of the day and age lol

now its time for the hardest part :S