Archive

Posts Tagged ‘Level editor’

2D Platform Games Part 10: Improved Level Management and Storage

February 6, 2013 4 comments

IMPORTANT! To run the pre-compiled EXEs in this article, you must have Windows 7 Service Pack 1 with Platform Update for Windows 7 installed, or Windows 8.

This article builds upon the demo project created in 2D Platform Games Part 9: Storing Levels in Files / Level Editors. Start with 2D Platform Games Part 1: Collision Detection for Dummies if you just stumbled upon this page at random!

Download source code and compiled EXE for the code in this article as well as the complete source code and compiled EXE for the level editor.

In Part 9 we looked at how to store and retrieve game levels from files in a format that could be used both by the game itself and by an auxiliary level editor application. In this article we will make things a little more robust and usable with some improvements:

  1. Allow the game to load the specified level as a command-line argument
  2. Re-factor all of the level data into a single class so it can be version-controlled and remove duplicate variable declarations in the game and level editor
  3. Add functions to the Platform class to create platforms from the GeometryDefinitions stored in the level files, neatening things up by making them more object-oriented and removing duplicate code from the game and level editor

Let’s get cracking!
Read more…

Advertisement

2D Platform Games Part 9: Storing Levels in Files / Level Editors

January 29, 2013 4 comments

IMPORTANT! From Part 8 onwards, you no longer require the Visual C++ 2010 Redistributable Package installed in order to be able to try the pre-compiled EXEs provided with the examples.

IMPORTANT! From Part 6 onwards, compatibility with Windows Vista in the pre-compiled EXEs has been dropped. To run the pre-compiled EXEs, you must have Windows 7 Service Pack 1 with Platform Update for Windows 7 installed, or Windows 8.

This article builds upon the demo project created in 2D Platform Games Part 8: Pass-through Platforms. Start with 2D Platform Games Part 1: Collision Detection for Dummies if you just stumbled upon this page at random!

Download source code and compiled EXE for the code in this article as well as the complete source code and compiled EXE for the level editor.

Until now we have just used a fairly arbitrary demo level that was hard-wired into our game code. This is neither very flexible nor very fast. It’s hard to create levels, and we also can’t offload that task to other members of our team. The solution, of course, is to make a level editor application which can save levels into files that the game can load.

Figure 1. Basic level editor for our platform game

Figure 1. Basic level editor for our platform game

Now, I can’t show you in one article how to learn Windows or other GUI programming and write a level editor, however we will look at several important topics around this:

  • how to re-factor the way levels are stored in memory so they can be exported to a file
  • how to export a level to a file
  • how to import a level from a file
  • how to add versioning to your level files
  • the basics of what a feature-complete level editor should do
  • sharing common code between the game and level editor applications
  • some tips and code snippets on how to create useful level editing tools and how to make your Windows-based level editor work with Direct2D

Read more…

%d bloggers like this: