Day 4
- Actors sink into ground when dead
- Auto generation of waypoint paths / building plots
- Refactoring
- Failed trial with ragdoll
Day 5
- Run animation working
- Watching tutorial videos for user interface
- Selection of spots for building
- UI for selecting which towers to build
- Build on mouse click (with fail when full already)
It's felt like progress has slowed down, however this is partly an illusion because it is easier to see progress when graphical things change and not when behind the scenes things change. However I did have several problems with basic C# stuff (probably because I haven't really got the time or inclination to learn the language).
C#
I have to say I don't know whether it's my lack of knowledge but I've found C# very painful to use so far. I used it once before for a little GUI app, but here in unity it seems more like a scripting language, okay for basics but none of the unity tutorials have stuff like creating your own types (there was no in built integer vectors in the version I am using!!) and the seeming need for references everywhere is a big WTF (it is possible I should be using struct rather than class?). I shudder to think what is going on below the surface. I may even end up investigating javascript support as I don't remember that being as painful to work with. This was coupled with monodevelop not saving my files properly, I had to alter the key bindings to save all with Ctrl-S to make sure all my files were being updated.
Ideally I'd like one of these rapid engines that was programmatical rather than GUI based. Drag and drop is great for non-programmers, but I'm just finding it painful, watching 5 seconds of a tutorial video, alt tabbing to unity, finding the exact spot the guy clicked, back to the video etc etc. And works with C++. I did briefly try unreal a year or so ago but it was so bloated it hardly ran on my old machine.
Incidentally I'm finding the videos by Brackeys very useful on youtube, even if some of the stuff like lack of enums makes me groan, I know it is aimed at beginners. He goes through topics rapidly so it's less boring and time wasting...
https://www.youtube.com/watch?v=IlKaB1etrik
Pathfinding
Anyway .. back to the game. The most interesting bit has been deciding how to make paths for the enemies and plots of land for building on. There's probably a great algorithm for this, but most of the tutorials had manual map creation, so I just had a quick stab at it. At the moment I create a bunch of rectangular 'blocks' or plots of land on which to build buildings, that is not allowed to be walked on. Then I run the Floyd Warshall algorithm to find all the paths from every cell to every other (this is simple to implement). At the moment I just choose 2 far off points for the enemies to run between to create the waypoints. But with all the paths calculated the enemies could theoretically spawn anywhere.
I tried last night to get ragdoll working as it would be kind of cool to have the enemies thrown off their feet when they get hit. But I got loads of tearing with my model, something in the export it doesn't like so I may spend more time on this when I get everything else working. Getting skinned characters exported from blender in 'just the right' way seems to be a bit fiddly. Ragdoll would be kind of cool if I get to firing monkeys out of cannons with physics.
The structure of my game code still seems a tad messy with some duplication of similar classes, because I'm learning unity, I'll have to clear it up quite a bit if I release the source at the end.
Ragdoll feature would be pretty cool!