Monday, June 29, 2015

Expressing Personality Through Animations

The Party Animals team is going heavily into revised game mechanics right now, and we're hoping to have something to share on that front very soon.  In the meantime I wanted to show off some of the animations I've been working on in my free time.  These animations will show up on the world map as your characters go around and do actions.  They will be much smaller than they are right now (see previous post), but I work on them on a much larger scale to inject as much personality into the animations as I can, hoping that some of that will translate even when the animations are reduced.


For example, let's take a look at the candidate Crocopio Imperial.  Croccy is the scion of a political family and is absolutely loaded with cash.  He's so rich that even while moving along the map he's already throwing money around.  The gleeful abandon with which he throws around money is almost infectious.


And when it's time to start bribing, he gives you the whole sack of cash.


The Investigator, who is a staff member you can hire, is much more stoic. Even when he gets mad there's a minimum amount of motion. I worry that this won't read very well when it's reduced, but it's a risk I'll take, since I feel it is very central to the Investigator's character that he doesn't have any wasted movements.


Except when he's exaggeratedly sneaking around, of course.


Contrary to the Investigator, the Police looks like she once wanted to be a disco dancer, flailing he arms and blowing that whistle as she redirects traffic for your candidate's convoy.


She's equally as exuberant when she's able to conduct a campaign successfully on your behalf.

These are just a few of the candidates and staff that we're going to have in the game.  We have a bunch more in store for you, and I'm excited to start working on them already. It's a lot of work animating them all, but I hope it'll be worth it in the end.  Please let us know what you think!

Thanks for reading.  If you want to be up to date on the latest Political Party Animals news, please sign up for our mailing list!




Saturday, June 6, 2015

Explaining the GIF!


We usually try to keep our blogposts to a regularly scheduled once a month for the sake of consistency.  But this week I wanted to take a little time to explain the GIF that I shared with you guys last week when Marnel was talking about our AI.  So without further ado, here is the explanation:
  • There are 3 characters right now, Mousey, Croccy, and Police Staff.  Mousey and Croccy are the candidates on opposing side, and Police is one of the Staff that you can hire for your campaign (she's the only one we've finished so far)
  • The districts highlighted in red are Blockaded, which is the Police's special ability.  Your enemy cannot enter the district that is blockaded unless they pay the Police a bribe to get in (This only lasts one turn).
  • At some point you see what looks like an avatar of an owl creeping slowly closer to the avatar of Croccy.  That Owl is a Kapitan, and Croccy has just given it a gift to improve his Relationship with the Owl.  As we said before, in this game you not only manage your relationship with the citizens, but also with their leaders.
Hopefully that's enough to whet your appetites but still keep you intrigued about what else is going in in the game!


Thanks for reading. If you want to be up to date on the latest Political Party Animals news, please sign up for our mailing list.


Saturday, May 30, 2015

One AI is Easy, but FOUR?!?!?

The following is a blog by our programmer Marnel, talking about AI in a strategy game.

Our AI in action

I have implemented my own FSM and Behavior Tree systems for AI in games. I know how to properly use them in most cases. They've worked really well. I honestly think I already have the working knowledge for the AI of the kind of games I'd like to make... until Party Animals came. I felt stupid and incapable.

FSMs and Behavior Trees are good for single agent AI. Single agent here means that the simulated behavior is only responsible for itself. It doesn't see other agents and try perform tasks together more effectively. For example, let's describe a single agent behavior of an enemy unit guarding a gate:

  • Unit stands still near the gate
  • If it sees a player unit within its range,
    • Chase and attack that player unit
    • If player unit dies or goes out of range, go back to gate

Now let's say we assign two enemy units on that gate with this behavior. It will still work but probably not the best strategy to defend the gate. Both of them will chase the target as soon as it sees one. They could have decided that one of them chases the player's unit while the other one remains on guard. This is no longer single agent. Multiple agent behavior is another beast with its own set of complexities.

In Party Animals, a player controls 4 units. They are called "Staff". One is the candidate character himself and the other 3 could be any combination of Police, Accountant, Investigator, PR Manager, or Goon (we'll add more). Each staff has a common and unique sets of abilities. The game is turn based. Each Staff can execute one action and can also move to an adjacent district once in every turn. The player may choose to move then execute an action or execute first then move to another district for each staff. Aside from this, the player also has to assign budget for each action. The budget allocated affects the effect of the action.

Here's the college project: implement an AI opponent that controls 4 Staff units that should pose a challenge to the player. It may not play the best moves, but should at least be smart enough to pick and order its actions sensibly. Sounds easy? (If yes, email me your solution please.)

I think the main difference between single agent AI systems and multiple agent AI ones is the concept of planning. There's no planning in FSMs or Behavior Trees. You can simply pick which branch to choose based on some conditions and let the agent perform the behavior described in that branch. You can't simply pick a branch of behavior for a multiple agent AI. There are questions to be answered before letting agents do their tasks:

  • Are the agents assigned the best task for them in the current situation?
  • Is the order of execution of agents' tasks give the highest benefit?
  • Are the selected actions sensible enough in the player's perspective? Is the AI playing the game right?

Single agent systems just can't answer these questions. I had to look for other ways.

Solution 1: Genetic Algorithm

I love brute force solutions. A genetic algorithm could certainly be used for Party Animals. Since the game is turn based, there's no pressure for the AI to run as fast as possible. I don't need the best answer either. I was thinking that I could run 1000 generations for each turn and select the best gene as the set of actions that the AI would take in that turn. In the end, I decided against it because I'm not so sure how long 1000 generations would take. I mean sure the game is turn based but we don't want the player to wait too long for the AI to execute. The chromosome encoding/decoding itself would take too much time to implement as there are lots of possible actions. The fitness scoring would be quite complicated, too. There are lots of variables to consider.

Solution 2: SHOP Planning System

Here's the link to the paper of the algorithm. It looks simple but I'm not quite sure how to implement it. I don't even know if it's a multi agent solution. It's more like a distant cousin of GOAP.

Solution 3: Resource Assignment Algorithm


Sample code

I found this one in Gamasutra. I liked this one because it's really easy to understand and convert to code. It's very straightforward. I implemented it as soon as I understood it. The current AI actually uses this solution. The algorithm is somewhat brute force but wouldn't take as much time as in Genetic Algorithm. These are the major steps:

  1. Generate all possible tasks
  2. Generate all possible assignments (all possible agent-task pair)
  3. Assign a score to each possible assignment (this is based on game rules)
  4. Sort possible assignments by score in descending order
  5. Assign tasks to agents from the sorted possible assignments until all agents has a task

The hardest part of this solution is step 3. There's no one rule how to compute the score for each task. It highly depends on the rules and the current conditions of the agents of the AI. In a way, you're like turning the quality of a task that is to be assigned to an agent into a number. This value should at least be comparable for all types of tasks since they are all treated the same way when sorted in step 4. Coming up with these computations is not easy. I think I need to study a special math for this.

For instance, the Campaign task has various factors like population, the platform value of the candidate, the concern value of the target district, and the distance of Staff that will carry out the task. Another task called Gift has another set of factors. These are population, inverse of platform value of the candidate (meaning the lower the value, the more likely the task should be done), and distance. Campaign has 4 factors while Gift only has 3. How do I come up with a formula or system of scoring such that it gives reasonable values among these two tasks? There's also the case of precedence. Campaign should be a more important task than Gift but because it has more factors, it could happen that it has a much lower score. The scoring system should be able to compensate for this.

Solution 4: Dynamic Task Allocation

This is a lengthy Master's Thesis material. I did not understand it the first time I read it. I learned to appreciate it when I ran it through again. It's actually very clever. The algorithm was inspired from swarm colonies like ants, bees, and ants. It turns out that colonies don't have a central command that assigns tasks, not even the queen. How does the colony know which tasks to prioritize then when certain circumstances arise?

The individuals of the colony emit pheromone stimuli. Larvae emit pheromone to signal their hunger, sentries emit pheromones to signal intruders, etc. Each caste in the colony has a set of thresholds associated to each stimulus. When a stimulus becomes greater than an individual threshold, that individual will answer to that stimulus with great probability. Answering to that stimulus will in turn lower the stimulus. For example, worker ants would have a low threshold for a task say "gather food" but has a high one for "defend colony" task. This way, worker ants will respond to hunger stimuli more than to intruder alert stimuli. You can probably imagine by now what a soldier ant's threshold values looks like.

I would have used this algorithm had I understood it earlier. I was almost finished with the implementation of Resource Assignment Algorithm. I could not afford to tear it down and start again. We need a working AI soon. Either way, I could still add this algorithm in another AI profile in the future, if there's still time.

Thanks for reading.  If you actually do have a suggestion for Marnel regarding AI please comment here or email him.   If you want to be up to date on the latest Political Party Animals news, please sign up for our mailing list.

Thursday, April 30, 2015

The Difficulties of Transitioning from Artist to Producer Without Becoming a Giant Asshole

In October 2013 Julius and I hatched the idea to make a jokey political game called Party Animals for a 1 week gamejolt gamejam.  Our original plan was to keep working on the game, finish it in 6 months, and ship it out as our first indie collaboration.  A year and 6 months later we've added two team members and our estimated release date of 4th quarter 2015 looms closer and closer everyday.  It's only been 4 months since we've had our full team of four, and so while I was willing to chalk up the preceding year to experience, I knew I didn't want to repeat some of the same mistakes we made before.  We needed to be more organized, which meant adding "producer" as well as artist to my collection of hats.

Can You Be a Good Producer Without Being an Asshole?


This is a question I've struggled with in the few times I've taken on the roll of being the leader (not that the producer is the leader in general, but in this case some of their roles overlap).  Does a good leader necessarily have to fit the Steve Jobs archetype of brilliant asshole? the accepted wisdom that authoritarian leadership in tech companies is what wins the day is hard to avoid.  Dilbert and Office Space successfully satirized of managers who are inflicted with the Dunning-Kruger Effect (tl:dr The less you know the more confident you are about what you know).  They were so successful in fact, that my innate tendency to shy away from being "that guy" may have slowed down development of the game.

For better or for worse, I've always approached group projects with a democratic, almost communistic outlook.  Everyone would do according to their capabilities and in the end we would have a finished product we could be proud of.  That may have been possible as two people, but by necessity our team grew to four, and each addition made it increasingly hard to be laissez faire about the organization of the group.  It's not that any of us was irresponsible, it's just that each of us seemed to have different ideas about what we could best do in order to make the game happen, and those ideas often did not mesh very well.

So the question for me was, how do I get us to stay on track without pissing people off and cutting into the precious time they need to actually work on the game?  Here's some of the tools I'm currently using to keep on top of the project's needs.

Communications


Hipchat is our main communications tool.  It's a private IM service that lets us chat without the distractions of Facebook and other IM services.  It also integrates well with other services like github and Trello, so that we're instantly updated when someone pushes some new features to the build.  Slack was an alternative that we looked at, but for whatever reason Hipchat works better with Marnielle's shitty internet situation, and so we chose that.  A lot of communication issues crop up because of bad internet, and so I've learned to be flexible when communicating with the team.  I used to feel bad about messaging them about something more than once, but I've learned it's ok to use Facebook, email, or even SMS to contact them if a matter seems urgent enough.

Julius is working in New Zealand now, so whereas we used to be able to do meetings every 2 weeks, working out how to meet and chat with each other now presents an additional degree of difficulty.  For one on one chats Julius and I used Vibe (no particular reason, we just both had it).  Viber doesn't allow for group chat though, so for that we use Google hangouts.  We've used Skype to do a group chat before but it wasn't working out for us the last time we tried a group chat but Hangouts did, so we'll be sticking with that for now.  I should mention that Hipchat also allows for voice chat, but it's a paid option, and we're trying to save as much money as possible so being cheap trumps efficiency for now.

To-Do List + Project Planning


We use Trello for our task list and Tom's Planner for, well, planning.  We used Trello exclusively for a long time because I had this aversion to Gannt Charts, but Tom's Planner (hereafter known as TP) makes it super easy, and having a schedule laid out for me is visually much more intuitive than looking at a laundry list of tasks that need to be done.  Of course there is always a risk of being too anal about the schedule, but I think we're managing to be flexible about it and use the chart as a guide and adjust plans according to the current situation.  I did some research on alternatives to TP, but it's definitely the best value for money for anyone who wants a dead simple Gannt Chart app.  There are Excel template the simulate Gannt Charts but they're unwieldy, especially if you're untrained in the fine art of Excel.  TP's free version only allows one person to manage a project, but you can share it easily.  For $9 a month one project planner can handle the project but allow multiple free users access to edit the project but I don't think we need that for now.

Our use of Trello has waxed and waned at different points in development.  It becomes more useful the closer we are to a deadline and more immediate listable items we have, but it's less useful when, for example, we are working on a longer term feature like creating the game AI.  There's a bit of overlap between Tom's Planner and Trello, and I find I'm referring to Tom's more often than not.  Whether that continues remains to be seen.

Game Design Documentation


Our documentation situation was a mess until very recently.  We started out using Google Drive, shifted to Office because Tristan was more used to Excel (where he simulated the game's formulas), and along the way we accumulated a bunch of different documents with different information in them all across our different computers.  Since we already used Dropbox to share the art assets used for our prototype, my quick solution to our situation was to create a "Documentation" folder and dump all of the files there.  

While this made it easy to access the files it was still difficult to find specific bits of information, and oftentimes Marnielle or Julius would message on Hipchat asking 'Hey what's the formula for x mechanic?  I can't find it."  We had to figure out a way to unify all of the documentation into one concise package that was easily searchable.

Luckily Tristan had been playing around with a service called Tiddlywiki that allows you to create a customized wiki.  He'd actually done this for a previous version of the game, but we'd forgotten about it in the midst of working towards a playable build in March.  So far it's been the perfect way to store and search for information about the game, a rare case where we found the exact solution to a specific problem that we had.

Group Discussion

Hipchat is great for short bursts of free flowing conversation, but sometimes you need (well, at least I do) a more structured conversation to discuss a specific point.  Kind of like email, but with a group.  Google Groups is essentially exactly that, and it's what we use for longer conversations.  We used to have a private Facebook group but being on Facebook was bit too much of a distraction.  Google Groups isn't the ideal solution, and I find its interface super clunky, but it serves our purposes well enough.

Conclusion

These are the tools we're using right now to help us keep on track.  This doesn't take into account Sourcetree for managing repos as well as Dropbox for file sharing.  On first glance, it feels like a whole hell of a lot of different services, kind of overkill for a four man team.  But since laissez-faire didn't work then perhaps overdoing a little bit with these services isn't the worst thing, and if I find that it's too much we can very easily scale back some of this stuff when necessary.

Our experience is not the same as yours, and in fact the prevalence of small indie teams making games seemingly at will with little to no supervision is what made me think we could do the same.  Our circumstances are different and these are the kind of things we're hoping will address those issues.  If you find that your circumstances are similar, I hope this will be of use to you.

Thanks for reading.  If you want to be up to date on the latest Political Party Animals news, please sign up for our mailing list.

Saturday, March 28, 2015

Political Party Animals Campaigning in Washington DC!

As the title suggests I am in DC right now joining my wife on a work trip.  I figured I would take advantage of the proximity of DC to some pretty awesome indie developers to chat with them, show off Political Party Animals and get some feedback.

March Update


First off, we should talk about the stuff we've been working on since last month.  We were trying to prepare a build of the game that could show off as much as we could when meeting up with fellow devs.  Here's a short list of the things we were able to complete:
  1. Sortie : The candidates can now sortie, which is your main means of increasing your reputation 
  2. Bribe : Normally your sortie actions depend on the multiplier effect (which can be improved by doing the campaign action). Bribe overrides this by throwing money directly at citizens, but it is affected by your relationship with the Kapitans.
  3. Election Day : This is our end game, candidates can choose to either support or suppress voters in the districts, and we tally the votes to find out who won the elections.  This is an important step in making a playable prototype that we can get people to test out.
  4. District and Candidate info UI : You can now click on each district and on your candidate avatar in order to view district concerns and candidate platform strength.
  5. Finished animations for 2 candidates and one staff, the Police.
Considering we're all working on this on the side, we're quite happy about how far we've come, but there is so much more to do!

Campaigning in DC and Baltimore



My wife had a work trip to DC that provided free accommodations, and I've never been, so I figured I would spend some money and join her!  This trip isn't all fun and games though, since DC and Baltimore are a hotbed of of both indie and triple A game studios.  Miraculously, I managed to snag a meeting with folks as divers as Adam McClard of Origo Games, Soren Johnson of Mohawk Games, and Sam Bernstein of Bethesda Game Studios.  Highlights so far are Adam taking me to have some barbecue in Baltimore and Soren teaching me how to play Offworld Trading Company live on Twitch (I can only imagine how many players were groaning at how bad I was).  I learned a lot from Soren and Adam and I look forward to meeting the guys from Bethesda tonight.  More updates in a couple of weeks!

Thanks for reading.  If you want to be up to date on the latest Political Party Animals news, sign up for our mailing list.  

Friday, February 27, 2015

February Update : Marnielle Destroys Julius' Code and Apologizes

(This month Marnel takes us into his thought process on his first real month working on the game. He originally wrote this in his blog, then we, umm, "appropriated" it here.)

After implementing some of the basic features of the game, I could definitely say I’m now an official Party Animals programmer. There’s no turning back now. I’ve invested huge amounts of time, effort, and code already. Might as well make a blood oath that I’m going to code for this game until it is released.

Starting a code base is both challenging and exciting. I have to learn new stuff and unlearn some things that I used in my previous game. I have to reset my mindset that the project is still in its early stage. Lots of tools and systems are still missing. It’s unlike the code base of a built game where the systems are already in place and I have the thought process on how to change things. This time, I’m also not a lone programmer anymore. I have to take that into consideration.

In this post, I’ll show you what I’ve done so far.

Camera Settings and Resolution

I’d like my camera and 2D Toolkit settings to be consistent. I want the orthographic size of my cameras to be 1 because it feels more consistent rather then specifying some other number. It also helps with resolution independence. We’ve also decided to use 1366×768 as the base resolution. In short, I have to rip apart the current settings (sorry Julius). I’ve requested Ryan to resize the assets to make it suitable for the new resolution. 2D Toolkit sprite collections have to be regenerated. With this, fixing the positions and colliders of the districts was also inevitable.
Resized districts. Still used Julius’ clouds and wave simulator. They’re cool!

uFrame

Party Animals is a systems heavy game where game rules could change a lot. I’ve decided that I should incorporate some form of framework to it so we could at least have some structure to where code goes. Julius used StrangeIoC. Then I was able to buy uFrame because it was on sale. I found uFrame to be superior than Strange. So I had to rip apart the current code base (sorry again Julius).

I’ve got to say don’t buy this product if you’re not a programmer or even a newbie coder. It’s hardcore code framework rather than a utility extension like most other asset store products. I wonder how they sell this thing. Only programming nerds are excited by this.

I really like it, though. It forces me to adhere to MVVM and have some kind of structure and separation on where the appropriate code goes. It forces me to follow the rule that views should react to changes in models. Only controllers can mutate models. I had a really hard time understanding it at first. Data initialization is not that straightforward. I even asked dumb questions to their forums. One reply said “Ugh, awkward questions… but here’s what you do…” I’m starting to get used to it now. I’ve implemented the features so far using uFrame.
Models in uFrame are code generated. They are authored like this.

Staff Movement

The Staff and Districts are the main movers of the game. Obviously, these two had to be implemented first. The first action I’ve done is movement. Things have to be implemented a little different when using uFrame. If I had done it like I always do, I just move the staff avatar then change its current district. Not anymore. In uFrame, you have to go through a controller. I have a command called ChangeDistrict() which updates the current district in the model. The avatar (view) has been bound to the current district. It is notified whenever the current district changes. When it does, that’s the only time that I could move the avatar to the new district. See the difference there? The direction of execution is always Model changed then View reacts to it, not the other way around.

Staff Campaign and Unity UI

Party Animals is so UI heavy. I haven’t played with Unity UI yet because Warrior Defense’ UI was still using 2D Toolkit. I have no escape now. Julius is using it and highly recommends it. I hate to say that I do like it after trying it out. RectTransform is freaking awesome! I hope it won’t bite us later. I’m still not sure how to go about atlasing, hi-res assets replacement, and draw calls.

Campaign is one of the basic Staff actions. This action has a lot of parameters so I decided to use a uFrame model for it. I’m glad I did because I learned a lot of the uFrame flow when I implemented it. The major one is UI catch cases. There were lots of these. Since I have to implement in uFrame mindset, working around it is also very different. I always say “update model then UI, update model then UI…”
My first complex uFrame and Unity UI combo!
Generally, I’m happy with the base code right now. I’ve got two basic actions implemented. I now have prior knowledge on how to implement the next ones. Can’t wait to show you minimum playable version of the game!

Friday, January 30, 2015

January Update : Long Christmas Break And A New Team Member Joins Us!



Christmas celebrations have a tendency to spread into the New Year in the Philippines, and this year has been no exception.  It took us a while to get back into the swing of things, especially since I'm back to work on Prison Architect this month, and Julius has been battling with government bureaucracy so that he can finally leave and work in New Zealand.  It'll take him a while to get settled in so progress on the Unity build has been  slow, although we have managed to get a few paper prototype tests in.  Luckily, we've added a new member to our team who will definitely pick up the slack on Unity Development.

Marnel Estrada is another veteran Filipino game developer who has plenty of Unity experience under his belt.  Last year, he released a Tower Defense game called Warrior Defense after having worked on it for about a year.  Aside from being an excellent game, Warrior Defense has given Marnielle a wealth of hard earned experience about developing a game from start to finish on Unity, something that we will definitely benefit from.  If you're interested in trying Warrior Defense out there is a version on gamejolt and Android for you to check out.  Marnel aso blogs at Coffee Brain Games.


We also got a bit of a surprise at the start of the year when we found out that we were on RockPaperShotgun's Best PC games of 2015 list.  We're definitely quite honored, and while I suspect that this list came out more by virtue of a slow news cycle at the start of the year, we are feeling an immense amount of pressure to deliver the goods (Thanks to everyone who joined our mailing list after checking out our blog!)

So that's it for January!  Sorry there's not much to report, but aside from some tweaking of design mechanics nothing of real interest happened this month.  We'll have much more to report in February!

 

Party Animals Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger