Archive for March 2012
I’ve started trying to figure out the way in which I’m going to port Syzygy to iOS. I don’t actually own a Mac — though I may get one this weekend — so this is all theoretical at this point.
What I have right now is an implementation written in C++ to the Win32 API. Part of this implementation is a very basic 2D game framework. This 2D framework has an abstract widget class that has render and update methods. I didn’t call this class “sprite” because it is more general (and basic) than a sprite class : it can be implemented as anything that knows how to update and draw itself. For example, I have text widgets, that call the Win32 DrawText function in the draw method. Widgets are contained in GamePhase objects; GamePhases have a vector of lists of widgets, where each widget list represents a layer, so the order of a GamePhases’s list vector is effectively enforcing a z-order. GamePhases have update and render functions that can do phase specific rendering (e.g. draw a background) and then call the render and update methods of the widgets contained in the layers. GamePhases also have a predicate “IsPhaseComplete” and an accessor “GetNextPhase” which are used along with update and render to implement the game loop.
That’s basically it as far as a game engine goes. This code clearly is not logically platform-dependent. In practice Windows leaked into the implementation in the Render method which takes an HDC as a formal parameter and elsewhere where I wasn’t being careful in avoiding Win32 types. So my initial plan on porting to iOS was to refactor the 2D game framework part of the codebase to be truly platform independent and then to find an open source 2D drawing library that someone else implemented on top of OpenGL ES and reimplement the rendering code in terms of that 2d library.
The trouble is the 2D OpenGl-based library surprisingly doesn’t seem to exist. There is a project that someone did called Gles2d which is what I want but it is orphaned and never adapted to iOS anyway. It was implemented for the GamePark32 hardware, I believe. So my options are
(1) Stick with the original plan and adapt the Gles2D codebase to iOS myself.
(2) Stick with the original plan and write my own 2D graphics in OpenGL ES layer.
(3) Throw out everything and reimplement the application to Cocos2d in ObjectiveC.
(4) Keep whatever I can of my code and re-factor to use the Marmalade framework in C++.
(5) Keep whatever I can of my code and re-factor to use Cocos2d-x in C++.
(6) Stick with the original plan and write the platform dependent drawing stuff to SDL 1.3.
Long story short, I think I’m going to do (5).
(1) and (2) are just not work I feel like doing at this time. (3) would be a good solution but I’d be locked into iOS and would have to gain more competence at ObjectiveC development than I feel like investing time-wise at this point — however, I may end up doing things this way if it becomes clear that it is the easiest approach. (4) is out because I don’t think I need a very powerful game engine, Marmalade costs money, and I wouldn’t be using most of it. I’m ruling out (6) because I don’t really trust SDL 1.3 on iOS; maybe I’m wrong about this but SDL doesn’t officially support iOS and it just seems like there would be problems.
So (5) … Cocos2d-x is a reimplementation of the Cocos2d API but to C++ rather than ObjectiveC. It is designed for cross-platform (i.e. across iOS and Android specifically) and the project looks alive and well. There is even a Win32 build of it that uses PowerVR’s GLES emulator for windows so I could in theory start work without actually owning a Macintosh. The only problem I see with Cocos2d-x is that documentation seems to be non-existent and it is being developed by guys who are clearly speaking English as a second language so I may have trouble finding answers to questions and so forth … we will see.
Anyway, … thoughts?
I’m releasing a prototype version of a puzzle game, Syzygy, that I eventually intend to port to iOS and possibly Android. The prototype is written to the Win32 API and should run on basically any Windows system without installing anything.
Syzygy can be downloaded here. Just unzip these three files into a directory and run the executable. I have the Syzygy prototype parametrized such that a single XML file defines its gameplay. I’m looking for play testers who are interested in abstract puzzle games to play the game and provide feedback regarding good values for the definable parameters. If I get multiple helpful submissions I’ll give $60 via paypal to whoever has the best revised XML file. Here’s a brief explanation of the XML file.
- The bar on the left is the game timer. When it is empty the game is over.
- Letter tiles randomly appear and the player must position the tiles in a legal crossword-style crossword grid by dragging them with the mouse pointer.
- When the player has positioned tiles such that they form two or more legal connected words, the player can double-click on one of the tiles to “lock them in” and the two or more words are then scored as follows (This is a modified version the scoring used in the game Literaxx, which is the public domain Scrabble variant):
- Yellow tiles are 1 point, green tiles are 2, blue tiles are 3, and red tiles are 5
- A tile on the a board cell of matching color receives triple its point value.
- The 2x and 3x board cells are double and triple word scores.
- There are two levels of parameter controlled bonuses for long words (see the readme file in the game directory)
- The remaining time in the game timer is increased proportionally to the point value earned by a successful lock in and the player’s score is increased by the score value of a successful lock-in times a level multiplier.
- Locked in tiles can be played off of but cannot be moved.
- Each tile has a bar timer widget on its right. When this timer expire, the tile disappears negatively effecting the global timer if the tile that expires is not locked in.
- There are three kinds of special tiles
- Random tiles: Random tiles look like gray transparent letter tiles (the weird looking ‘M’ tile above is one). They cycle through the alphabet until they are dragged the first time at which point they behave like normal letter tiles with no point value.
- Bomb tiles: (pictured above) When the user drags a bomb tile onto a group of connected locked-in or non-locked-in letter tiles, the target tiles will be destroyed without effecting the user’s score or game timer.
- Juice tiles: (appear as lightening bolt icons, not shown above) When user drags a juice tile onto a group of connected locked-in or non-locked-in letter tiles, the tiles’ local timer widgets receive additional time.
The game levels up after a certain number of tiles are locked in. The game timer is re-filled at level transitions.