N008 needs help with general game structure (DirectX)

Started by
1 comment, last by TLAK1001 17 years, 6 months ago
Hello GameDev community. I am currently planning out my first video game. I have hit a wall with setting up my sprites. I have a class for each object (Player, bullet, rocket, enemy, etc) derived from a sprite class that holds some general data (position, movement, animation, sprite source, etc). Each sprite is a texture drawn on a 2-d square. I have loaded vertices into my vertex buffer for squares the size of the player sprite, the size of the bullet sprite, etc etc. Then I put the address of the square into the sprite class and render the appropriate square (after transformations) with DrawPrimitive(), using the index value as a start value. That way I can graphically create as many instances of one object as I please with only one set of vertices per object. Is this the way to do it? How do "real" video games do things like this? Thanks in advance for your help, tlak
Advertisement
That sounds fine to me; your design seems fairly well thought-out, and nothing sounds obviously wrong with it.

I wouldn't worry too much about the way that 'real' video game programmers do it, if there is such a thing.

Unless something in your design is seriously limiting, unsafe, or results in a measurable loss of productive time, I wouldn't change it.

You can code something that works well enough (give or take a tweak or two) in a reasonable amount of time, or you can spend countless hours designing the perfect system for your game. The latter is fun, but largely unproductive, and I recommend you steer clear of it [smile].
Very nice.

Thank you very much.

This topic is closed to new replies.

Advertisement