Leafy green goodness.
Posted by Overkill on July 14, 2008 at 1:19 am under gruedorfSo about two and half months have passed since my last blog entry, which wasn’t even about Resonance. The last Resonance posting? About 4 months ago.
The funny thing is, despite the rarity of posting, lots of design ideas were tossed around behind the scenes. Sadly, I didn’t realize that I didn’t even have a design document for Resonance the entire time I was working on it. That realization helped immensely. And so I embarked on rewriting my Lua code for my game engine, and started to make some headway.
But along the way, the same redesign also caused me lots of woes, because I realized there was a couple things that I wanted and I was frustrated with how I’d need to write them in Verge.
I tried making my own custom map format in Lua, but the lack of bitwise ops sort of killed that progress. And I didn’t want to go through the hassle of patching up Verge to support my own map format. So eventually (this past weekend) I decided enough was enough. I started writing my own game engine from scratch in C++.
Part of me knows it’s foolish amounts of extra work. But part of me thinks it’ll pay off and I figure I needed to learn how to write my own C++ game engine at some point.
I named the game engine brockoly.
This misspelled vegetable name was zeromus approved.
Originally this name was supposed to be for the custom format I was making, but I decided the engine might as well have a name of some sort.
Anyway, so far, the following things have been done:
- Loading of software images
- Get/SetPixel
- Clipping regions
- Rect, SolidRect
- Normal blit
- Scale blit
- Rotate blit (needs more optimization still, IMO)
- Builtin blend modes on every operation, that are performed by macros (and it’s my hope that gcc’s
-O3is smart enough to further optimize it):- Overwrite (direct pixel copy)
- Preserve (blends source with dest pixel without changing alpha — pretty much intersection of the images (the default behaviour because it’s featureful enough for normal cases))
- Merge (blends source with dest and changes alpha to accomodate — pretty much a union of the two images (more “what you’d expect”, but slower than Preserve, and likely to be less common so this is why it’s not the default))
- Add (adds RGB values together while obeying alpha — useful for lighting)
- Subtract (subtracts RGB values while regarding alpha — useful for shadows)
- SDL — although only to manage the window and flip buffers after I’m done drawing.
And here’s some things I need/want to do still:
- Global alpha applied to all drawing operations (right now there’s no actual way “setlucent” or similar but alpha is supported when built into the image)
- Rotate scale blit (holding off till I can get a more efficient rotate if that’s even possible)
- Color filtering effects
- A notion of “palettes” and a palette map for images that allows quick and easy color replacement that can happen all at once after the image’s palette alteration is complete.
- Tiled blit
- For every src->dest blit, another kind that blits only a subregion of the source
- Hardware texture versions of all the blits (where textures can be made of software images and at any point the texture’s underlying image can be updated (it looks like it can be done by
glTexSubImage2Dat least — I’d just to see how many migraines are caused if this requires a different pixel format than the regular software blitting.)) - Scripting with Ruby — bound to be less crippled than Lua. As nice as Lua is, it’s lacking too many features and has a bunch of quirks that still make me cringe a bit (like any non-nil value besides false is coerced to true in boolean expressions, indexing from 1, no bitwise, no classes (and although you can make your own, you can run into more complicated things like not being able to garbage collect everything, or certain limitations on LuaBind’s class that make me use tables which have no __gc metamethod)).
- Audio through FMOD Ex or Audiere.
- A nifty “huge world” format that will hopefully read areas of the world into memory seamlessly. Each area would have its own tileset, theme, set of entities, set of zone types, layers, and metadata. Any region of a layer could have metadata. Each layer gets its own tile plots (duh), obstruction, zones and and entity plots (handy for multi-layer maps)
- A tileset format that allows scripted animations and tile arrangements (brushes) and tile categorization (for labelling metadata on certain tiles — could be useful for map events to be able to name tiles, especially for random map generation or “special” tiles)
- A sprite system that allows for custom animations and multiple hotspots (useful for stuff like ducking/crawling or other crazy poses in games (especially sidescrollers) I figure).
- Have error messages print in the game window instead of as a popup (this is really good for fullscreen and for looking more awesome). Probably will allow a customizable background. Would still probably need popups in extreme barf cases, but I’m trying to avoid platform-dependent annoying popups for a bit.
- Might optimize alpha blending for software to lose slight accuracy (which nobody really cares about as long as we still fade/blend okay for about +80% accuracy) in turn for better speed.
So yeah, I have hopes that I’ll one day finish most of these, and then as a result be able to make Resonance super awesome and perform great.
I am crazy, I know. But if I can finish this, it’ll be a grand accomplishment that anyone can use, since I plan on releasing the entire thing under a BSD-like license or something. Eventually when I get more progress, I’ll see about getting an SVN for it — but right now that’s sort of pointless.
Anyway, that’s a short version how I’ve been and what I’ve been up to. I’m sorry for holding off on my planning, with excuses of being busy some times, and hopes of eventually wowing people later other times.
But Grue made me realize that nothing gets done as soon as you start thinking of small progress as not worth bragging about. This is what Gruedorf is about.
Now, beware, my many adversaries! I’m back, and I will kick you in the behind (if everything continues to go well and I don’t screw this up again).
Yeah, pretty much. But I figure this is time well wasted! :D
Way to selectively listen. Grue also warned you against “not invented here” syndrome. You’re going to end up with a large legacy codebase of your own making that has the same problems instead of a large legacy codebase of partially your own making.
I fully contest that you could add the features you desire to v3 quicker than making your own engine. And I fully contest that you’d gain as much from it as writing your own engine.
Working on legacy and making it better is, ultimately, a better skill t have than to greenfield projects. It’s more applicable to the real world, and it’s a superset of “good design practices”, so you’re not shorting yourself on any given experience.


Andrew G. Crowell (Overkill). I am awesome.
[
I am glad to hear from you again, I will say. I guess the whole GCE has to be done before any more game is constructed?