Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Game question

Name: Anonymous 2014-06-16 20:00

I am creating a game (engine) with SDL 2 using C and I am planing to have a scheme dialect to extend it in the future
here is my question, let's say I have N textures that I want to be rendered, should I have them in a list and render them every time something happens to the event loop? The other programmer I am working about is against the idea of having every texture in a list and believes that we should have them normaly in the code like variables, what to do?
another question is how to access other objects by some functions, for example I want every time someone presses the UP button to change the player position but in that case I should a: have the player variable as global or b: pass it in that function, should I have another list or something (like a db) for every object or something?
I have no idea on how to work with game stuff

Name: Anonymous 2014-06-16 20:18

typical design is to load textures in as assets, have game objects (tiles, sprites) reference them with pointers or offsets. stored objects might reference them by name, this should be converted to pointer or offset when loaded into memory.

advice: read up on the doom wad format. clean, fast, compact asset storage.

iirc SDL presumes you will issue redraw for the entire screen every frame and reserves the right to trash your buffers after they've been blitted.

it's best if you can avoid globals. but fine for prototyping and for small games. when making a big game out of a small one you will usually need to turn some or all globals into stack objects and pass them around.

you forgot to ask a question about scheme. collect every frame.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List