[10] Super project

Youtube | Twitter

Last time I put together a somewhat rushed post where I discussed my GOAP rewrite and vaguely touched upon a few of the latest additions. I’m going to go into further detail upon some of those additions to clarify things before moving onto the newest stuff. I feel like my writing has improved quite a lot, too, since I’ve found my footing. Time for a refresher!

The first new addition was the history system. This system keeps track of a number of stats that help drive agent behavior and each of these stats is fully integrated into my new GOAP implementation. This means, basically, that each stat behaves as an on and off switch.

The police, for example, will monitor the crime stat. This is a stat that increases when agents do something the game considers a crime – such as murder or stealing. If that stat ever goes beyond a certain threshold then law enforcements’ crime-fighting goal will be activated.

This means they’ll drop whatever they’re currently doing, such as idling at headquarters, to instead go actively search for criminals to arrest. They’ll keep doing this until they’ve brought the crime stat down to a more acceptable level through their own crime-fighting actions.

If any of this sounds familiar than you’re right.

The history system is a larger-scale implementation of the decision weights that my GOAP enabled agents already utilize when trying to decide which action is best. Technically, little has changed. They still use weights, have goals and use actions to accomplish said goals.

The only real difference is that they now have access to a public group of historical stats in addition to their own private stats. Hunger is a good example of a private stat. Each agent is different so they obviously need their own hunger meter. The same goes for health, money and other personal variables. Crime, though, is a historical stat. These stats are something that any agent can look at which is why I interchangeably refer to them as public or global.

The history system being plugged into GOAP means the agents are now super responsive. They’re all going to be reacting to the world around them even more so than they would have with standard GOAP. I’ve basically taken GOAP, which is known for being reactive only to its immediate environment, and dramatically scaled it up. The agents pay attention to the whole map instead of just their current surroundings. Eventually, this will be scaled up even further to include the whole planet and later the galaxy itself once more content is added.

A poor attempt to visualize the public / global stat concept.

The original purpose of the history system was to give my agents some problems so they’re forced to interact with the world in a more organic manner to solve them. I’ve since realized it has more potential than previously envisioned, though. The history system, for example, lets me influence large numbers of agents for almost literally no cost.

Instead of all the agents having to individually calculate whats going on in the world they can instead just take a peek at the history stats and react accordingly. It’s efficiency on the level of reading about some faraway event in the newspaper versus traveling to it yourself. I didn’t add it for performance reasons, but it’s nevertheless a nice bonus! I find it doubly interesting because the agents themselves are the ones making the gains possible. They modify the stats with their own actions and later reap the rewards by just looking at said stats.

It also makes the whole action and reaction thing I keep talking about much easier to add.

Let’s say the rebels just destroyed some kind of moon like space station. Let’s also say there was a historical stat that represents the rebellions threat level. The destruction of this space station would give that stat a dramatic boost – which, in turn, would activate an empire-wide response. This response would lead to a thousand forms of anti-terrorist activity and likely the rebellions demise if they aren’t prepared to deal with a major empire counter-attack.

Hunting rebel leaders, blockading worlds that support the rebellion, cracking down on pro-rebel politicians, interrogating rebel prisoners, searching for rebel bases, increasing foot patrols and producing anti-rebel propaganda are just a few examples I can think of.

The history system makes this kind of mass response a breeze. If empire affiliated agents see that rebellion stat get too high they’ll all begin autonomously taking anti-rebel actions.

It’s my first step towards adding that tug of war gameplay I want. The more the rebels harm the empire the more seriously the empire will respond. It’s an automatically scaling difficulty slider. If you want to actually take the empire down instead of just being a thorn in their side then you’ll have to start taking more extreme actions – which, in turn, will make them respond in kind. It’s inherently a self-destructive mechanic. The empire isn’t just some final boss that sits around all day waiting for you to come to fight them. It’s a faction that will actively move to protect its own interests. The more you poke at them the more aggressively they’ll react.

This fact passively enforces the need for subterfuge. I envision the game having a slow burn feel where you operate in the shadows to build up the rebellion’s strength. You have to treat the empire like a frog in boiling water. Turn up the temperature slowly to avoid attracting too much of their attention. Strike, let things cool off, then strike again. If you act like Rambo and start senselessly blowing shit up then you and the resistance will be dead before you know it. I actually have such a long-term vision that winning will likely require multiple characters.

Dismantling the empire should require several lifetimes due to the colossal amount of effort required. In other words, if you’re not killed in combat then your character will probably die of old age before your task is complete. The game will have one of those save systems where you generate a single world and can then play multiple characters in it. Your character might be dead, but his effects on the world still remain. This way your next character can build upon the success of the last. It’s eerily realistic because such a mechanic would reward you for doing the whole going down in a blaze of glory thing terrorist groups are known for.

I’ll probably make aging an option that can be disabled for those who dislike it. I’m a big supporter of letting people play how they want instead of forcing them to play my way.

Every single agent is goal-driven due to how GOAP works and as a result, the history stats are constantly changing. This results in a conflict of interest since there are so many agent types that prefer certain stat values. I like the way I put it in my previous post. In order for one agent to be happy they’ll have to do things that will make other agents unhappy.

I’m hoping this will help keep things interesting despite the project’s vast scope. I don’t want a Daggerfall-like situation where the game world is huge but empty. I think relying on AI, as in boots on the ground agents, is the best way to avoid the boring sandbox phenomena. I want a gigantic sandbox full of fun stuff. I was once thought procedural generation could be used to fix this problem, but I no longer believe it to be the holy grail I once thought it was.

Ironically, procedural generation probably causes the problem in the first place.

Thus, I’m going to try relying on the AI themselves for content instead. They’ll be the meat and potatoes of gameplay. They’ll make the game so damned interesting that you’ll ignore the repetitive map generation flaws. I think Bethesda and Stalker had the right idea with their Radiant AI and A-Life systems. Living worlds are better than pretty ones! These systems are a major personal inspiration of mine but I’ll talk about them later when they’re more relevant.

The player, of course, can also alter the history stats. This is the first of many steps towards allowing the player to have long-term impacts on the game – which is, of course, necessary for simulating a proper rebellion. Those empire troops you kill, for example, won’t just be magically re-spawned. This isn’t a call of duty match. Each of them will require recruitment, training, equipping and deploying. It takes time and money to replace those losses so even really low-end rebel behavior can have some small effect on the overall status quo. You’re not going to topple the empire by killing random troopers but you might free a town or two!

I’d also like if agents went through entire life cycles. This would make the above example even more important because now the empire doesn’t have an infinite supply of adults to pull from. It’s unrealistic to assume you’ll ever cause enough damage to stop recruitment entirely due to sheer number of people available in a galactic setting, but you’ll definitely be able to empty out small towns or garrisons.

This churn would also help keep the setting fresh by preventing stagnation. Let’s say some talented empire commander has been annihilating the rebels. His death by natural causes would be a huge relief to rebel kind. Lifting that boot from their neck would allow a dynamic resurgence of activity that even the player could notice due to the shift in difficulty.

I’ll probably end up adding such a feature because there are all sorts of sketchy side effects I can explore. Let’s say, for example, that agents are influenced by what they experience while growing up. If you’re willing to be manipulative, then you could go out of your way to cause a brutal empire crack-down on some poor town. This sounds counter-intuitive until you think about the long-term implications. If people grow up in harsh conditions due to said crack-down then they’ll naturally come to hate the empire. They may not join the rebellion itself, but they definitely won’t join or otherwise help the empire! It’s a double-edged sword, though, because those people can just as easily develop empire sympathies.

I like to support morally grey concepts, so the questionable guerrilla tactics such a mechanic would enable pleases me. You don’t have to be a man-slaughtering nutjob, but the option is there! I want the player to be able to fight the empire however they want and I intend to give them all the tools necessary to do so. You can be a bunker-busting commando, trade ship looting pirate, empire headhunting assassin, computer hacker and who knows what else.

I’ve also been thinking about how to give all the agents their roles. I don’t like the idea of just spawning a bunch of gangsters or soldiers. If I’m specifically spawning certain amounts of certain agents then all my work to make a dynamic setting is for naught. I think it’d be better to go for a job approach. Everyone could start as a civilian, for example, but later pick a job for themselves based on their experiences. If someone grows up in a crime-ridden city then they’ll become a police officer. If someone is scarred by rebel terrorism then they’ll sign up to join the empire. That kind of thing. This reactivity gels perfectly with all my previously stated goals so you can expect this to show up sooner rather than later.

Anyway, back to stats. That was a whole spiderweb of tangents.

The first actual stat I added was gang violence. Like I said earlier, all stats are modified by real-world interactions – and as such, it increases by 1 whenever a gangster attacks another gangster. That doesn’t sound like much but when there are hundreds of gangsters attacking each other every single turn that number sure goes up quick!

The next thing I added was two new agent types: civilians and mercenaries. I wanted to put my rewritten version of GOAP through the wringer so I decided to take a more complicated approach to countering the gang violence stat. The solution I came up with is two-fold. The civilians monitor gang violence and once it reaches a certain point they’ll look for a merc to hire. Then, upon finding a mercenary they’ll hire them to go blow up a bunch of gangsters.

This is the point where I decided to handle agent activity in a realistic manor and as such the game doesn’t just tell the civilian where a mercenary is at. Instead, they have to manually find a mercenary. I want the agents to follow the same rules as the player! Thus, to find a mercenary, the civilian just starts exploring the map by pathing to random locations.

I like this because it means there are agents out in the world actually doing things. You could be out in the middle of nowhere and still encounter some agents going about their business. They’re not randomly generated agents that were spawned just to populate the map. They’re actually members of the world on some kind of mission just like you! I think that’s pretty neat.

The civilian, upon stumbling across a mercenary, walks up to them and tells them what faction to hunt. This activates the mercenaries hunt goals which causes them to start searching the map for compatible targets. The gangster factions, in this case.

Attempt at graphing how the civilian / mercenary interaction works. Most functions are shared due to extreme generalization for GOAP which is why some of the arrows converge on the same bubble.

They’ll keep doing this until they’ve racked up 20 gangster kills. This is a hard limit I added just so the mercenary will eventually stop and give a different civilian the opportunity to hire them. In the future, though, the amount of money provided will dictate how many targets the mercenary will hunt. The mercenaries currently work for free since I haven’t added money.

Here is a video of everything discussed in action. Like I said, the civilians will start searching for mercenaries once gang violence is more than or equal to 1000. The mercenaries, when hired, then wander off and start annihilating gangsters until their quota is met. If you watch long enough you’ll notice the gang violence eventually starts getting out of control.

This is due to a bug that I’ve since resolved. It was caused by mercenaries being unable to detect when a gangster they’re targeting occupies the same tile. This, in turn, meant that the gangster couldn’t be killed. Eventually, all the mercenaries would get stuck and without them constantly mowing gangsters down that crime statistic would skyrocket out of control.

Also, you might have noticed the two graphs in the bottom right corner. They’re tracking gangster population levels. The problem I’m running into is that I need a more long-term view of whats going on. My usual method of displaying live debugging stats just isn’t helpful enough. I need to be able to track trends over longer periods of time in order to get a feel of what’s going on under the hood. I’ve thus started building fancier in-game visualizer tools.

This is a nice two birds with one stone situation because I’ll be able to let the player access most of these graphs. They won’t just be tools for me but tools for thee! I think I mentioned this in the past, but it’s critically important to give the player the means to view their impacts on the world. If they’re constantly raiding empire supply lines, for example, then they should be able to see a downward trend on some kind of economic report. It’s unlikely they’ll ever notice an impact through gameplay alone. This game is all about the long-term so changes will occur gradually enough that most people just aren’t going to notice. This means graphs and any other sources of information are vital. If people don’t understand how in-depth the game is then they aren’t going to enjoy interacting with it and otherwise get immersed.

That’s a pretty decent summary of the last post, I think! Let’s move onto the shiny new stuff.

I added a complex interaction last time but there still wasn’t a whole lot of decision making going on. The civilians hire mercenaries when upset and the mercenaries go kill stuff when hired. That’s it. There are no alternative options and as such GOAP’s fancy potential is being squandered. The whole point of GOAP, after all, is that the AI have options and they choose the one that’s right for them based on their current circumstances. The first thing I did to fix the situation was give civilians the ability to take matters into their own hands.

However, before we get into that, I need to explain the new personality system.

I ran into a problem when adding multiple paths of action to choose from. That problem was due to how GOAP works. It uses weighted values to decide which goals to focus on and what actions should be taken to do said goal. The system is too perfect and I was noticing all my agents acting like a hivemind. If there was too much crime, for example, then all the civilians would simultaneously begin searching for mercenaries to hire. This is a flaw with the history system that needs fixing. The agents sharing a single stat means they all react the same way. I could lessen the visibility of this issue by distracting the agents with things like hunger and other personal issues so they’re not always on the same wavelength – but I decided to just buckle down and perform some brain surgery instead of relying on bandaids.

Visualization of the problem I described. I learned how to make gifs in the adventure project. :D

The problem is that hiring mercenaries is objectively the best option. It’s the most effective tool the civilians have for dealing with gangsters. This meant that civilians were refusing to pull out a gun and dish out some much-needed vigilante justice. There are some obvious ways to fix this: such as fine-tuning the weights or adding more goal preconditions for additional granularity but that’s all a bunch of fiddly work!

I refuse to get bogged down with this kind of micromanagement. There might someday be thousands of agent types and god knows how many goals/actions – not to mention whatever other horrifically complicated things I add later! If I change one thing it will absolutely affect countless others. Trying to balance anything would be like untangle a pile of cords or herd cats. It’s possible but tedious and ultimately pointless since the game is still in development and thus constantly changing. Furthermore, I don’t want my game being predictable. If every single thing is perfectly balanced then players will be able to metagame their way into finding the best possible way to win. Introducing some random noise will keep them on their toes.

I’m also bad at balancing things in general. It’s a flaw I discovered several years ago when tinkering with some abandoned RPG concepts. The sheer amount of monsters and items I had to balance was a nightmare. I can do it, but I don’t find that kind of spreadsheet work fun. That experience is probably why I focus so much on sandbox games now. It’s not that sandbox games don’t need balancing, by the way, but people are generally more accepting of balance issues due to its open-ended and ultimately unpredictable freeform nature.

Hence, the personality system. It removes the problem with automation. The agents can now individually decide what they care about. I don’t have to perfectly balance things to ensure they consider all the options. The end result is that some civilians will now prefer to take up arms instead of relying on the mercenaries. The system itself is pretty simple.

It’s just a bunch of random numbers. In fact, as of right now it’s just one random number that I currently refer to as aggression. The higher this aggression stat is the more likely an agent is to prefer more violent options. It works by multiplying the weight of compatible goals and actions by the personality stat. Example below.

woo more graphs

They’re still technically choosing the best option but now said options are tailored to each agents’ randomly generated preferences instead of them all sharing the same hard-coded universal response. I’ll still need to do some degree of balancing, of course, but now the line is kind of blurred and anything I add should at least get used by someone.

The visualization with civilian trigger points randomized.

I wanted to point out before moving on that personalities aren’t just random numbers. They used to be, but I foresaw a potential issue with that and tried to preemptively take care of it. They’re now gaussian numbers. The problem is that randomization, despite the sound of it, isn’t very random. It tends to have an averaging phenomenon where the random numbers land in the same general area. Unfortunately, I couldn’t show enough lines on the visualizer to show you this problem. It takes a massive sample size before any noticeable patterns emerge in the random numbers. This phenomenon might be due to how pythons pseudo-random number generator works but it doesn’t matter now. I’ve found a better method.

Here is an example of 10,000 rolls between 1-3. I saved each roll and tallied them for a total.

1 = 3259 rolls
2 = 3429 rolls
3 = 3312 rolls

See? They’re all in the three thousand range. The numbers are different, sure, but they’re too similar for my liking. It’s not just bad luck, either. I could roll the dice a billion more times and you would always notice some kind of pattern. If I were to use these rolls there wouldn’t be enough deviation. The personalities might be randomized but each agent would act so similarly that you probably wouldn’t notice any substantial differences. It’s like mixing several colors of paint together. Instead of something cool looking you just get generic old brown.

I fixed this by using a gauss based random number generator. In the above example, I was rolling a number from 1 to 3. This means the result will always be 1, 2 or 3. That’s not how it works with gauss, though! Instead of those two numbers controlling the min and max roll they instead control the mean and variance. The mean can be thought of as the starting point while the variance is how far you can wander from it.

Example random rolls. They stay within the supplied range.
(1, 3) = 3
(1, 6) = 6
(1, 9) = 4
(1, 12) = 8

Example gauss rolls. The results can go beyond the supplied range.
(1, 3) = 5
(1, 6) = 4
(1, 9) = 7
(1, 12) = 17

The visualizer using gauss. You might to open the image elsewhere and zoom in.

I’m going to stick with gauss because of that boundary-breaking ability. I like the idea of some personalities going beyond a strict 1-100 roll. There could be a civilian that gets an aggression stat of 320 or something like that which would make them absurdly violent. It’s especially interesting because that number has the potential to get legitimately out of control if the moon aligns correctly and the RNG god decides to bless a particular agent. This will hopefully allow for some more unique characters to stand out from the crowd that can have a more interesting impact on the setting. Heroes and villains, basically.

I’ll probably also apply this technique to whatever form attributes eventually take. This way you could encounter agents that are unusually strong since they’re gifted with a bunch of strength or intelligence. It’s the code equivalent of being born with good genes. If there’s an agent with a strategic personality and supporting attributes, for example, then they could end up becoming some great rebel general. Or maybe they’re blessed with a combat-oriented mindset and end up becoming a great bounty hunter that’s feared throughout the galaxy?

I might be incidentally creating a basic form of natural selection. Survival of the fittest agent!

I could also make personalities act like a gatekeeper. If an agent isn’t strong, for example, then they can’t use the action that lets them break down a door. It will limit their potential in regards to GOAP. Let me use the above bounty hunter for an even better example. If that bounty hunter is an idiot then they’ll just randomly explore the entire universe for their target. That’s obviously a horrible idea. They’ll die of old age before they find that needle in a galaxy sized haystack. If they were smart, though, then they’d have a lot more options!

help im becoming one of those annoying programmers that use graphs for everything

There’s also the possibility of inheriting bad genes. I haven’t talked about this yet, but gauss actually generates numbers that can be negative as well as positive. What does this mean? Attribute wise, it means agents can suck at things. They could end up with -200 strength!

Personality-wise, though, it means agents can be extremely for or against for something. If I take away the negatives then it means all the agents are neutral at worse. That’s because 0 is the minimum base-line, which just means they have no skill instead of negative skill. The inclusion of negatives, though, allows for qualities on the opposite end of the spectrum. If a civilian has -100 aggression then they’ll almost assuredly never do anything violent.

The above gif examples might not make sense since the agents have been abstracted to a graph, so here is an in-game example of gauss based personalities being turned on and off.

Anyway, a few paragraphs ago I started talking about civilians taking up arms. They do that now! Civilians with high aggression will take matters into their own hands and start attacking gangsters instead of looking for mercs to hire. That gives them two options now for dealing with out of control gangsters. They do it smoothly, too, due to the blurring effect personalities have in regards to their gang violence tolerance levels.

I’m going to go ahead and end the post here. There’s a lot more I want to talk about, but this post has been in the pipeline for months now. I had a lot of annoying things happen at once so it really messed up my schedule but things have finally normalized. Come back next time!

I’m going to continue adding more agents and maybe incorporate some basic gameplay.

[9] Super project

Youtube | Twitter

Hello. It’s been awhile! I got completely fed up with the current state of things several weeks ago and had to perform some major code related surgery before continuing. My GOAP implementation, while technically functional, was a major pain in the ass to use.

I’m pleased to announce that the surgery was successful. I’ve not only greatly simplified it as a whole but it also runs faster as an unexpected plus. This simplification is a big deal because it brought a lot of clarity. I don’t need to sacrifice a goat and consult the oracle anymore when adding new goals/actions or otherwise making changes.

That’s enough talk, though. Let’s get down to business!

Last time I talked about not knowing where to go next. I’ve since decided to continue adding new agents or improve upon existing ones. More specifically I’m going to focus on deeper agent interactions. Less shoot and more think! This is to both leverage my recent GOAP improvements and give the player more interesting things to do.

This isn’t your typical game and as such, I don’t feel comfortable designing it in a vacuum. I want to get the player added as soon as possible for testing purposes. I’ve been talking about all sorts of systems and making all sorts of promises – but none of them are necessarily conducive to fun. I need in-game experience to ensure things feel right. I’m following my gut, after all, rather than some kind of detailed blueprint.

There’s no point adding the player yet, though. The only thing they’d be capable of doing is moving and fighting. I’ve tested these things to death in all my other projects so I know they work. I need to instead expand systems, add mechanics and otherwise just give the player more means of interaction. The easiest answer is more agents. They’re all so unique that with each addition the possibilities exponentially increase.

What do I add next, though? I got stuck on this question for quite a while. It’s harder than you think coming up with non-combat related AI. That’s why almost literally every game in the multiverse revolves around combat. Eventually, though, the concept of problem-solving came to mind. I’m going to give the agents problems and ways to solve them by interacting with other agents. There’s never going to be a dull moment with such a system because it’s inherently anti-balance. The agents will never stop working due to all the action and reaction going on. That’s because in order for one agent to be happy they’ll have to do something that will inherently make others unhappy.

What exactly is a problem, though? More importantly, how do I even represent such a thing to an agent? The answer is my previously mentioned history system. No, I’m not that much of a genius. I didn’t think of something before it was needed. The originally envisioned system was a different beast that I’m going to borrow and repurpose.

The original idea was to give the game a better way of doing behind the scenes things; such as deciding what agents to spawn or what random events to trigger. It would do so by analyzing a huge log of recorded stats and responding accordingly. The purpose of this isn’t realism, by the way. It’s to help build towards a more interesting setting by hopefully letting the player more readily see their or others impact on the world. I’m just mimicking realism because nature already has the answer to lots of design issues.

I’ll still use the above-described system at a later date, especially since talking about it got me excited about making it, but for now, the idea is going to be modified to serve a different purpose. The new idea is very similar but instead of a background system reacting to history its individual agents. I’m going to record all sorts of things that are happening across the city and make certain agent types respond to certain stats.

These stats are what the agents consider problems and they’ll solve said problems by modifying the stat. They do that by doing something in-game. Emphasis on doing! The agents must physically do something in the world. I settled on this extra step of complexity early on as it will make the world feel that much more alive. It will also help combat the issue of massive sandbox games (like daggerfall) feeling empty. If a crime stat threshold is reached, for example, then the police will start looking for criminals to arrest. The process of doing so will lower the crime stat by taking a big chunk out of it.

I say a big chunk because I speculate it’s necessary to have the solvers reduce the stat more than the causers increase it. This is to avoid a potential scenario where the solver is forever stuck trying to fix something that grows faster than they can reduce it. I don’t want endless problems. They need to be resolved so agents are free to do other things! I want it to function more like a back and forth tug of war rather than an infinite loop. If there’s a thousand criminals causing mischief but only one officer to reduce it then they’re obviously never going to get anything meaningful done. It’s not that big of a deal, though, because these kind of untenable situations happen in real life. It’s more of a personal preference right now. I’ll need to do some hard testing to see if it’s better gameplay wise to ensure problems can be resolved or to let some things fester.

The first-ever history stat I’ll be adding is gang violence. This stat increases whenever a gangster attacks another gangster. However, the new stat isn’t worth much on its own. I need to add a new agent that cares about it. This tripped me up for a while because the obvious answer is some kind of law enforcement but that’s the last thing you’ll find in this awful part of the city. They’re going to be corrupt at best or actively evil at worst.

The answer? Civilians. They’re only a indirect answer, though. The civilians themselves will not be taking up arms to fight the gangsters. This is a rough and tumble place so I’ll probably add that as a option sooner rather than later, but for now, I have something else in mind. Like I said near the beginning of this post I want to focus on more complex interactions so I’ll be adding yet another agent: mercenaries. I’m going to sprinkle a few of them around the map. The civilians will hire them to hunt gangsters once enough gang violence has happened. Each kill will reduce the stat by a few points. It might also damage their factions territory. This is free for now but in the future it will cost money.

Implementing this complex chain of agent interactions is what originally caused me to throw my hands up in the air and dedicate a few weeks (months?) to rewriting GOAP.

This is basically what happens. The gangsters fight which increases the gang violence stat. The civilians hire mercenary goal is triggered when said stat gets high enough. This causes them to start walking around the map in search of a mercenary. They’re not allowed to cheat so they have manually find one! Also, they can only hire mercenaries that aren’t already flagged as working. Upon finding a mercenary that’s open for business, they then path to it and flag them as hired once adjacent. Hiring the mercenary then activates the mercenaries hunt gangsters goal. This causes them to start wandering around the map in search of gangsters to blast. Each kill reduces the gang violence stat by 300. That sounds like a lot but every turn potentially hundreds of gangsters are fighting. Each attack from each gangster increases the stat by 1 so it can balloon really fast! The mercenary will keep doing this until they’ve reached 20 kills.

My shiny new rewrite of GOAP made creating this chain of goals/actions a snap. In fact, it was no more difficult than creating anything else despite containing significantly more steps. Even though there’s all this multi-agent interaction going on the goals/actions themselves are still independent. There’s basically no increase in complexity anymore where as it used to be almost exponential. Thus, tying two different agent goals/actions together is no more difficult than a thousand. That’s good news for the future! I can easily see situations where the depth of thought reaches hundreds of iterations deep.

Think about the amount of interactions that might be required to topple the empire, for example. There’s so many potential steps involved that I can’t even make up a number!

I’m going to stop here. This post is beyond late and I need to get some content up! I’ll have some examples to show you in the next post along with some new developments.

[8] Super project

Youtube | Twitter

In the last video update (viewable here if a refresher is needed) you might have noticed how the agents have a strong tendency to get stuck walking in looping patterns. This is because the agents aren’t aware of one another. The only thing they care about is spreading their territory. This means if two or more agents are close to one another they’ll just keep capturing one another’s territory as if they’re taking turns.

I fixed this by adding some new goals and actions that cause agents to search for and attack other agents. They do this with a quick field of vision check. If an enemy agent is detected they’ll attack until the threat is dead. The combat is super bare bones. There aren’t any calculations like damage rolls or hit chances going on yet. This means the first agent to attack will always win since they’ll have the health advantage. Eliminating other agents is prioritized above spreading territory so the moment a hostile comes into view they’ll attack. This means there’s no more weird dancing back and forth.

This is what combat looks like. The map starts with a stupid amount of agents present and they all kill one another until only a few remain. The red line between two agents means they’re fighting. I don’t think I ever explained the white line but it’s just an indicator of where the agent is pathing to. You can see that the agents don’t start claiming territory until all visible threats have been destroyed.

The next update was a new form of territory selection for the claim goal. The agent would previously analyze all the tiles that didn’t belong to their faction and choose the one that’s mathematically closest. This would lead to the agent sometimes picking a new tile to claim that was actually quite far away. That’s because the distance calculation didn’t take into account obstacles like walls.

The left image is how it previously worked while the right one is a closer approximation of how it now works. The green dot is the agent, red dot the target and grey line the path. The darker green tiles are claimed territory while white is unclaimed. The agent now selects a random neutral or enemy tile that borders their factions claimed tiles. This system isn’t perfect due to the random element but I actually prefer how it looks. It spreads the agents out and gets them expanding their territory in all directions.

What’s next? Groups! The agents are no longer going solo. The term faction now makes more sense since they’re working together.

The next thing I added was more goals and actions. The agents can now idle and patrol. Idling causes the agent to just stand where they are while patrol causes them to path to random friendly territory. The weights for these two goals are just counters which is code speak for a number that increments. It starts small but gets bigger over time and eventually it weighs enough to supersede claiming territory. The weight then gets reset back to zero at random which frees the agent to go back to claiming territory. I don’t feel like this shifting weight idea is the proper way to use GOAP but I’ve yet to think of a better way to handle things. If you’re wondering then combat has a high enough weight that idling and patrolling don’t ever overwhelm it.

The reason I added idling and patrolling is because I don’t always want the agents fighting over territory. It’d be kind of silly if there was a 24/7 gang war happening. I imagine them instead fighting in small unexpected bursts. The only time constant warfare should occur is when two or more factions have adjacent territory and their agents keep incidentally running into one another while patrolling. I’m not aiming for realism so much as I am the atmosphere. I think it would feel better if there was only the occasional skirmish instead of gangsters constantly shooting up the streets.

There have been no major changes at this point. I’ve been doing lots of minor behind the scene alterations to move things more towards my goal. Here are some of those changes. First, the maximum amount of agents a faction can have is now based on the amount of territory claimed. This means small factions have less and big factions have more. The current ratio is 1 agent for every 10 tiles with a maximum of 20 per faction. The agents spawn based on chance instead of a guarantee. This is why even factions with a ton of territory don’t have full agent counts. I did this so factions that are being constantly damaged will lose ground since it takes a while for reinforcements to spawn.

That’s about it. I’ve come to realize that I’m not using GOAP to it’s fullest yet. The agents have multiple goals, sure, but there’s only one path of actions available for them to accomplish each goal. The lack of multiple action paths kind of defeats the purpose of using it. Everything I’ve done so far would be much easier to implement as a finite state machine. That’s okay, though. I knew when adding GOAP that it would take a while to come into its own and be useful.

I think once more mechanics are in place things will get better. Having different kinds of equipment to use (guns, knives, cybernetics) and ways to get said equipment (buying, looting, stealing) will help. The games in such a simple state right now that there’s just not a lot for me to leverage yet.

I’m not sure what to do next. I want to start adding player interaction but there’s not anything for them to do aside from fight with the gangsters. Come back next Friday to see what I’ve decided to do next! Thanks for reading.

[7] Super project

Youtube | Twitter

Hello! It’s time to get down to business. The last post was super wordy so I thought it would be nice to balance things out by filling this one with a bunch of serious progress.

I’m going to start by just spawning a bunch of different agent types. I’ll be focusing on stereotypical criminal archetypes for the time being. Gangsters, smugglers, assassins, thieves, pirates, spies, druggies, hackers, outlaws, slavers, fences and so on!

I’m making this city a sketchy place for more than just atmospheric purposes. The long term plan is to use it as a launching point for developing the whole rebellion thing. What better place for rebel sentiment to fester than one full of criminals?

The first thing I need to do is get some proper pathfinding working. The deer you saw moving around in previous videos weren’t doing anything too intelligent when it came to movement. They were just searching their neighboring tiles for the one closest to their target and then moving to it. This lead to them always moving in straight lines since that’s the quickest way between two points. This was fine for an environment with no obstacles but the city is full of obstacles. It’s probably one of the most cramped residential areas the game will ever see. The below video has updated pathfinding. The deer now have to navigate all sorts of complex paths to reach their precious berries.

The pathfinding issue is fixed so now it’s time to start adding new agents. It took me a while to figure out where to start, though. I eventually settled on gangsters since they’ll give me the most bang for my buck. The gangsters, due to how they fight over territory, means that by simply adding one agent I’ll get a city full of activity.

The gangsters will also drag others into their warfare since they’re messy fighters so it will have an accumulative effect as more agents are added. I actually need to do quite a bit of work to add them, though. I’ll need to get a combat, territory and a faction system up and running. Then I’ll have to create a bunch of new GOAP goals / actions for them.

The territory system is a two-dimensional array. That sound’s fancy, but it’s just the computer equivalent of a checkerboard. Each number in the array represents what faction owns it. The number 0 means nobody owns a tile. It’s neutral. Every other number is unique and belongs to a specific faction. I’m going to use Star Wars for some faction examples. I’d use my game, but there’s no official factions yet! The number 1 might belong to the Mandalorians while 2 belongs to the Hutt Cartel.

I couldn’t figure out how to make a grid of numbers to visualize things for you so I made one out of colors instead. It’s pretty ugly but there’s only so much you can do with paint! The left image is the city. You might not remember it, but I went over its creation and other related details in a previous post. The middle image is the city with the territory overlaid upon it and the last image is the territory array on its own. The color white is neutral while the other colors belong to various factions. Feel free to imagine green belonging to the Hutt Cartel, purple to the Mandalorians, cyan to the Trade Federation and red to the Meatlumps. The territory array is the same scale as the local map which means they’ll be fighting over every single inch (or tile, in this case) of land.

The previous example was pretty ugly so let me show you an in-game implementation. This is the city with a better looking color overlay showing who owns what. There’s no actual factions or anything added yet. I’m just using simplex noise to simulate it.

The above example ended up looking like a terrain relief map. It just doesn’t look like what you would imagine a territory control map to look like. I replaced the noise with flood fills instead and got a much better-looking result. The fake factions are now mostly spread into their own regions which is what you would expect. I imagine this is how things will look once I get the agents added and fighting for territory.

I made this on accident but it ended up looking pretty cool. I could use this to simulate clouds, smoke or some other weathery stuff in the far flung future.

Anyway, It’s time for the real deal. I don’t want to overly complicate things so for the time being each agent will be their own faction. I’m going to have them all fighting one another as they work to expand their personal territory. I’ll change this to be groups of agents working together under one banner once the gangster basics are functioning.

Okay, well, here is step one. I’ve spawned 800 agents (because why not) and turned each of them into their own little faction. The factions are visually represented by all the different colors. The colors are random but not unique. If you look close enough you’ll see some similarities and even exact matches. That’s okay, though, because the factions themselves are unique objects. Even if two agents are the same color they’ll still consider each other enemies. The next step is to get them claiming territory.

This is what the random spreading looks like. It’s not as cool as I thought it would be. The video has two examples. The first part is with 800 agents and the last is with 100.

Okay, now I’ve let GOAP take the wheel. I’m blown away by how easy this was. I just made a new goal for spreading territory and a new action for finding the closest valid tile to spread to. Then I passed those to the agent and that was that!

I think that’s enough for today. I have a good bit more to share but this post is becoming unreasonably long. Come back next time for more gangster stuff!

[6] Super project

Youtube | Twitter

I spent the last couple of weeks getting accustomed to GOAP. The first version I managed to get running was pretty half-arsed. I was flying by the seat of my pants and as a result, many aspects of it were not properly implemented. I now have a better understanding of how it works, though, and as such have been steadily improving things as a whole! The code has been cleaned up and further generalized several times over and I’ve also got most (if not all) of the main features of GOAP fully implemented.

The last major feature I added is agents having multiple goals and the necessary logic to choose which one of them to work on. That logic revolves around costs. You can think of the costs as a representation of the agent’s decision-making ability.

In this video, the deer have both a hunger and an idle goal. The hunger goal starts at 1 while the idle cost is 10. This means the deer will choose to idle since it has the highest cost. However, once the deer gets hungry, that hunger cost shoots up to 15. This causes them to stop idling and instead work on finding something to eat.

However, that’s enough of that! It’s time to move away from deer simulator 2019. I was originally going to take the simulation further to continue ironing things out but have decided not to. The whole point of this detour, after all, was to get a functioning version of GOAP up and running. That goal has now been reached. Instead of wasting more time with continued debugging we’re going to move onto creating things that matter.

What matters, though? I thought about that for a good awhile. The answer I came up with is gameplay. That might seem like an obvious (and vague) answer but allow me to explain. The goal here isn’t to fake what I’ve been loosely referring to as civilization just for the heck of it. To me, these recent efforts with GOAP are just a means to an end. It’s the first of many complex but ultimately minor background systems that will eventually help bring us towards the goal of a world that doesn’t just feel alive but is alive.

The current plan is to breathe some life into my little hive of scum and villainy. The city already exists due to some previous work but it’s empty. I’m going to remedy that by spawning a variety of agents throughout the city and just letting them go crazy. I don’t want to spawn things in such a gamey way but I don’t have much choice right now. The foundation for more intelligent placement isn’t built yet but we’re getting there!

I don’t think I ever told you why I wanted to use GOAP, though! Its usage brings a whole bunch of neat bonuses but that’s all they are to me. These bonuses, such as the long term maintainability, while nice, isn’t that big of a deal in the grand scheme of things.

The thing I care about is the unpredictability that will come from the agents being given the ability to solve problems on their own. I plan to work with this unpredictability instead of against it. The long term plan is to take advantage of the chaos being caused all by these agents interacting with their surroundings and use it to drive the gameplay. The agents will inadvertently be acting like a bunch of little dynamic quest generators. I’ll be recording their activities and then pull from that history to generate content. This will help achieve my goal of a game full of meaningful content without relying on typical generation methods. Instead of generating missions out of thin air they’ll be made in response to genuine events that have or are happening throughout the galaxy.

This is, in my opinion, vital to the end goal of the player (or agents) being able to affect the galaxy in a meaningful way. Having action and reaction tightly woven into every part of the gameplay will help bring us towards that goal. I’m nowhere near accomplishing such a thing but with GOAP out of the way we’re a lot closer than before!

The reason for this obsession with an organic setting, by the way, is due to my lengthy back history playing all sorts of sandbox games. I’ve come to realize that most if not all of them are ultimately shallow and it’s something that annoys me. That freedom stops being interesting when you realize its only skin deep. It’s just not enough on its own.

Let me give you a better example to help drive my point home. My grand conquests in Terran Conflict started to feel pointless once I realized my actions don’t change the status quo. That’s because the state of the universe is set in stone. The sandbox is an illusion maintained by a bunch of AI pretending to do things that matter. There are factions waging war even though they never trade territory. There are traders trading even though the economy doesn’t matter. Pirates are pirating even though they don’t need the money and never use the things they steal. The player can’t capture sectors, defeat factions or even permanently destroy space stations. The most egregious offense is that space stations are respawned the moment you leave the sector! The game presses the reset button if you do anything that might interrupt the illusion.

I don’t think the factions even need resources to replace losses or do anything in general which further damages the simulation as it means the economic aspect of the game exists just for the player. This as a side effect now means that you can’t damage a faction by raiding it. They will continue to pump out ships if you destroy all their shipyards. Fleets can jump even if they don’t have any energy cells. I’m not specifically sure how much is faked so some of what I just said might be false – but enough of it is faked that it had a trickle-down effect that tempered my ability to enjoy it.

I want to avoid this kind of illusory sandbox which brings us back to my original point. The gameplay. I want to ensure it doesn’t get lost in the noise. I plan to accomplish this by creating a setting where things matter. The sandbox and all the bells and whistles that come with it are being built to support the gameplay rather than serve as it.

I have a lot of other things to talk about but it will have to wait until next time. Feel free to come back for part 7! I’ll actually have some stuff to show you.

[5] Super project

Youtube | Twitter

Ah! Yes! I finally got a rough draft of GOAP up and running. It took a few days of banging my head against the wall but I finally got it! It wasn’t actually that difficult in the grand scheme of things. I probably spent most of the time just staring at the screen trying to wrap my head around this four dimensional non-sense. In order to create a GOAP system you have to think about AI from an entirely different angle. You can’t just go down a finite state machine style checklist of obvious choices anymore. Instead, it’s all abstracted to hell and back. Everything has to be decentralized but also compatible.

The current implementation isn’t very faithful, though. That’s why I’m only calling it a rough draft. I took a lot of short cuts in order to get where I am now. I did this to reduce the overall complexity of implementing something with such a foreign design concept. Instead of having to simultaneously develop new mechanics on multiple fronts I just focused on the most important one. The automated goal / action system!

I left out things like the cost / weights stuff or support for multiple goals and action paths. The deer only have one goal, which is to eat, and its always active. They’re basically being forced to gorge on those delicious berries non-stop! There’s also only one possible path of actions they can take in order to eat – which is find berries, path to berries and then eat berries. The important part, though, is that they’re figuring out how to do this all on their own. I’ve verified this by randomizing their actions prior to analysis. They figure out the right order of operations no matter how much I mess with them.

Anyway, here is the first ever video of it running! It’s just a dumb little deer eating dumb little berries. The white D is the deer and the pink bush looking things are berries.

The next step was to test its responsiveness. I added a respawn timer that adds new berries to the world once a timer is reached. It’s a good thing I did this because I noticed a problem. The agents aren’t analyzing their environment in real time. They get a path of actions and stick to it until completion even if a better path shows up. The deer will find a berry and move towards it as expected but if a new berry spawns that is closer than their currently targeted berry they wont change targets. This is a performance heavy feature but its kind of the whole point of GOAP. I’ll get it patched up soon.

I then took a risk and added another deer. Everything actually worked without issue! I was really expecting a crash or some kind of conflict to arise but nothing bad happened. However, as you may have noticed, their is something strange going on. It’s not a bug or anything, though. It’s more like a quirk.

That quirk is that both deer eventually get kind of stuck doing the exact same thing. This is happening due to how the berry search works. The game finds all the berries and directs the agent towards the closest one. This means, then, that the closer two agents are and the fewer berries their are the more likely they are to start going for the same berry. Eventually they’re on top of each other and moving in perfect unison. This would happen less if the map were bigger and I didn’t allow agents to occupy the same tile.

The below video has even more deer in it to help you see what I’m talking about. I also dramatically increased the berry respawn rate to try spreading them out more but it didn’t really help. Even with so many food options the dummies still get all stacked up! I’ll have to add some kind of randomization or something to prevent this. also cleaned up the debug stats and added a guide line that connects each agent to their debug stats. This is so we can tell which stats belong to which agent.

The earlier discussed issue is more noticeable in this test, by the way. If you pay close attention you’ll notice the agents walking towards coordinates where berries used to be but aren’t anymore. That shouldn’t be happening! Instead, if a targeted berry gets eaten then they should stop and search for a new one. This will hopefully be fixed next time.

That’s enough for today, though. I’ll see you guys next time in part 6! I will likely fix the above mentioned issues, add more goals / actions and who knows what else. This dumb deer/berry simulation stuff is to help me get used to using GOAP. It also helps with working out the kinks. It wont take long before we’re back to ‘real’ gameplay stuff.

[4] Super project

Youtube | Twitter

The goal for now is to start shoving some agents into the game. The world won’t feel very alive if the player is all alone! Thankfully, artificial intelligence is kind of my specialty. It’s one of the things I feel most comfortable making. In fact, something I learned how to do several years ago will likely come in handy right now! That something is called goal oriented action planning. It’s absolutely perfect for whats needed. That ‘need’ is AI that are easy to create, can adapt to their environment and have personality.

The beauty of GOAP is that it’s not what you might call hard coded. It’s flexible instead of rigid. I’ll even throw the buzzword dynamic into the mix! It’s about as close to alive as I can imagine a pile of code ever being. Your average AI, or at-least the ones I usually make, are typically ran by one gigantic wall of code. You can basically think of this wall as a check list. The AI simply goes down this check list every frame and accomplishes its tasks in order. It has to have a answer for every edge case scenario in order to prevent it from getting stuck or worse. I’ve you ever seen a computer controlled player running endlessly into a wall its not a bug. It’s a lack of logic. It wasn’t given a way to detect that its stuck or a method to correct itself. This fact is what causes problems as it means even a fairly simple AI can quickly become a mess of spaghetti code.

The problem with this checklist method is that the bigger the checklist grows the more complicated things become. It will quickly end up looking like an overgrown tree instead of a linear path due to all the branches of thought constantly being added. This type of AI is common because its easy to make – but it becomes harder to maintain as the game expands in complexity. It just doesn’t scale well at all. The worst part is that there’s basically nothing you can do about it. There’s no magical way to implement a checklist style AI (usually referred to as a finite state machine) without the resulting spaghetti code. Either throw more code at it and dig your hole deeper or have crap AI.

This is a pseudocode example of a finite state machine. The aforementioned check list! This is actually based on real code that I use for most of the monsters in my games! If you were to convert it into real code then it should work right out of the box. You can already see the branches starting to form despite being such a simple AI. It shoots enemies when they’re present and searches for them when they’re not. That’s it.

Let me give you a test scenario. The AI needs to eat. It will die in a few turns from starvation if it doesn’t! Let’s also say a enemy is nearby. What does the AI do? Does it risk fighting the enemy them before they starve to death or do they run to find food? There’s no guarantee they can quickly defeat the enemy so the obvious answer is to find food. They have a good amount of health left and can tank some damage, after all. However, they don’t know where the food is! They have to randomly explore and hope for the best. They might starve while looking for it or be killed by the pursuing enemy. What if the poor AI is low on health, too? If they run to find food the enemy might kill them. If they fight the enemy it might kill them. If they do either they might starve and die anyway The choice isn’t so easy now, huh? This is one of the many problems with finite state machines. They need a hard coded response to every imaginable scenario and more often than not a clear answer doesn’t exist. Even if a answer does exist then its going to result in predictable agent behavior on top of being annoying to program.

That’s where GOAP comes in. In a way, it’s similar to a finite state machine. It’s not sentient or anything. It still uses the code you made! The difference is that this code is modular. The evil checklist is gone and there’s literally no consequence to making the AI smarter or the game deeper. I can not only give it a response to every feasible situation without the spaghetti code but it will also respond to said situations all on its own. The modules can be thought of as tools and the AI automatically picks the right tool for the job. There’s no such thing as too many tools, either! I can fill that toolbox to the brim without consequence. This is because each of the tools are entirely independent.

The best part is that these tools, being modular, can be added or removed at will. For example, let’s say a civilian, someone that has no experience fighting, just found and picked up a grenade. That grenade contains the code needed for the AI to use it and the act of looting it means the civilian is now capable of throwing it! This is a powerful system that lets the AI better react to its immediate environment. This thing might as well be a procedural chaos generator. Let it loose in a sandbox setting and enjoy!

The way it works is pretty simple. The name goal oriented action programming kind of explains things on its own. Every AI has a few goals and they automatically work to achieve said goals when needed. The need is based on some stats – so a hungry agent will look into a eating food. There’s not a wall of code guiding them, though. Instead, it’s the goal itself helping them. Each of the goals can basically be thought of as miniature finite state machines. They contain just enough code to help.

It does this by analyzing all of the agents options. If the agent is starving and the goal they’ve selected is to eat then every means of acquiring food will be considered. The best option will cost the least points and thus be chosen. If the agent is lost out in some random desert, for example, then there’s not going to be a restaurant anywhere nearby. That means getting fast food will be given an undesirably high cost. It doesn’t just stop their, though. The analysis goes all the way down the list in regards to the option of getting take out. That means it will also take into consideration the cost of buying it. If the agent doesn’t have any money then the cost will be raised even further! The next option could be hunting. There’s some camels nearby! Even though it’s dangerous that would probably end up being the best option available – unless they’re a vegetarian! If that’s the case then they might resort to killing a nearby trader and stealing his cookies.

Phew! That was a wall of text. In the next part I’ll start adding GOAP.

(PART 3) Super project

Let’s move on, though. The next step is getting the local maps up and running. These maps are where the majority of real gameplay takes place. The fact that I’m adding them means we’re getting close to actually being able to do stuff. I’m going to start with making the city because it’s going to serve as sort of quest hub. Everything the player does will revolve around it for the time being. I’ll be using the color to terrain method that we used earlier to make the overworld.

Okay, well, here’s the city! The strange appearance is by design. It’s visually stylized after Favela. Lot’s of buildings are tightly crushed together and there’s little more than claustrophobic alleyways between them for movement. This city style is a real hive of scum and villainy. If you want to buy drugs, fence stolen goods, talk to informants or hide from the law then this is the place to go. They’re not entirely safe, though!

Gangs endanger everyone with their senseless territorial warfare, lurking bounty hunters patiently wait in the shadows for their target, undercover operatives search for rebel collaborators hiding among the poor masses and there’s the ever looming threat of yet another alien uprising triggering a deadly military crackdown. The player might be a rebel but that doesn’t mean everyone else is. The Verge aren’t the only bad guys, either. Criminals or just people in general aren’t guaranteed to be your friend. They all have their own goals in life and the rebels are just one faction among a sea of others.

Here are some videos of me walking around the city. The first video is with just fov enabled and the next is with both fov and explored tile memory. The difference in playability is pretty drastic. The memory lets you see where you’ve already been which makes navigating not only easier but less annoying. It’s not really enough, though, is it?

Exploration sounds cool on paper but in reality it usually sucks. I think it would get old pretty fast having to blindly navigate these mazes. The player is going to be visiting a ton of maps and more often than not it will be a place they haven’t been before.

In our world we have all sorts helpful ways of dealing with these problems so it only makes sense for the future to have some modern conveniences too! The first idea that popped into my head are scout drones. The player can buy and deploy them when needed to explore areas on their behalf. I like this idea because it helps tie the player to the world by giving them meaningful reasons to interact with it. If you want some drones you’re gonna have to go make some money and then find someone that sells them!

That’s enough for today, though. In part 4 we’ll start adding some agents!

(PART 1) Super Project

Youtube | Twitter

I have a super project that I’ve been wanting to make for a long time. This idea is actually one of the original reasons I learned how to program in the first place. The problem is that my idea is so complicated that I don’t know where how to begin.

Imagine trying to make something as complex as Dwarf Fortress but on a galactic rather than planetary scale. Then consider I want to individually simulate all the agents, species, factions, and planets so everything that happens in the game is real.

I say real due to a lack of a better word. Dynamically, perhaps? Naturally? I don’t know.

Let me try to explain it with an example.

That contract you see on the black market to recover a stolen item wasn’t generated out of thin air. It was created because a starving citizen stole said item out of desperation. It wasn’t created specifically for you, either. It was generated as a natural consequence of events.

If you don’t do it then someone else will. The game aims for a certain type of realism that can be summed up as things happening for a reason. It’s built on the idea of the butterfly effect. You’re just a cog in the machine of a living breathing world.

If that sounds daunting then you don’t know the half of it. It’s not like I haven’t tried, either!

Every one of my previous attempts has ended for basically the same reason. I put a bunch of work into building something only to realize I’ve barely accomplished anything. The end goal is so far away that no amount of work makes it seem feasible. That’s usually when my inspiration fizzles out until the next wave of motivation hits.

The problem is that it would probably take years of work to establish what I would only refer to as the foundation. The amount of time I would have to spend building this foundation so I can work on the actual fun stuff is what keeps crushing my spirit.

The obvious answer is to build it in baby steps but my question to you is: what’s the first step? Every time I start from what I believe is the bottom-most step I end up realizing there are another thousand floors beneath me. I just can’t get close to the metal.

Anyway, let me try and explain this so-called super project.

I’m going to use Star Wars as an example setting. It sucks, but it’s a setting that just about everyone knows and it can be compared to my idea in a thousand different ways.

The main similarity is that Star Wars has a classic big bad faction vs little good faction. Or, more specifically, the Empire vs the Rebellion. The entirety of my game revolves around this concept. The player is apart of the Rebel Alliance and the goal of the game is to defeat the Empire. That’s not as simple as just crawling through a dungeon and defeating the end boss, though. It will require more than I can even begin to reasonably explain. Imagine how you would go about winning a guerilla war of galactic scale.

Would you bribe politicians to remove laws that harm your movement? Blow up fuel refineries to cripple the Empires fleet movement? Take out generals so enemy forces are without leadership? Free slaves so they join the Rebel Alliance alliance? Sabotage top secret research to delay the release of terrifying new weapons? Steal enemy clothing/documentation so you can sneak into their base to plant false evidence? Lure an enemy patrol into a minefield you recently built? Hack a orbital defense laser to destroy other such lasers so the planet is open to invasion? Befriend distant alien races for unique technology? Pay smugglers to help you escape through an Imperial blockade? Antagonize civilian unrest so they riot in the streets? That commotion sure would make your assault on the capital easier!

The answer is all of the above and then some. The rebs will have to engage is just about every form of espionage imaginable to accomplish their goal. I intend to support as many strategies as possible. If you can think of something then it should be a possibility.

Here’s the problem, though – remember what I said earlier? I want things to be more natural. I don’t want the player walking up to random dudes with quest markers floating over their head telling them where to go and what to do. I want a more realistic setting where there’s no real guidance or obvious gamification. The purpose behind this reasoning will be explained further below. It can be summed up as making your own destiny, though.

Imagine looting a data disk from some high ranking imperial officer you just took out. You weren’t sent to target him specifically or anything. You were just following an encrypted signal that lead you into the forest where him and his crashed ship were waiting. Turns out you were following a distress signal! It could of just as easily been a bandits trap or random noise from a malfunctioning droid. He was shot out of orbit a few hours ago by pirates. They were bested by the officers escort ships but not before they shot his transport down.

These pirates didn’t know about the data disk or anything. They just wanted the treasures his well guarded ship may have contained. The officer didn’t just randomly spawn with it, either. There’s no random loot table non-sense. He was trusted with its transport by his superiors – whom are also as fully simulated as he is!

I’m going to stop the what if shenanigans here as this could go on for awhile. Finding a way to access the data disk and then actually make use of its contents is another couple of paragraphs on its own. The point was to show you the ever expanding web of interactivity that results from even the simplest of things in such a setting. It was also to try showing you the potential depth of a setting where everyone is living their own lives.

You could call all of this random chance but it nevertheless happened on its own. It’s chaos, sure, but it’s automatic chaos. It’s about as close to a living breathing world I can imagine code being.

It wasn’t something I specifically programmed to happen. I didn’t spawn the pirates. They were poor civilians that turned to piracy as a means to an end. I didn’t tell them to attack the officer. They needed money and knew a guarded transport might contain riches. I didn’t give the officer a top secret data disk full of information. He was trusted by his superiors due to outstanding performance. I didn’t lure you towards the officer with that signal. You just happened to be in the right place at the right time. I think that’s great and it’s the underlying basis for the whole game. This concept is the meat and potatoes of my super project and it extends to everything.

I’ll basically create the initial universe and then let things go off the rails on their own. The cool thing is that this simulation happens in a live setting. There’s no history to pregenerate. You help shape history by being apart of it rather than just living in the afterglow. I just spawn the planets, factions and other necessary set pieces and let the AI take care of everything else. They’ll all just start living their little silly lives and chaos will unfold by itself.

Is it worth it, though? I think so. The potential for story really interests me. This system gets around the constraints of being a person. There’s only so much content I can add and my creativity is limited. I’d rather make a chaos generator than code a thousand missions or random events by hand. I think the end result would be better.

I think the reason for my obsession with this idea is that a lot of sandbox games feel empty. If you play them long enough you realize a lot of stuff is being faked behind the scenes. That fleet you just destroyed, for example, doesn’t really matter. The game will just replace it with another one when you leave. In my ideal game it would matter. Their would be consequences instead of illusions. The Empire would have to spend resources to rebuild it. That means time, money, metals, labor. Their would be a whole production chain going on that you can interrupt at any level. If implemented properly you’d be able to not only do some genuine espionage but also experience the consequences of your actions! For example, if you keep raiding those ore mines then Imperial ship production will genuinely slow down.

That brings me to my final point of the day: consequences. This is where a lot of games that do what I’m trying to do end up falling short. They create this elaborate background system but fail to make the player adequately aware of it. Thus, everything they see or interact with might as well be random. To get around this problem I’ll be doing a lot of work to help reveal the worlds complexity to the player. I could add graphs so the player can see the long and short term effects of their actions or individual unit history logs so they can see what others have been up to. I think that kind of stuff would go a long way to helping players realize the richness of the setting and their impact upon it. There’s no point having an interconnected universe when you can’t examine the connections.

That’s all for today. This wall of text was several hours in the making. I should probably spent my time coding instead of talking but sharing my ideas helps motivate me. I don’t know what we’ll be talking about next. I might start going into detail about how I’ll be actually implementing this or just talk about more abstract stuff that only makes sense to me. Who knows?

If I do any actual coding progress I’ll be sure to let you know. I intend to document the process with videos because the idea of having its creation history on record from start to finish interests me.

Continued in part 2.