Advertisement

which method should i use for engine independent level-design?

Started by February 10, 2015 11:21 PM
9 comments, last by rockson 9 years, 10 months ago
I'm programming a 2d side scrolling game and I'm managing to add levels to it. I need to set where objects are placed so that I can load them indistinctly from the engine. And is there also a method to show them graphically?

EDIT

At the moment I'm using unity but I can't rely on its scene editor because I'm managing to port the project in another engine like libgdx or cocos2d.
I've tried tiles editors but they weren't what I needed. I have to set where obstacles are placed. Think to something like jetpack joyride's levels. Or flappy bird with the position of the obstacles loaded statically from a file.

Moving to For Beginners. Now that it is in the right place, please read the Forum FAQ.

From the FAQ, please list what have you tried, what programming languages and systems or game engines you are using, and anything else that you think may be helpful in answering your questions.

Advertisement
Up?

Up?

You'll get better answers if you follow frob's advice.

Hello to all my stalkers.

Up?

You'll get better answers if you follow frob's advice.
Sorry I haven't read the last section! I'll add extra information by editing the first post.
Don't really get what you mean about engine independant, unless you're targeting a specific engine and existing file format there isn't really any magical way to save game specific information to be used between totally different engines unless you write middleman code.
Advertisement
I apologize for not being so exhaustive, it's very hard for me to explain...
So how does programmers place objects in engines like libgdx (so without a graphical interface)?

Short answer: with code. Long answer: For example you usually have a level designer (depends on the game though) using some kind of editor to put the things in place, this editor can save all that data under some form. Then you'll need a piece of code (usually your programmer would write it or you'll use a library) that can make sense of the file you have from your editor (you may need to convert the format from the editor to something else before using it too). It would help a lot if you try to elaborate what exactly you are trying to do. From what I get up to now, you want to use unity's editor to create your scene - then get the output file and read it so you can use it in another engine. To do this you'll need to know the structure of a unity scene(?) file, and be able to make sense of each structure in the unity file and convert it to something that makes sense in your engine. You could also try another thing - write your own editor that does exactly what you want and not tons more(like Unity), which saves everything exactly in the format you need it.

There isn't really such a thing as an engine independent way of building levels.

There hardly even is such a thing as a game independent way of building levels.

Most use some set of custom tools, or plugins/exporters to existing tools (such as the unity editor or maya, or blender, any of the tile editors out there, etc) to build levels for that specific game, and building the tools is part of the work needed to make the game.

Or, if it is a small simple game, there might not be an editor at all, all set through code, or even generated.

Or, just an xml file written in any text editor.

Keep in mind any representation of a "thing" in a game has to be assembled from some data.

For instance in a 3d engine if you walked around in an FPS environment all the walls, the ground, any object you can see is just defined as vertices at some point. At a basic level you can do this by hand, you literally set the buffers with code and then let the library render them out.

Thinking at a basic level you literally could build a large scale game doing nothing but typing out tens of millions of lines of code to set vertices and build models, but of course we don't do that because it would be horrendously clunky and a nightmare to do. The alternative is to use reusable code that can parse data to create the vertices. For instance we could have a simple text file with nothing but vertex coordinates typed one line after another, and then just create a small bit of code to load each set in a loop, instead of having to type all that code out each time we just use a simplified system to load it for us.

That is really all it comes down to, we move the data into files instead of code, we create tools to generate those files automatically with things like level editors or modeling software. What matters is translating the data from the files it resides in, into a form the engine can work with. For that reason there is no "standard" for level data. There are popular ones, for instance some engines just use standard modeling formats for their level geometry, and then they load extra files with data that describes dynamic objects, or what have you.

Basically it is all highly dependant on what the engine/game has been designed to work with.

This topic is closed to new replies.

Advertisement