Thursday, January 23, 2014

75% through the deadline, 75-ish % done

One week to go and I'm roughly on schedule. I spent the night putting some cheap art in(cheap as in price, no offense to the artist)

None of it is exactly what I want but it always amazes me how big a difference even decent placeholder art makes.

From a code standpoint I corrected the healthbars that follow the actors around. Now they're green if the actor is on your team and red otherwise. A very simple feedback mechanism but it was a soup without it. You couldn't quite tell what to click on.

I also got the player death and respawn part in.

Must DO

Next up is the Bot respawn and then a lot of GUI work.

I need a health and mana bar on the HUD for the player.
I need an opening screen.
I need a victory or defeat screen.
I need sound effects and music.

I can call it a game after that.

Nice to Haves

The nice to haves list is crazy but there are a few I may be able to get.

The major one is a couple of skills to cast so the mana bar is for more than show.

I'd love some type of experience concept so I can start the player out weaker and then give him more punch and health as he levels.

I'd like to give the player and bots some effects that follow them around, they're hard to pick out from the creeps right now.

I'd like to incorporate an attack attack on the player so you don't have to pick out individual creeps each time. This is a creature comfort on DOTA2 and I miss it when playing my game.

I plan on buying an effect library and juicing up the special effects because they're really rough.

Lots more to be honest.

I've been really tempted to spend a second month on this game and the format for the 1 game a month challenge allows it but this will only be my second game I've finished in Unity...

In order to give myself permission to do that I feel like I need to do a different game in February, and then if I still feel like coming back to this one in March I can do it with a clear conscious and a good sense of purpose.

Having to trick and negotiate with yourself to be prolific is a beating but is a beating worth taking for the end result.

Thursday, January 16, 2014

Enemy AI

I've wrestled with how I'm going to implement the AI for the bot players for several days. I've studied Behavior Trees, Goal Oriented Action Planners, Simple Hierarchical Finite State Machines, and Hierarchical Task Networks.

I've varied from one to the next, always circling around Behavior Trees as my most likely implementation. Then something interesting happened. I remembered what my actual goal was. I have to finish an ambitious game design inside of 30 days and I'm more than halfway through my deadline.

I pulled out the razor and cut my ambition in half and the scope of my game AI into thirds. This game doesn't have to be a world beater, it has to be finished in 13 days. Having made my decision,(I'm going with old fashioned Finite State Machines, they don't scale for crap and the implementation is almost guaranteed to be sloppy, but I understand them and can code them up quickly.) I'm breathing a sigh of relief.

I thought about all of the half finished projects on my hard drive and all of the excitement of exploring new concepts and new technologies. The truth is I can explore those parts of programming at will. Goal-less, ill-formed dalliances into whatever catches my eye will always be available to me.

Right now I need to practice finishing. And finishing means not rolling the dice on a technology I'd have to learn from scratch. I've already integrated a new GUI library into this project and it set me back several days. I've overcome that with a lot of hard work and focus but I'm not sure the project can stand another adventure.

With that settled I started rolling the Bot AI this evening. My other work on the creep and tower AI served me well and I knocked out over half of the basic implementation in just a few hours. I'm going to make a bold prediction and state that the Bots in this game are not going to be exceptionally smart.

The first pass, which I'm only halfway through will allow the bots to hunt whatever is nearest them and go back to base to heal when they get below some health threshold. Additionally I'm going to give them access to the node network I built for the creeps and they'll use that to switch lanes if I get that far.

Otherwise they'll just be super tough creeps with some extra will to live and an extra trick up their sleeve. A bit boring, but ultimately achievable.

I still have to implement so many things. Major systems untouched include the entire game state manager, an introduction GUI to start the game, a respawn ability for the players and the bots, sound effects, music, and a victory/defeat screen for the end of the game.

That doesn't even include skinning the game if I get time, animation, a lot of feedback systems that are important to understand the nuances of the game, and the player controller is still the hacky version I rolled initially just to test the game.

Good times. 13 days remaining and I'll need all 13 to hit the mark but I'm enjoying the hell out of this experience. I think back to my last serious game attempt before I started the 1 Game a Month Challenge and the time I spent on it. It was a rather simple space shooter with randomly spawning enemies and a simple level manager. Depending on whether I roll another month with this game after hitting the challenge I may go back and re-make that game. What took me 80 days last time to make a game that's maybe 80% complete would probably take me 20 or 25 days now. It would be a good test of how far I've developed in the last 45 days.


More later...

Tuesday, January 14, 2014

Prequel to the halfway point

It's a bit too late to make a video and post it but I have made a good deal of progress this evening. Creeps are working for the most part as are towers. When the game plays itself with no interference from me they fight back and forth and given enough time one will destroy the others base.

Barracks spawn creeps at a steady rate and they do their thing. Still a long ling way to go but I started the day truly concerned if I'd be able to accomplish what you could technically call a game by the deadline.

I still have to create the player death and respawn functionality as well as create an enemy AI for the anti-hero bots. That said, I'm not quite halfway through the deadline and it's starting to feel like an actual game.


More later.

Wednesday, January 8, 2014

More progress, but it's very slow

This entire week has been hitting one unknown after the other. The GUI framework I'm using gave me some issues but the problem was my lack of experience with it.

I've implemented very basic healthbars for the tower and the player. I'm not very fond of the look but they are functional, and with the series of roadblocks I've hit recently I'll settle for functional right now.

I need to go through and clean up the code I'm using to move the bars around over the actor's heads. I'm also not happy with the camera angle still. I think I need a more "ground to horizon angle than I'm getting.

Lot's left to do and tomorrow night is already planned so no coding. That means I'm 1/3rd way through my time limit but definitely not 1/3rd of the way through the work that needs to be done.

I'm going to keep it at and hope I hit a spot where I blow through the workload and exceed my current output. Friday and Sunday are going to have to be good.

Tuesday, January 7, 2014

A new technique

Having solved the tower issue last night tonight I had a little over an hour to start on the same issue except this time with barracks. The tower solution didn't scale well because of all the edge cases.

Basically the size of the target determined how well my solution worked. A tower approached from any side is equidistant from the center which is where all of my aiming was going. Once I tackled a barrack the issue became obvious, from a flat side the creeps and the player attack from one distance, from a corner side they attack from another distance. The center of a rectangle varies in distance from various points on the perimeter.

To solve this I'm not aiming and moving to the nearest bound of the collider attached to the target. This has the added benefit of stopping the creeps at the proper distance from the target consistently. This may also solve the issue I was having with baking the navmesh and then raycasting to holes in the navmesh.

I'll have to test the solution more thoroughly tomorrow. But calling it a night it looks promising. I feel like I'm behind scehdule. Its one week in and I'm still working on the controllers and basic AI. These components have to be right but there's so much more to do and not so much time to do it.

Next step needs to be life, death, and combat in between. Afterwards its creep spawning, and base destroying. Big topics, lots of work in between. Time for bed.

Monday, January 6, 2014

Day 7 - Navmesh Hell

I burned most of the day working out a few subtleties in Unity's navmesh system. I'm not 100% happy with the way I put it together but its largely functional.

The navmesh system builds simple geometry and you use this geometry to navigate around your map. The problem I ran into is my towers are static, meaning they never move so Unity was cutting out holes in the navmesh for them. This is intended behaviour. Later, when I tried right clicking to attack them I would have to move my player within range of the tower to use his auto-attack. This is where the problems began.

The intended behaviour is that Unity provides a position that is the nearest edge to where you clicked. However, this turned out to vary wildly per click and made closing to weapon or spell range sporadic and sometimes just plain buggy.

The fix I used was to include a navmesh obstacle onto the tower and to re-bake the navmesh without the tower. This allows the right click to always land on the navmesh and for the player controller to accurately close distance so you are in spell or weapon range.

The downside is you can walk right through the tower as if it isn't there.(per the navmesh system it isn't), the navmesh obstacle makes your character controller avoid it, so you could technically still walk through it, or be pushed through it by another agent, however in light testing it appears to be holding up as intended.

That worked through, I've implemented a very basic combat system. Right clicking an actor that is not on your team causes you to close to auto attack range and start auto attacking. I've equipped the player with a fireball spell that autocasts every 2 seconds as long as he's in range.

Attacks do damage and the tower will quit firing when it's "dead". The player has health, but is still immortal at the moment.

I've also begun the basics of the creep AI. Right now if he's on your team he'll attack enemy towers or move to a waypoint I've set up. If I switch him to the opposing team he'll chase the player around until you leave his range of vision.

All in all it's been a decent couple of development days. The navmesh issue burnt a lot of time but appears to be mostly conquered at this point.

I've also implemented a very basic GUI using DaikonForge. The design time tools are great but I found out after purchasing it that it doesn't handle world space GUIs at all. This means I'll have to roll my own healthbars and damage numbers.

Time for the obligatory video:



this shows a creep chasing me around and then attacking a tower, it also shows the tower attacking the creep and me attacking the creep. Nothing fancy yet, still a lot of plumbing work to do.


Sunday, January 5, 2014

Day 5 - Lots of tuning

The last two days i've been implementing very basic combat, and tuning the click to move concept. I've also implemented a very rough version of stats. You can attack a tower and kill it, and visa-versa.

Tomorrow I need to push a lot of the code in the player object down to the player controller object. The abstraction isn't very well defined but it appears to fit in better there.

Currently the player can attack from anywhere on the map because I have implemented a concept of attack range but I've stubbed in some basic functionality to accomplish that. I'll tackle that tomorrow after work.

I need to implement the functionality where if you click on a target that is out of range you will move into range and then begin to fire at it. That's where the leaky abstraction part comes in, it's part player class and part character controller. I'm going with the controller abstraction.

No new videos to show as it's pretty much the same as last except the tower now fires at you.


I'll post a new video tomorrow after I've gotten the movement sorted out.