Monday, October 27, 2014

The World Grid (An attempt to visualize backend logic)

So some people have been wondering what on earth I've been up to with everything simulation related. I haven't had alot of answers and nothing visual to show which has made it difficult for some people to give the feedback and suggestions they wanted to give. So this post is an attempt to explain what I've been working on to make the Foundation feel more alive.

 My early prototype made the mistake of thinking the SCP universe would function like the XCOM universe. SCPs would appear and the Foundation would deal with them much like the aliens in XCOM. However this simply does not fit the SCP Universe. SCPs often go unnoticed for long periods of time. Without the Foundation's proactive searching many of these items would remain undiscovered or fall into the hands of their enemies. I realized my generation system was flawed and went back to the drawing board.

I also needed a way to track the influence and spread of various effects and GoIs (Groups of Interest) as well as a way to quickly find an appropriate location to spawn an SCP. The latter problem might not be so obvious so let me try to illustrate it.
Here is a picture of our beautiful world. A world with 180 units of latitude and 360 units of longitude with a surface 71% covered by water.

Most SCPs are found on land. But attempting to generate latitude and longitude randomly will end up 71% of the time picking a water coordinate. You can just try again but these failures can stack up and get expensive.

So how to keep track of SCP effects? GoIs? Acceptable spawn locations? Areas watched by specific countries? Well there are basically two approaches I came up with. The first is sets of textures where the area of effect and data are kept as colors on individual pixels. This easily solves the area of effect problem and is capable of solving the other problems as well. However, it is really slow unless you are enough of a shader ninja to do all of it with shaders. I am no shader ninja. And shaders hate conditional statements so its hard to test values with them. If not done in a shader the bulk of the work is dumped on the CPU. That poor guy has enough work as it is and texture calculations are not his specialty. So tracking data on textures didn't work out for me.

Which brings me to my second idea and the one I've been working on. The world grid.
Note this is a visualization of the backend. Not actually shown in game.
32 Horizontal columns, 16 Vertical columns, 512 individual squares. Each square can be marked as a land square, given a specific set of coordinates if they are a tiny island like this guy.
Actually known as the Falkland Islands
Each square can hold alot of data. Influence for a GoI, spread of a contagion. As well as the events and SCPs that are currently taking place there. It can also help determine a countries' relationship to the Foundation. Lets take a look at a few pictoral examples. Countries for starters.

Country areas of interest are defined by assigning grid numbers. Here is what America would look like.
 But wait its covering parts of the sea and Mexico! True. However specific spawn locations can be assigned to areas covered mostly by sea. And Countries can share interest in an area. In the real world when troublesome things happen near a border typically both countries get involved. So below is a picture of Mexico sharing some of the same grid squares.

 Multiple countries can be assigned to the same grid square. And if an event happens to move a countries' interest somewhere else they can be assigned new squares to compensate. Say a massive earthquake hits Japan and the US decides they need to help out.
The US adds new grid squares that it has an interest in. If anything happens in these squares positive or negative it will affect the US view on the Foundation.

So what about spreading effects? Well you simply add a percentage. Say we have the dreaded Ebola SCP (not really an SCP)
Not an accurate spread diagram
Some squares register a 100 percent infection while others are far less. The simulation can continuously update the values allowing various effects to spread while the player tries to contain it.

What about GoIs? Its a combination of the two. solid squares where a GoI has control and partial squares where they are working to gain control.

So there you have it. A rough visual depiction how the backend code sees the "world" Note that these visuals will not be in the game for the most part. This data exists in the form of numbers not images so I made these up to explain it better.Some overlays might show this data but even then it will be cleanly masked by the terrain/water mask and won't be so clunky. 

Hope that was informative and interesting. Let me know what you think.


Friday, October 24, 2014

Now on IndieDB


The Foundation is now on IndieDB. Check it out and help promote the game!
The Foundation Windows game

Thursday, October 23, 2014

What is The Foundation?

My favorite games growing up were XCOM: UFO Defense, and XCOM: Terror from the Deep. The base building, the intense tactical combat, procedural maps and the incredible attachment they managed to build to this fictional organization and its brave warriors entranced me and likely inspired my first desires to build my own games in the future.

But as time passed I found life didn't really support or encourage game design as a career. So I set those thoughts aside and went to work for a large corporation developing ecommerce and order fulfillment software. It felt good to tell people what I did for a living, but it was hardly fulfilling or enjoyable.

Then life dealt some funny cards to me and here I am. Trying game development as a new career. I suppose its only natural I turned to my favorite games for inspiration and my favorite wiki.

I found it around the time I graduated from college. A wiki masquerading as a database for a fictional organization called the SCP Foundation. The SCP Foundation secures anomalous and paranormal artifacts around the world, contains public knowledge of these items, and protects the worlds existence from the hazards these items contain. These items are presented in the form of technical documents on the wiki giving a brief description and set of containment procedures to follow in order to keep the object secure.

I fell instantly in love with the wiki and ate up the various articles, stories, and forums that surrounded it. I even tried to write an article but I embarrassed myself upon reading it and took it after a few hours. Lets just say I made a new textbook example for cliche.

Upon this setback I started looking at other options available to me. There were several games that had been made about the wiki but I noticed they focused around the articles and the horrors within. Interesting and terrifying, but something was missing. 

There was no Foundation, only monsters. The powerful shadow organization I adored wasn't really a part of any of these games. So I decided I need to fix that. I would make a new SCP game but it would be different.

This game is about the Foundation.

You take on the role of the newly appointed Overseer of the Foundation. A barely averted XK-Class end of the world scenario has left the Foundation with only a handful of its former assets. Rebuilding the power and reach of this organization falls to you.

You must Secure. Find anomalous events and SCP entities. Customize your armed forces and research powerful new technologies. Dispatch task forces to lock down and retrieve it. Fight off others interested in the same prize.

You must Contain. Suppress public knowledge of the events. Recruit governments, agents, and organizations to fund and support your goals.

You must Protect. Build bases and secure areas to store anomalous items. Stop the spread of anomalous effects. Beware of dangerous containment breaches.

As time passes the beginning hastens the end. Something nearly destroyed the Foundation once. It won't make the same mistake again.

I look forward to discussing this game and sharing the progress that I make. You can follow me on twitter @riscvul or check out the games progress on its trello board: