Monday, May 19, 2014

Real life changes

Since I last posted a lot has happened. I had to quit my job at the Mercedes dealership and as a result I started my own small dealership. I have a lot riding on the outcome so the change of schedule and responsibilities caused me to stop development of the puzzle game.

A few months have gone by and while I have much to do at my dealership, I've also started to get some semblance of schedule back in my life, so I'm carving out some development time again.

This round of effort will probably not be on a game, but on a piece of technology I find interesting.

If you haven't read http://procworld.blogspot.com/ and you have any interest in procedural world generation you should leave this blog and immediately go read his entire site.

Moving on... while his procedural work interests me the more interesting thing to me is his method of triangulation.

He's generating landscape and now 3d models with voxel density fields and then triangulating them via the dual contouring method, although at this point his implementation has to be considered some type of hybrid version of it.

At some point he links to this paper. www.frankpetterson.com/publications/dualcontour/dualcontour.pdf which is the original white paper describing the technique. And after some study I also found this paper: www.cs.rice.edu/~jwarren/papers/techreport02408.pdf which address some of the issues you'll find with the original whitepaper.

After seeing the amazing things Miguel is doing "from his pajamas" I fire up the trusty compiler and start digging into the white papers...

Ugg, brick wall. The concept is somewhat complex, just wrapping your head around the difference between primal and dual methods. What does that really mean exactly?

Then the methods of determining vertex placement, quadratic error methods, f(x,y,z), gradients for normal calculation. Brain-asplode.

This next series of posts will be me deconstructing my efforts to understand the concept and master the math required to implement my own version. I believe I will actually be using a dual marching cubes method instead of dual contouring but I plan on implementing them both to be sure of which I prefer.


Sunday, February 2, 2014

Puzzle RPG

Today is an official slacker day, plus I have a Superbowl party to go to so I'm only spending a couple of hours today to start the overall design of my February project.

The concept is similar to Puzzle Quest but instead of a match 3 game I'm going to try a game where you match the corners of boxes, where each box has up to 4 different corner types.

The reason I'm going to try a different mechanic is that the market is flooded with match 3 type games and I'm looking for something with similar properties but a bit less mindless. I understand the value of a mindless distraction but I'm hoping my solution will raise the bar a tiny notch but still qualify as a very low cognitive load while playing.

While the idea is to have a large game with multiple characters, online play, character persistence and in game purchases this months effort is focused on the actual match game. I'm simply trying to get blocks to populate a field of play, and an algorithm to match the corners and tally the "score" which will consist of how many of each type of symbols did you match.

Later, symbols will be spent to trigger abilities that effect either the board, a specific block, the player, or the player's enemy.

Each symbol will correlate with a role and each characters will have a distribution of what role he or she plays.

The roles and symbols are:


Role  -  Symbol

Tank          - Shield
Controller  - Star
Nuker        - Sword
Healer       -  Cross


Classes

There are different classes and they basically denote how much health per level the character will have and what type of roles they fill.

Some example classes:

Guardian - high natural health, always has 2 tank abilities and 1 control ability.

Mage - low natural health, always has two nuke abilities and 1 control ability.

Assassin - medium natural health, always has three nuke abilities

An example character would be:

Name: Zenos
Class: Guardian
Health: 100 per level

Abilities:

Parry(shield ability)
Use Cost: 5 shield
Effect: The guardian deflects incoming damage aimed at any party member, damage deflected is 10% of the guardian's current health.

Unbeatable(shield ability)
Use Cost: 10 shield
Effect: increases the guardian's maximum health by 10%, stacks up to 3 times.

Taunt:(star ability)
Use Cost: 5 star
Effect: the next enemy attack targets the tank no matter who is targeted.

Shield Wall(passive ability)
Use Cost: none
Effect: Reduces the damage dealt to party members by 15% as long as the guardian lives

Unstoppable(passive ability)
Use Cost: 0
Effect: the Guardian is immune to stuns


As a character levels he gains access to more ability slots.
The above character would start with one slot(probably parry).
Abilities drop from completing events or a player can purchase a number of ability rolls.
Max level is determined by the number of abilities a character has. So you need to farm abilities to level your character up.


Ok, back to reality:

The playing field is an N x N array of cubes. Each cube has 4 corners with a symbol on each corner. You score symbols by matching them with an adjacent corner of another cube. If each corner of the cube is matched at least once then the cube explodes and awards double symbols.

If one corner has 4 matching cubes then all 4 cubes from that corner explode, awarding double points for each symbol.

The corner matching and moving and populating part is what I'm going to tackle for February. I'll have to build it to a "save point" per the concept outlined by the 1 Game A Month Challenge, and perhaps spend additional months on it if I'm enjoying the game.

Friday, January 31, 2014

S.O.B.A. 1.0

Sweet success! With roughly 0 days to go I've wrapped up the 1.0 version of S.O.B.A. It used to stand for:

Single-Player
Offline
Battle
Arena

but I should change the name to Son Of a Bitch Arena.

Definitely an ambitious goal set, but in this case, goal set, goal met. It's a big step up from my last month project. The code is a bit cleaner, the scope of the game is quite a bit larger, the production value is a bit better, even though it could stand a month of just polish and be better for it.

Enough chat, here is a 10 minute playthrough.



I'm going to enjoy a couple of well earned days of slacking and then it's on to the February challenge. For February I'm going to do a puzzle-quest style game, hopefully with some RPG elements. I'm not going to push myself as hard as I did on this one. I want to be more disciplined with the scope and try and get a more polished game out.

Monday, January 27, 2014

5 Days Remaining - 6 Days of work left

The ambition of this project given the deadline is wearing me thin. I spent another 12 hours yesterday and still have a long way to go.

This is going to come down to the wire.

I'm getting close to being feature complete. The remaining features I have read like this:

Sound and Music
Finish Game State Manager
Add a Third AI State, some type of defense to mitigate the kamikaze-style AI I have now.
Implement the ability to replay a match.

The bug list, however, is growing:

Bots respawn when they shoouldn't or respawn multiple times.
Player respawns when he shouldn't or respawn multiple times.
Bots don't always face their target and sometimes get stuck looking at a dead target.
Bot's and Creeps sometimes get stuck running but never attack their target.

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.

Wednesday, January 1, 2014

Night One in the Books

I roughed out the camera control and the player "click to move" in one evening. I'm sure I'll have to touch it again but I was only aiming to finish the camera. Off to a good start.


January 1 Game a Month Challenge

January 1st 2014, a new year, a new month, a new game. This month's entry is much more ambitious than last months. The working name for this game is SOBA. Single-Player Offline Battle Arena. A fun riff off of DoTA2 and LoL style MOBAs.

The bare bones is what I'm going for so I'll use simple primitives and base materials for the game "art". I'm trying to tackle a bunch of functionality so I'm going to focus on code and placeholders, maybe even through the end of the month.

 The 1 game a month challenge now allows you to revisit previous entries and expand on them. The key concept being "save-points" that is, the game must be finished at the end of the month and be an actual game. This is to avert tackling ambitious projects that go nowhere. At the end of the month you may only have an unattractive, mediocre game, but you WILL have a game.

For a project this ambitious I'm going to have to rely on lots of coding and functionality to complete the entire feature set. I'll worry about the art pass if I have time, and if not I'll hit my goal of a complete game that lacks polish, and swing for a 2.0 version in February.

Lots to do so wish me luck. I'll post videos and web builds throughout development to show the various iterations as the game goes from an empty project file to a completed game.