This repo is for my expirements with tile engines in Cocos2D. The goal is to design a decent codebase that could be used to make an RPG. This is not a framework. I don't expect this to ever be a library but merely a foundation to write a specific type of game. That said, I hope that this code could be of use to someone. Particularly, the code that loads Tiled .tmx map files.
- Multi-layered tile maps
- Integration with the Tiled map editor
- Simple spreadsheet files to define game objects and other properties
- Dynamically populated maps from SQLite database
- Simple XML sprite animation format
- Simple component based map actors
Map files are in Tiled .tmx format. Each map file must have tile layers named ground, fringe, over, and collision and an object layer named objects. This is a restriction for my particular game, but the tmx loading code can load any arbitrary layers. Multiple tilesets are supported.
The bottom tile layer of the map. Pretty self explanatory.
Below the Ground layer but under the Object and Over layer. Used for overlaying things on the ground.
The top layer. Used for things that should be drawn over everything else, including objects.
Defines the collision map.
- No tile = no collision.
- Any tile = collision.
Perhaps this can be improved upon in the future to support many collision types, but for now it is not a priority.
Where all actors such as the player, NPCs, etc. live. Static actors (things that exist in a map regardless of game state) can be placed in the map file using Tiled's object layer functionality. Actors are loaded by calling the appropriate factory method that is registered at runtime.
Game content is stored in .ods spreadsheet files to provide an easy way to edit game data. At runtime, the spreadsheets are opened and loaded into an in-memory SQLite database to provide easy manipulation during runtime.
All persistent data is stored using SQLite databases.
Actors are merely collections of "component" objects. Components provide a unique piece of functionality to an actor. Examples are physics, AI, and graphics. This prevents the issues associated with using deep inheritance hierarchies to define actor functionality.
- cocos2d
- pyglet
- lpod-python - for loading .ods spreadsheet files
python test.py
Make sure you are running python 2.7, 3.0 will not work.
GPL v3 because sharing is caring. :)