Tuesday, 24 November 2015

Hacking a Much Bigger Planet

I've always found a silent dev blog is usually a good sign of continued development, and in this case that is very much the case. Development on HTP continues in earnest, and much progress has been made. I'm not going to try and covered everything that has changed since I last posted, there's simply too much to cover.

The game world has grown expenetially in recent months. This is partly due to the addition of "clusters" and "superclusters". Clusters can be thought of as cities, towns, villages, large campuses, military bases, etc. basically anything that would contain a number of individual networks which in turn contain a number of devices. Superclusters are collections of clusters, or put simply, countries.

Using carefully combined real world data, I've added every country in the world to the game (bar a few small island states with little or spurious data), and the largest ~4,500 cities in the world. The scale of a supercluster is determine using a combination of the countries total population and its GDP (which I currently use as a rough indicator of network density). Though I have also collected data on every country's internet penetration and total internet users, which I will find some use for I'm sure. The benefit of generating the world like this is that it allows me to defer the generation of actual networks until the player actually visits the cluster they are contained in. This gives me an effective order of magnitude increase in generation speeds.

While I only know the 'estimated' total world population of networks, devices, and users at generation-time, in practice, the player will not notice their absence before they are generated. Of course, to give the world some life and activity outside of the cluster the player begins in, I've selected a number of organizations (more on these later) in the world at generation-time and fully generated them and their employees (again, more on these later). This gives the world the illusion of being full of life and activity before the player visits more of its clusters on their travels.

Speaking of travels, a lot of work has gone into how this mechanic works. The player can only navigation around the world at a certain rate, which is plenty fast enough for navigating netween the networks in a cluster, but the distances between clusters is very large, and the distance between superclusters is vast. The 'connections' between clusters now act as a sort of highway, when the player approachs a connection, anywhere along its length, they are 'sucked' in and accelerating to great speed, pulling them to the distant connected cluster or supercluster. They can of course pull themselves out of the connection at any point, and I've got some plans for gameplay reasons for them to do so coming in the future. The current graphics for this are placeholder, but I have been playing around with some effects which I hope to incorporate soon:

Another benefit of travel via connections comes in world generation. The time spent travelling down a connection to a previously unvisited clusters gives me the time to generate that cluster before the player arrives, while the result still needs some graphics work, the effect will basically allow for seemless travel around a world in constant generation.

Dividing the game world up into clusters and superclusters will also allow me to scale the AI simulation around the world based on where the player is currently located. For instance, the player really doesn't need to know or care that Phil Robonson arrived 13 minutes late for work this morning and thus received a warning from his boss (more on this later), or that Sarah Peters learnt that her best friend is in serious debt (keep reading). But they certainly will care that the network administrator of the network they are in the middle of hacking just got paged after you triggered an alarm on the network's external firewall and is logging in to track you down. I still have to keep track of all the little details around the world, but most of them aren't that imporant from moment to moment and so can be batch simulated when they become relevant to the player. The player doesn't really care WHEN Robert Johnson from accounting got fired for fighting with one of his colleagues, they just need to know it happened if he becomes important to them later down the line.

As you might have realized, the simulation of the world has become quite a lot more detailed since I last wrote. HTP has taken an interesting turn in terms of gameplay, one I hope will further make it stand out in the small genre of hacking games. The level of detail in the simulation of the inhabitants of the world has been greatly increased. The anecdotes in the previous paragraph weren't just some hypothetical examples, they are all fully implemented and have real consequences to the player and all of the world's AI entities. As briefly mentioned earlier, I've added organizations to the game. Previously every network existed as an island of sorts, with no kind of controlling entity or real relationships to other entities (By 'entity' I mean anything tangible that interacts with other entities in the world. Organizations, networks, devices, people, etc.). Now when generated, networks are empty sites that are then allocated to an organization. Organizations vary in size, they can be small independent companies controlling a single network up to huge multinationals controlling hundreds of networks across the world.

When an organization sets up shop in a network they will procede to hire any employees they need to do what they do, this process involves looking at each position that needs to be filling in the network depending on what the organization does: administrators, programmers, bank managers, lawyers, managers, a CEO, etc. For each position, people will be randomly generated into the world, and in a kind of interview process, eventually someone with the appropriate personality traits will be selected (managers for instance, are required to be more demanding of their subordinates, and programmers are required to be of a certain level of intelligence). Once a suitable candidate has been found for the position, they are hired into the organization and are allocated to the network they will work in (not given a computer yet mind you, this is all done at cluster-level generation, not network-level, where devices are generated).

So now we have a bunch of employees working specific jobs at a specific place for a specific organization, we're half way there. These people don't just live to work, they must have lives outside of work as well. The next step is to find them a place to live. The generation engine next finds a home network somewhere nearby where they work and allocates them as a resident of said network. What about human relationships? Some people are single, some have partners, some are married, some are straight, some are gay, some are involved with people at work, some with people outside of work. All this is generated, so we end the cluster-level generation with thousands upon thousands of simulated people with their own personalities, lives and knowledge.

Knowledge. This is possibly the most important stage of generation. It's all well and good to have thousands of people going about their lives, but information is power, and information is the currency of HTP, and what information is there is no one knows anything? These most interesting part of developing this procedurally generated world for me has been simulating the accumulation and exchange of knowledge by the inhabiting entities. This process might be best described with a story. So I'm going generate a world right now with a random seed of 1632 (because it's 4:32pm currently), find a randomly selected person living in Vancouver, Canada (because that's where I live), let the world simulate for 1 month, and tell you their story.

  • Our story begins with a 24 year old straight female named Jean Vaughn.
  • She works at Central Telecommunication as an account manager.
  • She lives at West Summit Plaza at 168 Hickory Crescent.
  • She is in a relationship with Sean Brock, a 34 year old unemployed man.
  • Jean's mobile number is (+1)681-6921.
  • Jean's work computer's login is jean:jack.
  • Jean is good at her job (with skill of 0.81), very ambitious (0.97), innoffensive (0.17), uncharismatic (0.16), loyal (0.74) and immoral (0.1), this will affect her actions.
  • She is friends with her boss Megan Landry, a charismatic but somewhat confrontational 31 year old woman.
  • Jean was recently given a verbal warning for being 18 minutes late for work.
  • 58 other people live in the same apartment block as Jean.
  • She lives on the 2nd floor, as well as 16 other people.
  • Living next door to her is a 28 year old man named Raul Howe.
  • He works at a Colocation run by North Telecommunication Co.
  • North Telecommunication Co. is a small independent telecomms provider based out of Vancouver, Canada with 58 employees.
  • While small the are very efficient and their last month's revenue was $3.3 million.
  • Raul's work computer's password is 'ladybug'.
  • It turns out Raul is working undercover for another organization, a secret he's so far kept to himself.
  • Speaking of secrets, it also appears at some point in her past, Jean Vaughn hired a hitman.

I could go on, or let some more time pass and watch Jean and her friends' lives change as the world carries on, but I think this gives an idea of what's going on in the world at this stage. As a side note, the simulation of this world for a month took approximately 10 seconds.

What has made the development of this much detail possible is a tool I've been working on for the past 2 or so months. It's a standalone simulator of the game world that makes it much easier to see the vast amount of activity and information that the world simulation generates without all the overhead and obfuscation that the game engine itself creates. I've pulled all of the game logic out into a separate DLL that will let me run the game itself and the simulator on exactly the same code.

I sometimes wonder if spending so much time away from the game itself to create this simulator is worth it, then I look at how far the world simulation has come in the past 2 months, and how hard it would have been to make the same progress if limited by the game engine. I feel it has been completely worth it, and has certainly made it an order of magnitude easier to find and fix hard to spot bugs, as well as create the extremely high level of detail that will create a believable and interesting game world.

I hope this brings things back up to date, I'm sure I've not mentioned a ton of stuff I've added since April, but this is enough of a wall of text already and I don't want to overdo it.

As always... Hack the Planet!