Currently I am working on making my level building in my game much more diverse and easy. Formerly I was having to create custom models for each room in the game. This worked but was hardly efficient, very time consuming and did not leave much hope for the end user to create and share levels either.
So I set off to kill two birds with one stone:
- Make a level building system & editor to streamline level creation in my game
- Make the editor easy to use to open up the possibility of the end user gamer being able to make custom levels using the pre-made building blocks.
So the idea around this whole system is to make lego blocks, The lego blocks get constructed together in any different way specified by the user to make a level and the user can simply slap on any texture they want. This will make level building very fast. There are a number of things that were musts for this system in my eyes:
- Data Driven (of course... did you think I would do a blog without talking about that...)
- Utilize unit lengths and snapping (no decimal point dimensions & positions)
- Optimize UV's so that the pieces can utilize different materials easily (sort of like creating a standard for Level part UV's that all pieces and materials must comply with to work)
So with out further ramble, please enjoy the below video that goes through the process of me exploring this. This is part one of 3 which I will show in separate blogs.
1. Origin of Level Pieces At first I thought that putting the origin at the center of the pieces would be a good idea. However, this turned out to be the worst idea ever as it totally screwed up the unit length idea. For example you have a 1X2m floor piece, if you put the origin in the center the origin is at 0.5X1 <-not unit scale... At first you may think this does matter but it does. consider placing a 1X2 piece next to a 2X2 piece. if 1X2 floor piece was at position (0,0,0) then the 2X2 piece would have to be at position (1.5, 0 0) otherwise it would overlap. see image below:
So to solve this I put the origin at the very corner of each piece with each piece extruding out into the positive X Y and Z directions as shown below.
Sure it was a stupid mistake but an easy one to make.
2. There is no problem number 2
The next thing I will be doing is creating the editor. This entails a bit of windows programming. I don't want it to be like the HAARP editor I made. I want it to be nice and easy to use for just about anyone who would play my game. It will be using proper save and open dialog boxes and other such Windows utilities to make it familiar. I will blog about this next time.