I know my track record for completing a blog series is pretty lousy, but this one should be easier. I kept a personal log with pictures during the development of Smiles, so most of the work is done for me. I just need need to go through it and regurgitate my notes.
To start, I’m going to give a bit of insight in to what happened when I stopped writing my Engines, Names and Evolution blog series last year.
I apologize, but I am going to skip a significant follow up to that series for now (the Hammer engine), but this series should bring us back up to date.
Here we go.
– – – – – – –
Late 2007 and early 2008 were spent working on libraries, and foundation for my new engine Playground.
Playground was the successor to Hammer (PuffBOMB HD… will talk about this another day), which in turn succeeded Freedom.
– – – – – – –
Before PuffBOMB HD was shelved in late 2007 (Hammer engine), I was working alone on the project. Amicably, but that’s a series for another day.
The core issue with Hammer is that it wasn’t very reusable. As a whole, you could certainly build a new project based on it, but it’s elements were poorly isolated. Triangulation and collision testing code was embedded right in to the physics engine, so I couldn’t use the same code elsewhere without a lot of waste.
I prototype games regularly, and the product of this year of development (2007) wasn’t as useful as it could be.
– – – – – – –
Late 2007, I was at a crossroads. I still had savings left, but only enough to support myself. I needed a break from PuffBOMB HD, so I coined a new project. A suite of libraries and tools I could personally use for prototyping and developing games faster and more efficiently. The end goal may have been to build a Metroidvania derivative, but the core of the project was to build me some tools. If the project was going to fail again, at least I’d have a foundation to try the next thing. This was the Playground project.
Here’s where I get technical.
As mentioned, Playground is a suite of libraries and tools. It started with me collecting what usable parts I could extract from Hammer, and my Ludum Dare games and framework.
I should also mention that by library I’m referring to an element. A directory of files. Either copy the directory in to a project, or set up an SVN External for it. Only a crazy person would compile their work in progress library to a .lib/.a file and install it. If that’s you, you’re crazy! 🙂
One of the first and most useful elements I built was the Data and Serialization library. I decided to finally stop using C++ streams for binary File I/O, but wanted my file reading syntax to be nicer than fopen. The syntax for loading an arbitrary binary file from disk is as follows.
DataBlock* MyData **=** _new_DataBlock_( “Data.bin” );
Nice and easy. A DataBlock is an incredibly useful and lightweight basic type. It represents an arbitrary block of memory with a size stored in the first 4 bytes. It’s defined as followed.
<strong>struct</strong> DataBlock {<br /> <strong>size_t</strong> Size;<br /> <strong>char</strong> Data[0];<br /> };
Pretty simple. For completion, the Data and Serialization library includes similar calls for normal non DataBlock data, but they’re so lightweight and flexible I use them anyways.
The great part about writing your own I/O wrapper is you can seamlessly integrate things like compression, munging, CRC’s and checksums. For example, load and decompress a file in 3 lines (one cleanup).
DataBlock* Compressed **=** _new_DataBlock_( “CompressedFile.zlib” );
DataBlock* Uncompressed **=** _unpack_ZLIB_DataBlock_( Compressed );
delete_DataBlock( Compressed );
The library is also written in such a way that, while it supports many compressors/hash methods, they are not required to be built or linked against the project unless explicitly used. In other words, if I don’t use BZIP2, I don’t need the BZIP2 headers or C files. As lightweight as you can make a library.
The vector math library is borrowed right from Hammer, cleaned up and isolated to be vector, scalar, and matrix math only. Types for rectangles and simple primitives are a library. Coding niceties like template types containing a,b,c or r,g,b,a components are a library. Strings, parsing a whitespace delimited file, and debug console logging as well.
Collision tests, and everything you do between primitives is a library of functions. Extremely long names, but they’re now modular in such a way they can be used in a physics engine, in a primitives library or a GUI/Menu system.
<strong>if</strong> ( Test_Point_Vs_Polygon2D( ... ) ) ...
Where this one returns a boolean value. I wont bother listing the arguments, but it’s a global C-like function. It takes direct types and pointers where appropriate. The functions follow the form “Action_What_Relationship_Who( … );”. Action is the operation, What and Who are the terms being tested, and the Relationship is the rest of grammar required to describe the operation.
Nearest_Point_On_Chain2D( ... );<br /> Nearest_CornerPoint_OnEdgeOf_Polygon3D( ... );
Where the Smiles story begins is the Grid library.
Grid was a library created for a Ludum Dare game Pillar Caterpillar.
Here’s some concept art.
Pillar Caterpillar wasn’t playable within the compo timeline. It however still featured some great pre-production work, and a useful chunk of code that became it’s own library in Playground. Further work was done on the project, but that mock-up is the coolest looking part.
For the time being, only minor changes were done to Grid.
– – – – – – –
Shortly after the iPhone SDK was official announced in March 2008, I started prototyping some game concepts. The first, Magtraction (since Magnetica was taken, by a game completely unrelated to magnets).
A prototyped game concept deemed “too boring“.
The second, Dungeon Legion.
A prototype game concept deemed “too awesome“. Too awesome to finish in a short period of time. 😀
Both of these prototypes were the projects used to get the geometry tests up and working again.
You might hear more about Pillar Caterpillar and/or Dungeon Legion in the coming months (both projects are on my list I’m considering).
For the 3rd prototype, I wanted to revisit Grid.