Category Archives: Barotrauma

“Content packages”

(Sorry, no SCP – CB updates yet, you’ll still have to wait some more time for SCP-966)

 

I’ve been trying to make Subsurface as easy to mod as possible. Just like in SCP-CB, all the assets are uncompressed and can be easily edited by anyone. All the characters, sprites, items and things like that are configured in .XML files that can likewise be edited.

The config file of a welding tool

But what happens if you join some server with your modified files, or if the server is running a modified version of the game? I solved this by using a system that I call “content packages” (subject to change if anyone comes up with a better name).

The content packages are basically just lists of files the player wants to use. The game calculates an MD5 hash for each content package based on the selected files, and this hash can be compared between the servers and clients to figure out whether the files match.

contentPackages

Extremely unfinished launcher and a “package manager” used for configuring the content packages

Making sure the files match could’ve been done without this kind of system, just by comparing some specific files and the contents of some specific folders, but that would’ve made switching between different mods and versions a huge pain. Changed a couple of values in reactor.xml while playing the single player mode? Downloaded some mod which replaced some files in the game folder? Ok, you won’t be joining any multiplayer game before all the files are back the way they were.

Keeping the original files in tact is much easier with the content packages: if you want to do changes to a couple of files, you can make copies of them, leave the old ones alone and make a content package that’s using your new files instead of the old ones. Downloading and switching between mods should also be much easier: the maker of the mod can put all the necessary files in some separate folder without the need to overwrite any of the original game files, and create a content package that determines which files should be replaced with the modded ones.

Also, the first pre-alpha version of Subsurface will be out in ~2 weeks!

FacebookTwitterTumblrGoogle+Share

It’s a submarine now

A major change to Subsurface: now it takes place in a submarine instead of an underwater station!

I’ve been turning over this idea in my head for a while and thought it would make the game a lot more interesting, but I wasn’t sure whether it would be feasible to do using Farseer physics. The physics engine can’t handle collisions properly if one object is a lot larger than the other, and moving an object with smaller objects inside it is also somewhat problematic. But I managed to make it work pretty well by cheating a bit (for example, the submarine doesn’t actually move, only the map), and I think it was definitely worth the effort.

Now, instead of sitting in the same spot at the bottom of of the ocean, you’ll be guiding a submarine through procedurally generated caverns and trenches, trying to reach the next outpost/city/station to replenish your supplies and hire some new crew members to replace the ones who got eaten by some eldritch horror.

I think this change will improve some aspects of the game a lot. One thing is that it creates a much stronger sense of progression. Earlier, I would start the game, go about my daily routine for a while (fixing anything that needs fixing, making sure everything is running smoothly), waiting for the inevitable disaster to strike. After the situation had been resolved, I’d repair any damage and basically start from over again. I’d also gain better equipment and gather a more competent crew as the game progressed and the difficulty level of the random disasters went higher, but it still felt like I was going nowhere. Okay, I survived through that shift, lets start another one and have another monster wreck everything again.

How the game works now is somewhat similar to FTL. You have this large map with dozens of different beacons outposts, and you travel from one location to another through the aforementioned procedurally generated levels. I think it immediately gave the game some of that much needed sense of progression: you aren’t starting another round just to get through another round, but to make your way to the next location while exploring a completely new area with who knows what between you and the destination.

The “overworld map” – extremely bare bones at the moment but it shows the basic idea

At the moment the outposts are nothing more than points on the map with some creative name (such as “Location 985″), but obviously there will be more to them in the future. Some could be cities where you can hire new crew members or sign up for some kind of quests (“kill the enormous squid thing that’s stopping our ships from using some passageway”, “go to Place X and salvage something from a sub that sank there last month”). Some could be military outposts where you can buy weapons, ammo and explosives, or research facilities where you can buy cool new tech. Or remote underwater facilities that had gone completely silent some time ago after broadcasting a distress signal.

level

Random level (voronoi graphs ftw)

 

Having the game take place in a submarine also allows a wider array of things that can go wrong. Breaking the reactor and running out of power doesn’t just mean that the lights go off and oxygen generators shut down, it means you’re stuck at the bottom of some uncharted cavern until you fix the reactor or come up with some other way to power up the engines.

Navigation and steering the ship are also a new cause for potential disasters (as seen in the Youtube clip).

 

Internship & new Subsurface footage

A small update on what I’ve been up to lately in addition to SCP-CB v1.1:

The Computer Sciences degree I’m currently doing involves three 10-week internship periods and last week I started doing this years internship at a cool little game startup called FakeFish. They’re working on a game called Northbound, a really interesting story-driven RPG game based on the Finnish national epic Kalevala. Expect adventures in the northern wilderness, puzzles, tactical combat and exploring the Finnish folklore that ranges from comfy to horrifying and from odd to batshit insane.

Subsurface is also progressing nicely: it’s gradually starting feel more like an actual game and the multiplayer is now working well enough that I’ve managed to run a couple of online multiplayer sessions with a handful of players. Anyway, here’s a clip of what the game looks like at the moment:

As for when you’ll get to play it: I’m hoping on releasing the first public alpha version of Subsurface in one or two months from now.

Wiring and signal processing

Subsurface now has wiring and signal processing mechanics similar to the ones in Space Station 13. For those of you who aren’t familiar with SS13, think redstone in Minecraft. Basically different constructions/items can send various signals through wires to other constructions, and with some logic gates and other components you can built pretty complicated contraptions.

Here’s a clip of connecting a button to a door – I think I’ve managed to make the system a little more intuitive than in SS13:

 

You just have to equip a screwdriver to open the “connection panel” of the item, and then equip a wire and drag it to the connection of your choosing. In this case “signal_out”-connection of the button, which just sends out “1” when someone pushes the button, and “toggle”-connection of the door which toggles the state of the door whenever it receives a signal.

At the moment there aren’t that many components to use in the contraptions, just basic logic gates (and, or, not), but at least the following are to be added soon:

  • “signal comparer”: sends out “1” if it receives a signal matching to some user-determined string
  • “voice processor”: whenever someone says something in the vicinity of the component, it sends out what the person said as a string
  • “speaker”: reads the input it receives out loud (not using a speech synthesizer though, the message just appears in the chat box at the lower right corner of the screen)
  • “wifi component”: sends out the signal it receives through an user-determined a wifi channel – can be used to send data remotely
  • probably something similar to the RegEx components in SS13 in case you need to analyze an incoming signal in a more complicated way
  • obviously something that can be used to do some damage – maybe a detonator which can be connected to whatever explosives you have available

So, what can you do with these? Here’s some ideas:

  • a system which only allows a door between an airlock and the facility to be opened if the airlock is free of water, and prevents either of the doors to be opened if the other door is open
  • a voice prosessor in a command room, which shuts down every door in the facility if it hears someone saying “SHUT DOWN EVERYTHING”, or some secret phrase set by the captain
  • a system which analyzes air quality through the facility and isolates sections that are running low on oxygen
  • shutting down non-vital devices/systems if running low on power
  • functional computers (I’ll be disappointed if we won’t see anyone build a tic-tac-toe game inside Subsurface)
  • a number of detonators and explosives hidden throughout the facility, connected to wifi components and signal comparers allowing the detonators to be activated remotely using some secret phrase – or the moment any of the players says “lol” in the vicinity of a voice processor


Some men women just want to watch the world burn drown

Harpoon

Two clips of a little addition to Subsurface:

As you can probably see, it’s still a work in progress, but already pretty fun to play around with.

Also, if any of you are wondering about the release date SCP – Containment Breach v1.1; the release of Containment Breach – Run has unfortunately been pushed back a little and as the plan is to release v1.1 along with it, it will still be a while before it’s out.

Networked physics with Farseer & Lidgren

In addition to SCP-CB v.1.1, for the past few weeks I’ve been working on the networking part of Subsurface (physics in particular). It turned out that the way I’d implemented framerate-independent physics made it almost impossible to keep the networked clients in sync, but after some modifications everything seems to be running smoothly even with high latency.

Previously I was using a variable timestep, which basically means that if the game is running at 50% of the preferred framerate for example, we’ll just move everything twice as fast each frame. This worked somewhat acceptably in single player mode, but the problem was that the behavior of the physics simulation wasn’t 100% consistent on every framerate. As the framerate dropped and the timestep increased, the physics and the animations of the characters started to get a little “off”, and with a large enough timestep, the physics joints would just go crazy and the characters would basically explode. The physics seemed to work fine on framerates above ~25 though, so I just limited the timestep so that the game doesn’t try to compensate the dropping FPS too much and break the physics.

When I started testing on syncing the physics between a server and client, it turned out the variable timestep just doesn’t work. Even though the physics looked consistent on framerates above ~25 FPS in the single player mode, the slightest differences between the two simulations would cause them to get out of sync. An item hits the ground in a slightly different angle in one of the simulations, bounces off to a different direction and ends up in a different place than in the other simulation.

After some googling I found this fantastic article about fixed timesteps. The technique described in the article wasn’t hard to implement, and now I have a physics simulation that behaves the same no matter what the framerate is.

I took some shortcuts and simplified the way the physics are synced between the clients. The characters or any other physics objects that can be manipulated by the players don’t collide with each other, and this isn’t an FPS game where it can be crucial if a character is “actually” in a slightly different position than it appears to be on your screen, so I decided to skip latency compensation altogether. This means that the server and other clients are always a little behind a client controlling a character (you can see it in the second half of the youtube clip below). As there is essentially no way for a client to collide with or otherwise manipulate any of the other clients, at the moment it doesn’t make much difference. The only case were it could be noticeable, would be if two players were trying to pick up an item at the same time: it might look like you picked it up first, but actually the other player was closer to it and his key press arrived to the server before you, in which case the item would be pulled from your character to the other one as soon as the “player 2 just picked up that item (not you)”-message from the server arrives.

There will be various weapons (or tools that can be used as weapons) in the game though, so this kind of simple system might turn out to be insufficient in the future in which case I’ll have to implement some kind of latency compensation, but atm it works great!

 

Animation stuff

In my first post about Subsurface, I mentioned “a procedural animation system which takes care of animating the characters (which are ragdolls run by Farseer)”.

Early on I decided that I will be using ragdolls simulated by some physics engine to get the characters thrown around by water bursting through a hole in the wall or dragged around by water flowing from room to another. Letting the physics engine take control of the characters when a water current is too strong or a jet of water hits them hard enough, but how would I get the characters to react to the water when they’re controlled by the player, not a ragdoll thrown around by the physics engine?

I decided to let the physics engine be in control of the characters constantly: the characters are animated by applying varying amounts of forces to their limbs. Thanks to this, they automatically react to the world around them. For example, a water current exerts a force on the limbs that are underwater, making the characters struggle to move their legs against the current, and carrying something heavy affects the posture and walking speed of a character.

Here are some clips of the current state of the animation system. It’s still a work in progress – as you can see, the movement is still pretty comedic at times (QWOP, anyone?) and especially turning around looks really unnatural.










Here’s also a clip of our hero trying to shoot a placeholder monster with the placeholder turret he just loaded:

Some concept art

 

Good news: James Bear (“Moonsaber”), the artist behind the monster in SCP-860-1 and a ton of concept art for SCP-CB, will be taking part in the development of Subsurface by creating concept art and sprites for the game!

Here are some of his sketches of potential inhabitants of Europa:

HaXWyHn vDgeZwB

I also shared my thoughts about some of the features of the subsurface ocean with him, and did a quick sketch of what the environment might look like, and they might be worth posting here as well:

ocean

(the creature in the background is a WIP sprite by Moonsaber)

[The area around the facility]
The facilities will be located inside large cracks in the ice, close to the bottom of the ice sheet (see pic). The actual bottom of the ocean is supposedly somewhere far below the facility and the ice formations around it, but it can’t actually be reached in any way. So there’s just this enormous abyss below the actual gameplay area with plenty of space for mountain-sized monsters to swim around.

[Temperature of the water]
I think the temperature of the water should be around the same as in Earth oceans or a bit colder. I’m not 100% sure yet whether temperature should be a gameplay element or not: having to worry about the characters getting hypothermia if you don’t get them out of a flooded area fast enough might add some gameplay value, but in most cases drowning or being crushed by the pressure are more prominent threats and maintaining a comfortable room temperature might easily become just a tedious chore. But in any case, I’d imagine the temperature being somewhere around 40-70 F.

[Amount of light under the ice]
The ice layer is apparently at least a couple of miles thick in reality and should be very thick in the game as well for it to be stable enough to build any habitable structures inside it. No light should be able to penetrate it in that case, but I think it’s necessary for there to be at least some amount of light in the game. It would be pretty frustrating to get a completely black screen if you’re outside the facility in a diving suit and your light source breaks or runs out of power. And it wouldn’t make sense for any of the creatures in the ocean to have eyes, if their habitat had absolutely no light.So, there should be a little light there, just enough to barely see something moving near you if you don’t have an extra light source. I think it could be explained by saying that there are some kind of bioluminescent bacteria or something living on the ice.

Subsurface

I’ve been turning this game concept idea over in my head for maybe year and a half, and now that SCP-CB v1.0 is out, I’ve started putting more focus on it. Some how the fans of SCP-CB might be disappointed to hear that it won’t be a horror game (although I’m confident it’ll still provide some tense moments to get your heart pounding), and even more disappointed over the fact that it will be a 2D game. I hope you will be able to enjoy it nevertheless, even if though it will be something very different from SCP-CB.

Anyway, the working title for the game is Subsurface. It takes place a few hundred years in the future, where a bunch of human colonies have been established deep inside the icy crust of Jupiter’s moon Europa (due to the deadly amounts of radiation on the surface). The vast subsurface ocean under the crust is used as a transport route between the colonies and a source of natural resources. There are also a number of underwater research facilities / defence outposts established near some “transportation shafts” leading from the colonies down into the ocean, and the game will be taking place in one of these.

