I have been thinking over more and more, without much actual coding, on how to handle cycling through objects, collision detection, sprite frames, etc.
I'm looking for discussion of ideas or solutions for these problems. My goal is a good balance of flexibility and speed.
So far I've figured I want to have a 'engine' that can cycle through objects and update everything. So the top level I am thinking about would be that: the code that updates each object. I have a lot of thoughts bouncing around, so maybe start there instead of typing a really long post. What kind of data structure should the object have? I'm thinking about handling everything a player interacts with as an object (platforms and doors too) and I'm imagining a platform/action type of game.
So far I want my object to potentially have (in RAM):
-object number
-object type
-X,Y (screen? world? I guess it doesn't matter)
-deltax,deltay
-pointer to metasprite
-current frame (metasprite)
-direction (metasprite flipping)
-status (attacking, defending, resting, hit points, whatever.. extra data as needed for object type)
-incoming event (set by another function doing something to this object)
-pointers to various function for this object number on events. ( I guess this could be a separate jump table in ROM)
Is something like this normal/good coding?
Issues:
How to allocate and track RAM on creation/destruction of an object?
I think I would like to sort by at least one coordinate for better collision detection, any suggestion how to have a sorted list index the object?
Thanks
Edit: Made this test program last week.. can't get much further yet.. : http://wikisend.com/download/164710/ball.nes
I'm looking for discussion of ideas or solutions for these problems. My goal is a good balance of flexibility and speed.
So far I've figured I want to have a 'engine' that can cycle through objects and update everything. So the top level I am thinking about would be that: the code that updates each object. I have a lot of thoughts bouncing around, so maybe start there instead of typing a really long post. What kind of data structure should the object have? I'm thinking about handling everything a player interacts with as an object (platforms and doors too) and I'm imagining a platform/action type of game.
So far I want my object to potentially have (in RAM):
-object number
-object type
-X,Y (screen? world? I guess it doesn't matter)
-deltax,deltay
-pointer to metasprite
-current frame (metasprite)
-direction (metasprite flipping)
-status (attacking, defending, resting, hit points, whatever.. extra data as needed for object type)
-incoming event (set by another function doing something to this object)
-pointers to various function for this object number on events. ( I guess this could be a separate jump table in ROM)
Is something like this normal/good coding?
Issues:
How to allocate and track RAM on creation/destruction of an object?
I think I would like to sort by at least one coordinate for better collision detection, any suggestion how to have a sorted list index the object?
Thanks
Edit: Made this test program last week.. can't get much further yet.. : http://wikisend.com/download/164710/ball.nes