Post news RSS DevLog - Designing the World Grid

I try to help visualize the backend logic I've been working on.

Posted by on

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 have. 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 but 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.


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.


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)


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.

Riz

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.