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!

Thursday 9 April 2015

Still Hacking

Well so much for keeping up with the blog. Every spare hour I've had over the past 2 months I've been spending on development so writing about it has taken been taking quite the back seat. I honestly don't know how indie developers find the time to keep dev blogs up to date. Well in news, I've had a chat with my boss about my day job, and I'm going to be cutting back from full-time to part-time, something almost unheard of in the games industry in my experience. This should give me not only at least another 20 hours a week to spend on HTP, but hopefully more time to keep this blog up to date and even, heaven horbid, have some free time!

HTP has come a long way since I last wrote, not only in terms of gameplay, but in visuals. I've replaced the previous placeholder UI with a 3D UI that whilst more or less functions the same way, looks much better. I always try to tell myself that graphics aren't that important and can just be added last, but it's hard to keep your morale up when all the other games you play look so much better than your own. I probably spend about a month completely redoing the UI engine and even though it has hasn't changed the gameplay much, it just *plays* better now. It also looks and feels more 'cyberspacey' than before.



(Please excuse the low quality/huge download size of the gifs, I'm new to this)

This isn't to say I haven't been working on gameplay at all. I've done a lot of work on the AI. Procedurally generated users now have lives, they go to work, they go out for lunch, they hang out in bars after work, and they go home to relax and sleep. They bring their mobile devices, connecting to networks with wifi as they move around, and have different routines depending where they are. If you, for instance, were to hack into a system administrator's workplace's sprinkler system while they were at work, and schedule a sprinkler test, they would be evacuated from the building and thus the network, leaving it more vulnerable to attack. You will even be able to get someone fired by planting illegal files on their machine and notifying the authorities. There is still much work to be done here, but the design is shaping up quite nicely to allow for some very interesting emergent gameplay.

I'm pretty happy with the visuals and UI at the moment, and I don't think I'll need to do much more work there for a while, leaving me free to get my teeth into the really juicy gameplay and AI behaviours. This is good, since it's something I'm much better at, and since very shortly I'll have much more time to spend on it, things should move very quickly. Exciting times



(I love how the 3D UI benefits from the crash post-effects in such an awesome way)

Thats all for now, once I move to part-time work over the next week or two, I'm going to try and plan my more plentiful time and make sure to allow for some hopefully weekly time to document my progress here.

Hack the Planet!

Saturday 7 February 2015

Almost a Game

So a lot of time has past since my last update. But this time I'm not going to blame being busy at work, or Christmas, because I've in fact been working very hard on HTP. Every day for the past 98 days according to Github in fact. Look, I've got proof!


I've been carrying on implementing the tutorial, with a few interesting detours along the way. I've added so much in fact I don't know where to start. Maybe a quick run down on what the tutorial contains will help, so here it is so far:

Implemented:
- Intro
- Give the player their computer
- Port scan a neighbouring computer
- Identify the neighbouring computer
- Hack the neighbouring computer with the provided OS exploit
- Install the provided spam bot
- Go to a neighbouring home network
- Port scan and identify the router
- Reveal vulnerability database on the map
- Download a remote admin vulnerability for the router
- Start developing their own exploit from the vulnerability
- Speed up time until the development is complete
- Return to the neighbouring network and hack the router
- Scan the network to reveal computer and wifi access point
- Identify the switch and wifi access point
- Hack the switch
- Scan the network behind the switch
- Find the computer with the target user behind the switch
- Hack the computer using the OS exploit
- Reveal a software vendor on the map
- Purchase a key logger from the software vendor
- Install a key logger on the computer
- Identify the target phone
- Download a sensitive target file from the mobile using the provided OS remote copy file exploit
- Reveal a data exchange on the map
- Sell the sensitive file on the data exchange

Not yet implemented:
- Return to the keylogged computer and download the newly placed cryptocoin wallet
- Return to the home computer and open the wallet using the keylogged password
- Profit!

There will of course be much more to the gameplay then what is included here, but these will make up the basics, with more advanced gameplay being introduced throughout the storyline.

I've added externally accessible device content, or in other words, websites. These are device's contents that can be accessed without hacking into a network first, and are currently visible as cubes jutting out of the surface of networks.


There are 3 types of websites at the moment. Software vendors, where there player can purchase software. Data exchanges, where the player can buy and sell files (this includes all kinds of files at the moment, including illegally obtained files, but this will be replaced with blackmarket websites in the darknet eventually), and vulnerability databases, where the player can find publicly available vulnerabilities and develop them into usable exploits.

This brings me to the next feature, players can now create exploits from vulnerabilities. These exploits take some time to develop (time acceleration has also been added) and target specific versions of software. Different vulnerabilities have different effects on the target device, some will allow you to remotely copy a file, some will disable the device entirely, and some will grant you full access to the machine, or 'root' access as it's called.

I also completely rewrote the UI system to be totally data-driven, I did this over the Christmas holidays, it was quite boring, but needed to happen, and the sooner the better, as now adding now UI is as simple as whipping up a new JSON file along the lines of this:

{
"Elements":
[
{
"Name": "Divider",
"Layout": "=================================="
}
],
"Arrays":
[
{
"Name": "Cheats",
"Items": ["Complete All Missions", "Lotsa Money", "Complete All Development", "Toggle Instant Processes", "Skip Tutorial", "Unhack Target"],
"Layout": "{ITEM}",
"MenuNavigation": true,

"ActionsOnSubmit":
[
{
"Action": "RunCheat",
"Parameter": "{SELECTION}"
},
{
"Action": "GoBack"
}
]
}
],

"Layout": "Cheats\n{Divider}\n{Cheats}",

"Links":
[
{
"Keys": ["Escape", "Backspace"],
"Actions":
[
{
"Action": "GoBack"
}
]
}
]
}

I've also moved to Unity 5 pro, courtesy of a 90 day beta license gifted to me at a Unity 5 workshop that happened here in Vancouver in December, thanks guys!

Most of the first half of January was spent totally refactoring how software works. Before each type of program had its own source file which defined its behaviour. It worked but wasn't that flexible, now everything is, you guessed it, data-driven. The behaviours and development lifespan of a software product line are all defined in JSON files which look like the following:

{
"Name": "ScanX",
"Category": "Scanner",
"Description": "Brute force port scanner, not very stealthy but gets the job done.",
"Architecture": "x86",
"Tags": ["PortScanner"],

"StartingVersion": 1.0,
"VersionStep": 0.5,
"StartingLevel": 0,
"StartingCost": 50,
"LevelStep": 10,
"MaxReleases": 20,
"CostStep": 5,
"FormatString": "{NUMERIC:F1}",

"ExecutedActions":
[
{
"Action": "ScanPorts",
"MinSpeed": 5, "MaxSpeed": 2.5,
"MinNoise": 10, "MaxNoise": 10,
"MinRequiredLevel": 0, "MaxRequiredLevel": 5
}
]
}

You'll notice mention of 'level' a couple times in there. The game now has a global tech level which slowly increases over time, when the level increases enough, a software's developer will release a new version of it to the public, which can then be purchased (or otherwise 'aquired') and installed, reverse engineered, cracked, etc. I want to make the release and acquisition of things as dynamic as possible. There should be nothing to stop a hacker breaking into a software developer or vendor's network and stealing their latest, possibly even unreleased, software and selling it on the black market. Hackers don't sign NDAs right? Alternatively, if you could get your hands on an unreleased operating system and find a vulnerability in it, you could be sitting on a pretty juicy zero day exploit. But why stop there, maybe if you can create a stealthy enough virus, you could infect said unreleased OS and find yourself will a botnet of thousands created for you. It's that kind of lateral thinking and emergent gameplay I want to make possible and encourage. I want to provide the tools and let the players create their own fun.

My initial goal was to complete the tutorial and get HTP to the stage I can honestly call it a game by my birthday later this month. I'm actually a little ahead of schedule on the tutorial and it should be finished in the next couple days. But HTP doesn't quite feel like a game yet, it's still quite stagnent and static, so I think I'm going to keep myself on my toes and revise that goal to include added some AI to the game. I want to see freelance whitehat hackers aquiring software, finding vulnerabilities in it, and releases those vulnerabilities to the public in vulnerability databases. I want to see blackhat hackers hacking into networks and devices in search of cryptocoin wallets, installing spam and keyloggers, and generally causing mischief. I also want to see average users just going about their life, spending their day at work, and their evenings at home, playing games, shopping online, downloading porn, etc.

I'll leave you with a random image to add a bit of colour. I'll try to update this more frequently so I don't have to pour though my github commit logs to remember what I've actually done in the past 2 months!


Hack the Planet!