Monday, November 30, 2015

The Machinations of Politics Part 2


In my last blog post I mentioned that we will be using Machinations in designing the game mechanics for Party Animals. Just to summarize, everything in the game, from the districts, staffs,  and events can be considered as a resource, and that the game facilitates the interaction of these resources with each other. I also described a basic node: Resource Pools, and two different types of connections: Resource connections and State connections. If you would like to learn this in detail check out the book Mechanics: Advanced Game Design by Ernest W. Adams  and Joris Dormans

In this post I will be going over the core game-play of Party Animals using Machinations while introducing new nodes: converters and end conditions. Also, this is not a step by step tutorial on how to use Machinations, because the authors already did an excellent job right here. What this post hopes to achieve is to show you how to think about game design using Machinations by using Party Animals as an example. 

   One thing important to know,  Machinations is not only a tool for modelling game mechanics, but also a framework for describing  game design on different levels( high to low level). I'll start by showing the game from a high level point of view, then  describe mechanics in detail in succeeding blog posts. 

The Whole is the Sum of its Parts


Party Animals is a 'territory acquisition' game at its core. The main objective of the player in the game is to get more reputation than his opponent before the election, and he does this through various means like campaigning, bribing, and participating in game events.  Look at the diagram below:



    
    

















     
More often than not, actions that give the player reputation also require that the player spend campaign resources. There are two important campaign resources in the game: gold and command points. I will not explain the specifics here but for the purpose of showing mechanics I reduced both resources into the resource Funds(see B in the diagram).  

Another thing of note is that the player can also spend funds on various actions like rallying(raise voter concern on district issues), and gifting patrons(improve patron relationship) which improves the efficiency of his campaign.  By efficiency I mean getting more reputation for the same(or less) amount of funds. 

Now let's take a look at the different elements shown in the diagram:

A.  Fund Production - The triangle with an asterisk(A) is a source node. The source node produces funds and the resource connection(arrow connecting  node A to node B) stores the funds into the players Fund pool(node B). 

B. Fund Pool - The circles in the diagram are called pools and they store resources, in this case funds.

C. 'Get Reputation' Converter - The sideways triangle is called a converter.  Converters take in resources as input and transform them into other resources. If you take a look at the diagram you can see that there are two resource connections leading to C , 1) [B to  C] , and 2) [D to C] . What this means is that in order to get Candidate Reputation(node E), the player needs to convert funds and District Reputation(node D). Without funds or available District Reputation then the player can't 'mine' reputation.

The converter converts District Reputation and Funds into Candidate Reputation


E. Candidate Reputation - Also a pool node, getting as much candidate reputation by converting district reputation and funds is the goal of the player in the game.

F,G. Campaign Investments - As stated above, the player can spend funds to improve the efficiency of his campaign so that he gets more reputation by expending less resources. Node F is a converter node which represents all actions in the game which can help the player gain reputation. 

As an example, a candidate can give gifts(spend gold) to a patron to get bonus reputation when campaigning in the patron's district.  

Nodes F and G represent actions in the game which improve the efficiency of the candidate's campaign


When the candidate 'invests in his campaign' by spending  funds, an investment resource is produced from node F and stored in node G. As shown in the diagram, node G is connected to resource connections [C to E] and [D to C] by state connections( dashes). This means that whenever an 'investment resource' is stored in node G, [C to E] and [D to C ]increases by 1 which in turn means that the player can mine an additional reputation resource.

H. End Game Condition - This node determines how the game ends. The state connection [D to H] shows that the game will end when District Concern( node D) is depleted (less than or equal to 0).  Note that this end condition is used only for the purpose of this article.


As stated at the beginning of the post, the diagram shows the game-play from a high level point of view, thus a lot of the game mechanics which will make the game more interesting are missing. But it does show the following:

1) The player has funds to spend.

2) The player spends funds to acquire reputation.

3) The player can invest in his campaign in order to maximize the use of his funds.
which is what the player will be doing throughout most of the game. Now it's only a matter of breaking  these three down or elaborating  on them to make the game more interesting.

Key Concepts to Understand


Some of the skills I think is important when designing games using Machinations are:

1) Abstraction

In the diagram, I've grouped together several game mechanics and reduced them to a single node. For example, the Campaign Investment node groups together mechanics in the game which the player can spend funds on to improve the amount of reputation he can 'mine'.  Learning how to 'see' similarities in mechanics and how they can be grouped will be useful when trying to model game mechanics in machinations.

2) Learn to think in terms of relationships

Game mechanics in machinations are represented by nodes,  resource and state connections. It's important to understand how mechanics in your games are related to each other. When designing games using machinations think about how the different mechanics in your game work together.

3) Learn to see and use abstract resources

In Mechanics: Advanced Game Design, the authors distinguished between concrete and abstract resources. Basically concrete resources are the ones you normally see in the game, and abstract resources are the ones that you don't but are there. Some example of abstract resources that I regularly use are strategic advantage and player skill. An example of advantage as a resource is information in a game with hidden information as a mechanic.  Certainly getting information that your opponents do not have increases your likelihood of winning the game.

In this article I've shown you how we use the machinations tool in modelling our game mechanics, as well as given a few tips which will help you learn the machinations tool. In the next blog post I'll be talking about abstracting and elaborating mechanics as well as show some of the Party Animals game mechanics I mentioned earlier.

Thanks for reading.  If you'd like to tell us about political candidates from your side of the word, you can email us at heypartyanimals@gmail.comTo be one of the first people to try our closed alpha, please sign up for our mailing list!


Wednesday, October 14, 2015

Meet the Candidates of Party Animals

Election fever is starting to hit our home country of the Philippines, so I thought the time was ripe for a quick devblog about the candidates of Party Animals.  Each candidate has a specific set of bonuses that will nudge players towards a specific play style and ties in to their personal history.  We only have three candidates for now, although we have more candidates down the line, and ideally we'll be able to let players customize the candidate of their choice.  With that said, let's meet the candidates!

Mousilita Ereñeta



Mousey is representative of everyone who is frustrated with the inefficiencies and bureaucracy.  She got a taste of this firsthand as a low level government bureaucrat who eventually got fed up with how the system works.  She believes in democratic system so she's decided that the best way to change things is to run for election!  Inspired by her grandfather that walked barepawed to public school and eventually served in government, Mousey's platform is based on Education and Healthcare for all.

For a very long time we pondered how to make Mousey, who is ostensibly the good or "clean" character, a viable candidate since the game was skewed towards players who engaged in "scandalous behaviour.  It was only later on when our game designer Tristan decided to add a Command Points system that we had a eureka moment.  Mousey's only possible advantage over her more well known and moneyed opponents would be to work harder and more efficiently than either of them.  Giving Mousey more Command Points would allow her to move staff farther away from her and allow her campaign team to have a wider impact than the other candidates, who would be forced to keep their  staff close by.  

Crocopio Imperial



Crocopio is the stand-in for the moneyed elite that populate local government.  As the son of elected officials, Croccy alsp stands for the political dynasties that are so prevalent in immature democracies. Filipinos may get a kick out of the fact that he's a crocodile, given that "Buwaya" (Filipino for crocodile) is a term commonly used to describe corrupt public officials.

Given his position of privilege, Croccy has access to vast sums of wealth and uses that liberally during the campaign.  He will get a bonus to funds that he can use to boost the effectivity of his rallies, bribes, and all sorts of other things.  Croccy's campaigns based on Law and Order because he's a huge fan of the TV show but also because he knows having the law on his side can only be a good thing.  He also supports Public Works because he likes to spend on lavish infrastructure projects that he truly believes will help the animals of Summer Island, and it doesn't hurt that he can put his name on them too!

Rooisito Espilorde



Young democracies are prone to popularity politics, and Ruey is representative of that.  Be they celebrities or sports animals, many animals have taken to politics in the twilight of their career to put their lifetime investment in the limelight to good use.  The well-meaning Luey promises to knock out crime and corruption in politics just as he did in the cockfighting arena, but there's very little substance to his campaign. 

Ruey is the last of the candidates that we've thought of (If I'm being honest, we only had the idea to make him a candidate last week) so his design is the weakest at this point.  His bonus will definitely have something to do with his popularity though, so either he gets a bonus when dealing with patrons, or maybe he starts off with some reputation throughout Summer Island.

Stereotypes, not Specifics


Party Animals, while loosely based on Philippine Politics, was always meant for an international audience, and so we're careful to make sure that these characters are stereotypes and not modeled after specific people.  While an international audience generally knows enough about US politics to want to play a game about it, the same does not hold true for the Philippines.  Stereotypes make it easier for anyone around the world and say "Oh hey, that's like (this person) from (my country)!" and we (desperately) hope that will make it attractive to game players around the world.  Lastly, while as individuals we will have to decide who we're voting for in the elections, we want to make the game about the experience of  a candidate on campaign and not about supporting any specific candidate.

Thanks for reading.  If you'd like to tell us about political candidates from your side of the word, you can email us at heypartyanimals@gmail.comTo be one of the first people to try our closed alpha, please sign up for our mailing list!

Sunday, September 20, 2015

Stories and Tradeoffs in Political Party Animals



This is Ka Eldereta.  He is a tribal chieftain that represents the interests of the indigenous people of Summer Island.  His name is a play on words, as “Kalderetang Kambing” is a traditional Filipino stew made with tomatoes, liver paste, carrots, potatoes, and most importantly, goat’s meat.  Filipinos have an almost embarrassing affinity for wordplay and puns, and it’s something that we wholeheartedly embrace.  For example, we have an excel spreadsheet of animal names for Owls that includes “Owlfredo” and “Owlberto”.  If that made you chuckle, then you’re probably going to like our game.

I was reminded of Ka Eldereta a few days ago because of recent news in the Philippines having to do with indigenous peoples.  I debated for a long time whether or not to write this blog because it felt a little gross to be linking the game to a tragedy, as if we were trying to market the game based on the sufferings of indigenous people.  My internal compromise was that I would not mention the specific incident in this blogpost.  A google search on indigenous people in the Philippines should already give you a wealth of information on the indignities they’ve had to endure under majority rule.

Still, I felt it was it was very timely to talk about it because it reminded me of one of the reasons we wanted to make this game in the first place.  We wanted to tell stories.  Political Party Animals is primarily the story of the player as politician, and the compromises they are forced to make on the campaign trail.  But it’s also the story of citizens engaging with the politician to further their own interests.

Stories from the Campaign Trail


Some of those stories are hilariously mundane.  For example, the aforementioned Owlberto has as idiot of a son named Owlfredo, who needs an internship with a political campaign.  If you take him on you will have one of your staff replaced with notoriously inept Owlfredo, who will bungle up your campaign (in-game translation, -50% to the result of every action he takes).  But the tradeoff is that Owlberto will be your BFF, and as a patron he’ll give you a substantial bonus to your campaigns in his district.


But other stories will highlight the classic struggle between a weak minority and powerful business interests (or when seen from the other side, a respectable business dealing with radical activists).  For example, we see here Ka Eldereta and other activists protesting against mining activities.  If you champion their cause you will gain their trust (and more importantly, their votes!) but you will displease one of the Patrons in the Mining district, who will now make it very hard for you to campaign in the district.  How will you proceed?

Tell us your stories


These are the stories and tradeoffs that make politics an interesting and often infuriating business.  Despite what people might think there often isn’t one right or wrong way to go about things, just a series of tradeoffs that must be weighed against each other.  For now, the events in Party Animals will be based around political stories in the Philippines, but as we move forward in the game we’ll be soliciting stories from people around the world and finding a way to integrate them in the game so we can hopefully tell stories from around the world.

Thanks for reading.  If you'd like to tell us a political campaign story from your side of the word, you can email us at heypartyanimals@gmail.comTo be one of the first people to try our closed alpha, please sign up for our mailing list!



Monday, August 31, 2015

The Animation Pipeline for Political Party Animals


As we inch ever slowly to a closed Alpha, we’re slowly building up our social media presence.  If you haven’t already, please do follow us and spread the word on Twitter and Tumblr.  We’ve had a pretty good run of bi-weekly testing and for the first time last week the latest version of the game was played by people from outside the team.  The results were encouraging, since both our friends Kyle and Gwen had fun playing (see Gwen's victorious pose), but there were definitely numerous things that we still have to work on.

In the meantime, let me show you my process for the creation and animation of our characters. Previously, I wrote about my decision to stick to frame by frame animation, mostly because it’s what I know best.  Now I’ll go into a little bit more detail in the hopes that you guys might pick up a thing or two from it, or tell me why what I’m doing is terribly wrong.  Let’s get started!

Part 1 : Concept Sketches


With each concept sketch I take an animal, assign its occupation, then make some sketches based on those two factors.  So for example the Crow is meant to be an investigator or reporter that digs up or fabricates dirt on other candidates. I'll usually spend around 10 hours or so first looking at reference material then sketching out concepts  and then coloring them in. If I had the time I would love to spend more time really doing a lot of concepts of each character but as it is I'm squeezing these in after work, which means an hour or two whenever I can find the time.

Part 2: Vectorizing


After the conceptualization is done I pick out my favorite concept animal (this is harder than it looks, and sometimes I have to ask my wife to help me choose) and render it in vector.  This is important in terms of efficiency because once the animal is in rendered this way it becomes much easier to resize it and use it for multiple purposes. It's also important for me to organize it properly in different layer folders.

So let's say for example that I wanted to make a character portrait for the Investigator.  I could just take the body and head part, resize it, and voila! A portrait for the Crow Investigator! It's important for small teams to always keep in mind different ways that they can make work more efficient, which is something I learned having usually worked as the sole artist for many games!

Part 3: Animate!



Now this is the meaty part, the animation!  We have a list of animations that each character has, for example we need animations for move, bribe, etc.  for this one I will show you the move animation for the Invesigator.  The first step is for me to sketch out a very small animation.  I sketch it small so that I don't overthink the details and just try to get a good sense of movement going.  I wanted him to be all sneaky like to fit his ability to fabricate scandals.

Once that's done I take the original vectorized image and then start making frames based on the smaller animation.  If I have time I will go ahead and sketch out larger frame by frame animations as well, but I usually make do with using the small animation as a reference.  This is where having separated the different body parts before is really key, as I can I much more easily pick out the body parts I want to animate and move them around rather than having to look through a whole mess of vector layers.


In about 2-4 hours I will have something like this!  I actually had quite a bit of trouble with this and had to refine the previous quick animation some more before I had an animation I was happy with.



This is an image showing the frame by frame animation within photoshop, so you have a better idea of how many frames I use.

Part 4 : Shrinkage


Once again this is where doing everything in vector pays off, as I can easily shrink the different frames of animations, flatten them, give them an outline an then save them one by one as pngs for use in the game.  We use 2dtoolkit for our animations, which I'm starting to realize may not be the best for a game with multiple animations.  The file organization for 2dtoolkit seems pretty primitive, and you can easily be overwhelmed with the sheer amount of individual images.  Right now we aleady use 213 sprites, and we're probably at 1/10 of the amount of animations we're planning to do.


And finally here is the Investigator in action in the game!  His special ability is to fabricate a scandal, which if it's revealed in the district will do massive damage to your opponents reputation.

Thanks for reading.  If you have any suggestions about how I can streamline my process without overhauling it entirely I would definitely love to hear from you!  To be one of the first people to try our closed alpha, please sign up for our mailing list!

Saturday, August 1, 2015

Patronage Politics and New Mechanics in Political Party Animals

Ryan's note: Hi all, I asked Marnielle to write this month's devlog, and he talks about the mechanics that we're slowly adding to the game.

The development of Party Animals has been hanging around for over a year already (or years) but the truth is that the game’s mechanics are not yet zoned in. We’re still looking for the fun part. We’re at the stage when we are adding new mechanics and testing them out as soon as we can then decide whether to keep them, change, or discard. If we’re not having fun with it, our target players most probably won’t. While we unanimously agree that what we have is fun enough, something is still missing. This post will be enumerating what we’ve done so far. As a bonus, if you stay a while, you’ll get a tip on how I start my coding momentum.

Command Points


Pay CP first before you can use your Staff

As context, Party Animals is a game about winning an election. The main mechanic unit of the game are the Staff which the player can move around in different districts and make them execute actions. The game is basically an attrition with an opponent through Staff actions.

We introduced the concept of Command Points (CP) to control the movement of Staff such that players are forced to strategize on which district to move next as usage of such units now have cost. CP cost is simply defined as the shortest district distance of a Staff from its Candidate (a Candidate is just another Staff with special abilities). If a Staff is in the same district as its Candidate, then CP cost for the Staff is zero. CP resource is assigned to each candidate at the start of the turn. It is increased when certain campaigning days are reached. In real life, we’d like to think of this as the cost of planning with your Staff that is in another city or province.

During playtesting, Command Points had a direct effect on Staff movement. During early game, players only move their Staff along one adjacent district distance from their Candidate.

Tristan's note: The implementation of command points is inspired by war games, one of which is Onslaught : D-Day to the Rhine by SPI.

New Meaning of Reputation


Reputation is one of the most important metric in our game. It directly tells whether or not people will vote for a candidate in a certain district. It used to be a percentage of the population in the district that is willing to vote for you. It’s a value between 0 – 100. Not anymore. It’s now the actual count of people that will vote for a candidate. This implies that districts with more population is now harder to own (get at least 50% of voters).

Due to this change, we introduced the concept of Reputation Decay. A percentage of a candidate’s reputation in a district is deducted if the Candidate has no Staff stationed in that district. The message is that voters are fickle. They won’t vote for someone unless they constantly stick around, or the candidates give them money. :)

Ryan's note:  The inspiration for reputation decay came from a book called Accidental Guerrilla, in which author David Kilcullen proposes that the best way to weaken extremism is to provide a strong alternative to it.  Civilians in conflict areas inherently always fear for their safety, and gravitate towards the group that will offer them security and consistency, whether they be extremists or government.  It dawned on me that voters in countries where there is a weak government act in the same way.  Since their lives (or livelihood) don't feel secure, they will gravitate towards the candidate who feels strongest, or who sticks around longest and makes them feel that he or she has their best interests at heart.

Raise Funds


Now players can use the people they've convinced to give them money

We finally implemented this Staff action. It’s been in the game design papers ever since the beginning. We designed it such that the more Reputation a candidate has in a district, the more money it can raise. That’s how it is in real life. People are willing to give you money if they like you.

Patrons


Patronage politics at its best!

I had a direct hand in introducing this mechanic and I’m happy with it. Before this change, each district has a Kapitan which Candidates can have a relationship with (in a friendly way). The only effect it had was during elections. If you’re closer to the Kapitan, then people will vote for you in that district.

As a strategy gamer, I feel that the game doesn’t have much avenue in acquiring ‘things’ that generates resources, which I really like in such games. Mechanics like building an expansion in Starcraft to exploit new resources, building that Bank to generate gold in Civilization, etc. I suggested what if there are patrons or sponsors that players can court. They could be an influential family in the district, a business man, celebrity, or another politician. You gain some effects if you can get them to support you like giving you funds per turn, or slowing Reputation Decay.

Our game designer, Tristan, came up with Patrons. Kapitans were discarded. There are now 3 Patrons in each district. Each Patron has a distinct effect depending on a player’s relationship with such. One Patron had an effect when Raising Funds, another one for CP cost (reduced or increased), and last one had an effect when doing Sortie (increases or decreases the amount of reputation gained). A player can decide to make a good relationship with one or more of these Patrons using the Gift action.

Scandals


Red means “scandalous”

Everybody loves scandals… as long as you’re not implicated. Our political climate is rife with it, even during elections. I’ve heard in an interview with a local election campaign consultant that there’s this one politician who didn’t win but spent so much. He was running for Senator. When he was asked to compute his expenses divided by the votes he got, he spent around Php5000 per voter. The election campaign consultant then said “Imagine if he bought votes instead. That’s only Php500 per voter. He would have gotten ten times more votes.” Vote buying is a big scandal, but if you’re the one running the election, it could be very tempting.

Given such fact, the concept of Scandals is a vital mechanic in Party Animals. Of course the representation is rather simplified. Scandals in our game is just a number of scandalous acts that a candidate has done in a district. Actions like Bribe and Smear Campaign increases the Scandal Count. Other neutral actions like Campaign, Sortie, Gift can become scandalous (increases the Scandal Count) if a bigger amount of money was used to carry out such actions. If you didn’t know, COMELEC has a prescribed amount of election money to be spent. It differs per location and position. You can get sued if you’re found spending more.

At the start of the next turn, each “unchecked” Scandal are then “checked” if it is revealed or not. We are running a formula to this. If it gets revealed, the game imposes harsh penalties for the candidate on that district. The penalties are in the form of reduction of Patron relationship, Reputation and increased CP cost on the district. The higher the Scandal Count, the higher the probability of it getting revealed.

As simple as it looks, implementing Scandals gave us a lot of headache. There were a lot of design issues that we’ve encountered; there were some cases that we needed to consider. As of writing, I’m still working on the final touches of the mechanic.

The Tip


As promised, the tip I’m sharing is about how do I start my coding momentum. It may not work for everybody but it certainly worked for me. Programmers are peculiar creatures. They need to be in a certain state so that they can work productively. But reaching that state is hard because programmers must be working to reach it. It’s kind of like an “almost” chicken-egg problem. Reach that state to get work done but work to reach that state.

As I ponder upon this, I thought about working out. People hate it. It’s tiring. The time used for it could have been used for something else. To make things worse, the main benefit of working out is kind of an abstract bullshit: health. Then I thought of myself. I go to a martial arts gym but how could I do it? I know I need to do it but what really gets me to go there and tire myself? The answer is really quite simple. “I packed up my gym stuff.” Packing up gym stuff is easy. It doesn’t take a lot of will. But it starts there. Next, I go out and commute to the gym. While I’m at a bus, it’s already hard for me turn back and change my mind.

Back to programming work, I can ask the same analogous question, “What’s the least and simplest thing that I can do to start coding?” My answer is “write one line of code”. It works for me like sorcery. It might be different for you, so go find yours.

Thanks for reading.  If you want to be one of the first people to try our closed alpha, please sign up for our mailing list!

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 one of the first people to try our closed alpha, 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.
 

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