One of the big challenges of making a 3d game in a custom engine is that you need some kind of level editor to place items in the world. When starting out it is often easy to just hard-code the positions of the items to test things, but once you have a basic renderer implemented and you start testing different level layouts it becomes quite tedious to manually type in a position, compile and run and hope that you placed your object in the right position. This is one of the biggest challenges I faced in my former project while trying to figure out how I was going to get the artists to test out level designs.
I considered making a level editor, but that ended up being a great deal of work, so after looking into it I decided that a custom level editor was not the way to go about doing level editing for a custom game engine in a 4-month project that was already behind schedule, it would be a huge endeavour and not worth it in the long run. So I decided that it was easier to reverse-engineer the unity test-based scene file and grab the components I needed from there for the game.
In theory it was a good idea and I ran into some issues with the file-parsing due to a lack of experience with parsing YAML files, but I eventually got a working version of my editor that could take a unity scene file using some custom scripts to define metadata about the game objects and the materials and gameplay classes associated with each object and turn it into a custom xml-style scene file that I could then run validation on and then convert into binary to load faster into my game engine.
My solution wasn't super elegant, but it worked and I feel that I saved me a great deal of time in the long run although it took much longer than I intended. I still think that I could've built a terrible level editor faster than I built this unity scene loader, but this scene loader is more robust than anything I could've built in the same amount of time using a custom level editor so I have no regrets about my decision, especially since it was for artists, I rather give the artists a tool like unity than a terrible level editor with no features.
If you wanna check out my implementation of the scene loader check out this repo.
By Joseph Whittington
Top comments (1)
Smart solution!