In a nutshell, the player’s job is to keep the facility operational, while carrying out various tasks to earn funds for buying supplies and hiring new crew members. The enormous pressure outside the facility is not the only threat, since (not so surprisingly) the ocean is full of different kinds of life forms, from harmless little creatures to colossal Lovecraftian monstrosities. Replacement parts and other supplies are also extremely hard to come by in Europa, so the facility is filled to the brim with makeshift equipment and future equivalents of duct tape repairs, and things are guaranteed to break every now and then (powering down the lights in some part of the facility if the player is lucky, or blowing up a 10-foot gap in the pressure hull of the reactor room if not).

The player can control one of the crew members at a time and switch between them at will. The characters not controlled by the player will be controlled by the game’s AI.

The gameplay is split into days or “shifts” which last about 10 to 20 minutes, during which a random event (or several) will take place. It can be a distress signal coming from nearby the facility, a gigantic sea monster appearing, a crustacean swimming into and breaking the cooling pumps of the nuclear reactor powering the facility, something breaking through a window in the medical bay and disappearing into the ventilation system or a swarm of strange, leech-like creatures attaching themselves to a window in the control room, somehow starting to gnaw their way through the glass. In addition to the scripted events, there’s a number of other things that could go wrong: if the player tries to weld a leak using a weapons expert who doesn’t have the skills to operate a high-pressure welding kit (because all the qualified personnel died during the last round for example), it might cause further deaths and damage to the facility, or if the player is putting too much stress on the nuclear reactor, it might lead to a meltdown.

When the shift ends (after the set time period or when the player has taken care of the random event or other problems that arose), the player will receive an amount of money depending on his success during the shift, which can be used to buy new equipment, supplies and hire new crew members for the next round. If the player is unfortunate enough to lose the entire crew, it’s game over.

TL;DR: sort of like Space Station 13 with a hint of Dwarf Fortress, in the setting of Pressure.

Q&A

Game engine?

No Blitz3D anymore! Now I’m using C# and Monogame. The physics of the game are handled by Farseer, and the possible multiplayer features by Lidgren. The game won’t be a Windows exclusive like SCP-CB, since Monogame also supports Mac and Linux.

Multiplayer?

This is still a bit of a question mark, but it’s possible that there will be an online multiplayer mode. I haven’t got much experience in network programming, so I’ll definitely need help further down the line to make it happen, but I’ve actually already written a functional server/client-system for the game using Lidgren, which is capable of syncing the characters between clients. I’ll focus on making the single player mode playable before delving deeper into the multiplayer mode, but I’m also trying to design the code in a way that would make multiplayer integration as easy as possible in the future.

Modding

Even though I’m not planning on releasing the entire source code like I did with SCP-CB, I will be putting a lot of effort into making this as moddable as possible. All the graphics and sounds will be unpacked, so they can easily be edited by anyone. I’m also trying to avoid hard-coding any content as much as possible: a large part of the game logic and content will be in easily editable Lua scripts and XML files.

Will it be free?

This won’t be a freeware game, but I will keep releasing alpha- and beta-versions along the road for free just like I did with my previous games. I can’t give any accurate estimates to the possible price tag of the finished game, but if everything goes as planned and I don’t have to cut down on the admittedly ambitious feature list, I think something around 5 dollars might be a reasonable price.


 

As to what state the game is in now: So far I’ve mostly just been thinking through the design details of the game and how I’ll go about implementing them; Couple of years of struggling with the code of SCP-CB, a house of cards built on ad-hoc-spaghetti, has shown me the importance of planning beforehand, which is why this time I’ve put some serious effort into thinking through the details and scope of the project before starting to actually make it.

The design and planning part is starting to be in a pretty good shape now though and I’ve gradually started putting those plans into action. Here are some of the things that I’ve implemented so far:

  • the “backbone code” for handling things like different screens, player input and in-game entities (physics and rendering)
  • a (still unfinished) procedural animation system which takes care of animating the characters (which are ragdolls run by Farseer)
  • simple water physics, which simulate pressure, waves, water flowing from room to another and drag+buoyancy exerted on the game objects (like characters and items)
  • breakable walls
  • the base classes for “dynamic map elements” which can be interacted with, such as ladders, doors, control panels and levers (although the only actual elements that I’ve implemented so far are ladders and doors)
  • a simple map editor
  • a really basic server/client system which I mentioned earlier

And here’s what it looks like now with some placeholder graphics (the second picture is a quick mockup of how it might look like with some lighting effects):

sbmr sbmrmu