Sunday, July 29, 2012

Project Green: Editor and some level loading stuff

This was supposed to be a post for two weeks ago, too lazy to post it for some reason~ :P

Anyway, about the updates I've done for Project Green.

1. Building an editor for loading and saving a level scene, from and to XML.
The game loads its level by reading from an internal XML data, and then spawn all the elements within a level according to the XML data.

a. For a while now, I've been building levels into a scene, and then export everything into a XML data. And when I wanted to combine two scenegraph into one, I had to copy from one scenegraph data to another, which is quite a messy process as all the exported XML data were sticking together in a big chunk, and is very hard to read and edit.
b. Previously when I wanna to load a level, I had to start the game and wait until I get into certain area, in order for me to see whether it's loading correctly, or is there anything I need to add or remove. And if there's something I wanna to add/remove, I had to get back into the scene (where I build the level), re-edit it and then export it again.. (and it goes back to "a." all over again)

To solve all these tedious issues, I went on and build a simple editor window which could load a scene from a XML data, and into the Unity editor without the need to start the game on runtime to see it.
I can also delete and add scenes, and then save all of them into the XML data again.
After 3 to 4 days of struggle (as I'm not really familiar with building an editor), it's finally done, and level design got much simpler~^^

2. Entry Point to the next area
The game environment is built in a "Zelda: A Link to the Past"-esque way, where every time the hero walks towards an "entry point", the next area will be loaded, while the current scene is removed.
The hero will be spawn to the corresponding area.

Well, building an "entry point" is really simple, you just need to add a trigger at an "entry point" and then just let the scene-loading process happen when the hero walks up towards it.

In addition to loading a new area (based on the XML data), I also try to play around with some Gizmos, and I made this:

You can also see a bunch of these in "1."

What this is basically, an "entry point" gizmos, where the blue cube is where the hero must enter in order to get to the next area; while the red triangle thing is where the hero will be spawn when this area has loaded from another area.

The purpose of doing this is to prevent confusion over the whereabouts of the area of influence of these entry points, and player's spawn area.

No comments: