Thursday 22 February 2018

Bounty Hunter II Update: Level + Cutscene editor


Hello there, it has been quite a while since I’ve updated about this game.
However the lack of updates do not depict the whole entire picture of how development has been since I released the alpha… well maybe a bit.
I did add in a few levels here and there, but I’ve focused progress on trying to refine the game. Not only what the player experiences in the game but what goes on in the development scene. Last post about BH2 I talked about making some new level editor because I didn’t like the old one. And the old editor was becoming a pain to use, so I decided to take the risk and create a new one. From scratch.

Level editor

I spent a good amount of January making and refining this editor. Heck. Even on the day I’m writing this, I still have some hidden work left to do on the editor. And I can say it is far better to use than the old editor – it’s nothing you’d ideally want to work with, however it’s good enough for me to cruise through level design in auto-pilot.
Let me explain how:
-          I have created a slider that allows you to easily allow you to switch between levels, in the old editor you had to change the number by hand, which gets pretty tedious.

-          Levels are stored as little bits of data consisting of arrangements of certain objects i.e. enemies, cut scenes and objects; instead of folders containing the prefabs themselves this object loads one prefab like a boundary and according to the data it contains, it manipulates its size and position. This means I’ll only have to change the boundary (or any object) once. This saves me plenty of the slog of having to manually edit every single instance of the same object.

-          In the old editor, every time I wanted to add in a new position I would need to manually add it to a linked list of positions (which the index of those positions is loaded in respect to the current level number). Now the level object (that is loaded) contains the positions of the player’s spawn point and if I want to change the players position, easy! I can just alter the player’s position in the object, no need for all this tedious looking though index monkey business.

-          Recently I added in a feature that can just place any object depending on where your mouse is and the game does all the work of which segment of the level data to assign it to, saving me a lot of grueling work I had to suffer through when I made the December alpha.
Level production is much faster this time around, however it is still quite slow because as I’ve said before I’m still working on this editor and good levels require lots testing and polishing. Not to mention the other things that require my attention i.e. rewriting less maintainable code, writing AI, play-testing, creating cut scenes.

Cutscene editor:

Creating cutscenes.
I’ll mention about that next. At some point I considered making a cut scene editor but refused as I thought it would be too hard. However as I successfully made a level editor, it surely wouldn’t hurt to make a cut scene editor, right?
Well I was initially right, because I’ve had quite a lot of trouble making this cut scene editor because there was a lot of stuff I had to do. Now it’s near-complete, I can make cut scenes easier than I could before.
Before I had to deal with a load of variables showing up, and it was quite messy to work with.
Now with the new cutscene editor - only the needed variables show up if I want to edit a dialogue or a movement. At least I didn’t take the inane route of hard-coding every single scripted event that happens in the game. I’ve learned far too well from developing BaTemp that hard-coding things that clearly don’t need to be hard-coded can be very slow, dull and tedious.
It’s always important to not only work hard, but smart too.

Object pooler:

This is more technical than the last two, but it deserves a place in this post nonetheless. What an object pooler is:
A system that allows objects to be pre-created into the scene and put in a ‘pool’ and disabled. Once the object needs to be there i.e. an enemy shooting a bullet or heck, even the enemy itself, the needed object rather than giving the engine the instruction to create a new object, is instead taken out of the ‘pool’ and enabled. Once the object is gone/not needed, it is put back in the ‘pool’ and once again disabled, further awaiting it’s time to come.
“Why is this efficient?” you may ask, “Dosen’t it lag the game with far too many objects?”

No, since they’re disabled.
But here’s the main reason why – if a robot shoots a bullet, a good amount of people would think “Obviously we’d need to have a bullet created! How else is the bullet going to exist” which is fine… except when you have say –  25 (let alone more) robots all shooting bullets at the player, each individual one being created and destroyed. At this point the game engine will be thinking “My goodness! This is a whole lot of work!” as it constantly gets panic attacks trying to get multiple requests to create/delete objects, thus lagging the game and lowering the performance.
However with object pooling, it is nice on the processer – the objects are already made, all the engine needs to do is just enable the desired object in the pool and pop it into the game. Thus creating much less lag and performance is high.
It’s still being worked on though, and I am incorporating it into the level editor.

Artificial Intelligence:

The AI has had many revamps too. In fact this is my main focus right now, as I thought that may have needed some refactoring. Funnily enough this whole notion that I had to improve the AI came from developing the 2nd boss in the game. I wanted the character to feature some AI to be challenging, however I had some pretty tedious code on how AIs do things so I decided to change the overall code which definetly made things neater.
In fact I came up with an entire library of AI functions which any character can access, so I can add in AI a little bit easier.

I’m still working on it and looking back at the code I have far too many regrets on how I did the AI. It’s quite messy, but you live and learn. Hopefully with these ideas in mind I can make AI in future projects better.

Summing up

Much apologies if I haven’t focused on anything that wasn’t technical. But in all honesty – you can’t go through game development without focusing on the technical stuff. I’m trying my best to do some progress on this game so bare with me.
In the meantime, I would like to share some very cool news about RBA in my next game development post.

That’s all from me!