Wednesday, 11 November 2015

Off Grid Development Update 11.11.2015 - Networking

One more sprint mainly focused on background systems, but this time at least it’s something pretty integral for the game we want to build, and something we’ve been needing for a long time.

Data networks

Most of the work this sprint went into fairly complete overhaul of the data systems we have in the game. This is something we’ve been planning in the background for a while, talking about different data-related game mechanics we’d want to have and trying to figure out what kind of systems we need to build in the game to make them possible.

The new setup is based on actually simulating different networks, 3G mobile data, local wireless networks and so on, and devices that can connect to them. Pretty much all data-related functionalities were moved into a “NetDevice” component, which then handles connecting to different available networks, sending data through them storing metadata like MAC & IP addresses and access levels, and then forwards any received data to whatever system needs to handle it (player inventories, AI components on non-player characters and so on). Of course we have different types of devices based on what kind of networks they need to access, mobile phones for player and other human characters, simpler wireless or LAN devices for drones and any network-connected things, and more custom ones like the one that handles sending random SMS messages to our guards.

Networks themselves act as intermediate for sending and receiving data, they check if a device is allowed to connect to it or not, and decide what level of access each device should have. When an device tries to send a data to another one, it first asks any networks it’s connected to if that other device is available through the network. Networks also deal with checking the access keys of any device trying to connect to them, and variations in signal strength and other similar tasks.

We also modified the DataPoint itself (these are the points of data you can see in the levels, but the DataPoint class itself is actually pretty much our universal representation of any piece of data, be it a text file, SMS message, key data stored on a RFID tag or anything else). Now the DataPoints also store metadata about the network connection used to create the data, which means that any data can be traced back to a specific device and network, and has information about access level required to read or modify that data.

With this sorted out and working, we now have what we need for new data tools that allow the player to send data to any device, and allows the data to carry payloads we’ll need for more complicates ways any device or NPC can react to data they receive.

Of course the networks open some interesting options as well, we can hide data in different wireless networks or behind different access levels, and trace & scan based on networks and device metadata. So we also had to go and modify our “PRISM” program, the part of the component that deals with tracking the data trails of any character. Now it works based on networks and device metadata like you’d expect in real life, so we’ll be able to ask for more specific info from it when we need it. The first use will probably be creating some filters to allow the player to select more precisely what data to display in the game, or track specific device.

…and then was the boring part, going through all our levels, characters, and all the existing systems, scripts, quest scripts etc. and modifying them to work with this new setup. And setting up the networks themselves in levels and making sure every character has a suitable NetDevice with correct access keys, and that any data we need to place in the levels by hand also has suitable network information stored in it. Pretty boring task to do, but the end result is much cleaner and simpler than what we had before so that’s a win as well.

Controlling drones

Following the work we started on drones in the last sprint, we decided to improve a few things and finish some other missing features.

The main change here is that drones now create their patrol points based on DataPoints in the level. They scan the network they are connected to for DataPonts with specific names, and then create a patrol route based on those locations. This means that the player can modify their routes by creating, moving, or destroying those data points. Or maybe just shut down the whole network the drones are connected into…

The rest was mainly about small improvements and bug fixes to AI and navigation components specific to drones, but we also felt like adding some red & green lights to the drone models to make them more visible in the dark skies.

CCTV cameras

Also related to the harbor level we started working on in last sprint are CCTV cameras. We already had the camera models done, but never had time to complete the functionality side. But now that’s done, and we can start adding some security cameras in our levels.

The camera view cones are visible to player in AR view, and when the cameras spot the player they alert any nearby guards. Right now that’s based on the same Noise/Ears system we use for the guards to detect player footstep sounds and other noises, but eventually we’ll probably convert that to be based on data messages instead.

Small fixes & improvements

As usually, we also ended doing some small bug fixes and improvements. Nothing special, most of this kind of stuff was for any systems we needed to edit for the data/device/networks stuff.

  • NPC’s can now (once again) react to sounds correctly

  • Added support for UI scaling based on game resolution

  • cleaned all quest-based functionality from our data/network/UI scripts and moved it into level quest scripts where it belongs

  • Most of the AI components now only display the variables we actually need to edit in Unity’s inspector. Any automatic stuff is now hidden to make things easier to work with.

  • fixed “Patrol complete” triggering on NPC’s multiple times per patrol point if the wait time was too short. (this was mainly issue with drones which don’t need to stop to wait at patrol points)

  • Changed the Random NPC SMS system to adjust message sending frequency based on how many NPC’s there are in the level.

…and finally:

MozFest 2015. You might have seen Off Grid there. In that case, it was great meeting you all! And if you weren’t there, then maybe next year?

That’s all for this sprint, more to come in a few week’s time!

No comments: