object based programming


Mrlegoboy 2021-01-24 04:52

in mario 64, there were objects. when the game needed to show, lets say, a goomba, it would load all of the data for it (texture, model, animation) into the nearest available location in memory. in NX we might be able to do something similar. with my recent animator program, we realised you didn't need a lot of code to show a good quality animation anymore

lets call each "thing" we want to show on the screen an object. an object ideally should have a limited use of characters. in my animations, i typically see myself using probably 16 to 32 cells, max. lets say we want to show an object. the first step would be to see if we have enough memory to do so. lets say in this game our background takes up the first 10 characters, and the last 64 are reserved for text. our object, lets say a skeleton, has 20 characters total that need to be loaded in. the first step is to check if the char memory left is greater than the char memory of the object. in this case, it is. if it isn't, you could either throw an error or just choose not to load the skeleton. the animations of the skeleton, after performing the same memory safety checks, can also be loaded into ram.
at this point, we have only loaded the data of the object, we have yet to actually load it into the game.
if the animation data is formatted correctly, in the same format as NX's sprite registers, all of the sprites can be set at the same time using a single COPY command from ram to the sprite registers.

CubicleHead 2021-01-24 13:30

That sounds cool

Timo 2021-01-24 16:07

A similar, but less dynamic (and maybe easier to implement) way could be for example:
Use characters page 1 for the player sprites.
Use page 2 for tiles.
Use page 3 for enemy sprites.
Use page 4 for font.
Now depending on the level or current screen you just load your needed characters into their pages. For example during a level you might have many small enemies, so at the beginning of the level you load them into page 3. On the last screen of the level there is a big boss which needs a lot of characters, so you overwrite page 3 with it (the other enemies are not needed then).

Log in to reply.