Skip to main content

Side Projects V2.0

I've been working on a number of side projects recently, so no actual work on Treasures of the Deep Dwellers.

However all but one of those side projects have been aimed at testing some ideas with a view to restructuring the project or developing key components which were missing.

When I finished working on the most recent version, it felt like I was nearly ready to put out a demo... but after trying it out for a while I wasn't satisfied. Movement calculation was too slow, the characters and AI were too complicated and not well designed. Adding to them was becoming too much of a chore. And there was something wrong with the pathfinding...

I took part in a game jam and had the opportunity to work on an FSM (Finite State Machine) for character management. The version I designed for the competition was a little limited because I didn't use classes, I had to define all properties for all states at initialization of the game. The result was pretty messy, but it worked much better than the simple Boolean if/else models I'd been using up til now.

I took that idea and used it with a platformer demo which later morphed in to a point and click adventure game... This time I took the time to investigate using classes as part of an FSM.

After some experimentation and some tips from a fellow programmer I had something that really worked. The result was much tidier, much more comfortable to use and expand, used less code much more efficiently... all round it made my previous character code look like junk.

So it seemed it was time to start over.

But before returning to TOTDD I also took some time to develop a multiple choice dialog system, for handling NPC conversations. It includes an editor which allows me to build conversations using a nice object based interface.

There's also support there for semi-random and procedurally generated dialogs...

Back on the project I started by taking some old code and updating it. I was surprised to find a huge error in my A-star pah-finding code, namely that I had left out the "f" value completely because of a typo. I was using only "h" to plot the best course. Sometimes taking a break from a project allows you to go back and fix things you didn't even know were broken. In this case the algorithm was still finding a route, but it certainly wasn't the fastest one. My path smoothing code was covering that up however, so I didn't notice.

I did some work on blocking objects too, reducing the drain previously caused by checking for a blocked route from every node to its neighbor. I found a quick way to check for blocking by only comparing each node to a bounding box of the blocking object.

As well as all that I started using objects (classes) to represent the walk mesh nodes and neighbor links, this allowed me to write an update() function which quickly resets all the g and f values in the graph each time the graph is reused.

The resulting code is much cleaner, faster, and calculates a better path.

The remaining side project is sadly likely to further reduce the time spent on this project, little Henry, my second son was born just three weeks ago.

Right now things are crazy busy at home and I get maybe an hour a night for coding and other things after everyone has gone to bed. That doesn't mean I'm going to stop working on the project, without some kind of creative outlet I'm sure I'd go crazy! But family comes first so expect slower but more focused development of the project for the future.


Popular posts from this blog

Back to Vinland.

I'm going back to my real time tactics project, Vinland 1936.
While working on the other project I overcame the problems which were stopping me from saving/loading the game and also cleaned up the base code a lot.

After a few weeks I'm getting near the the state I was in before.

Infantry are back to their previous state, and vehicles are running OK.
This time I'm going to push ahead with mocking up the combat system though before I work any more on the vehicle builder or graphical aspects of the game.

Map screen designs

I've been working some more on the map window. Right now you can only see the base, it doesn't show items, enemies or even doors on the map yet. These would be decals.

In the top window you can see the modified result of last night's tile based map. It looks good but there are some visual artifacts related to the problems I encountered yesterday, and as well it takes much more code and time to calculate.

The second window uses a cheap trick to fake an beveled look from a smoothed version of the 32x32 map. It uses black to mask unexplored areas.

Finally the third version is meant to look like a had drawn map. I'm using a cross hatching texture to distort it and unexplored areas are shown as blank map paper.

There's going to be a mechanic in game where you need to use some paper every level in order to activate the map for that level. From there it will fill it in automatically. Paper will be pretty rare so it might be worth keeping it safe for the more complex level…

Infantry combat and entering buildings.

I've been working a lot on the game recently and I've nearly rebuilt it to the level it was before. Past that maybe, since now I have the beginning of a working combat system and the ability to save and load the game.

Infantry can now occupy a building. It's quite an abstract representation, since they stay at the door and turn invisible. But they can then fire from one of the windows and take damage from shots at the windows too. I think I've set it up well so that when building damage and destruction is working then the system should continue to work.

For combat I tried some new ideas, but they didn't work out that well. It seems that it's important that viewing range should be further than shooting range. Now shooting range is pegged at 18 units of distance, while viewing range can extend out past that.

In the above image one unit has an officer, so has further viewing range. The other can only see as far as they can shoot, a dangerous situation since the en…