🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Just some code

Published February 23, 1999
Advertisement
Finally writing a bit of code, but just the underpinnings of a game engine. Not much to show off yet.

Got most of the data structures done. One thing I really liked about my old class library was that it came with some very well thought-out base classes for common simple data structures, like Point, Size, and Rectangle. In addition, it included a bigass bunch of collection classes and the best string class around. Unfortunately, though, it was designed to run on circa-1991 C++ compilers, so niceties like templates and namespaces were nowhere to be found. The old collections were typesafe, but were macro-based and problematic.

Fast-forward to 1999. The STL is stable on just about every platform around, which takes care of the collections and the strings. STL collections are not only template-ized, but they're so tight that they're implemented entirely as inline functions. Using C++ templates, I was able to rebuild char, short, and float versions of the old primitive classes (and some 3D versions) in about 1/4 the code of the originals. Templates are officially my friend. Kudos to SGI for making a well-written, portable, and free implementation of the STL.



As for graphical stuff, I'm working on the base sprite classes. My sprite objects so far are similarly handled to the way I did it before, because it worked very well in my old games implementation.

Basically I've got a class called SpriteManager, which points to all sprites being used and handles drawing, collisions and such. SpriteManagers can be attached to Window objects. Whenever the window needs to draw, it just tells the SpriteManager, which iterates through all of the sprites, drawing 'em. In my old scheme, however, there was just one static SpriteManager, which was attached to the one static Window. In my new scheme, I'm hoping to give multiple windows the ability to attach to a SpriteManager, so I can show multiple views of the same set of sprites.

Sprites will likely not be much different from the old ones. I was thinking of once again making some non-interactive non-collidable self-destructing sprites (called EyeCandy) for little graphical flourishes like explosions. I was thinking of making ways to attach behaviors to sprites, so that the EyeCandy bits can bounce-n-wiggle without me having to do it for them. I'll just attach a behavior to them, and every time I tell 'em to update, they'll find out their next position from the attached behavior.

Hopefully I can get enough of the underpinnings written soon, so I can start implementing something.



Finally, I'm taking over an interesting new part of DevGames in a couple of days, and I'll need your help. Stay tuned!
Previous Entry Much fat pipe (heh heh)
Next Entry Too much mangling!
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement