Monday, November 10, 2014

A Tiny Introduction to Modding The Foundation

The backend work has been intense these past few weeks. Why?

Great Question!

Part of this is of course the nature of storing the mass amounts of data that a simulation produces into an accessible package, but the other half is my determination to expose as much of the game as possible to modders.

I have a strong belief that modding extends the life of a game, however the  wonderful community producing content for the SCP wiki are writers and artists, not coders. They have produced wonderful content, but would likely be unable to pick up a coding language.

I wanted to find a way for non-coders to add content to the game. I found that in JSON. JSON files are text files with a simple organization. Unlike many other data formats JSON is pretty easy to read. Here is an example.
Guess what? That is the most complicated it gets. Lets take a look at some of the Foundation's JSON. This file is full of the data that makes up the world.
This is a portion of the North America region data. You can see it as an array of "countries" (indicated by square brackets) and the top country is the United States (so I suck at alphabetizing... sorry). Inside clearly labeled are various pieces of data the game expects a country to have defined. Changing these changes the game's behavior for that country. You can also see that each country has an array of "cities". Say you want to personalize your experience a bit. Add your hometown. Lets do it.
How boring! Brazil doesn't have any cities much less your Brazilian hometown ;) Lets fix it.
Boom done. There will now be a new city in the game. Because its defined here the game knows its a city in Brazil and will create the city related code and object automatically. In the future there might be more variables that can be defined within a city but for now this is enough.

BUT WAIT! Your city list is below gridSquares when in the US data it was above! Yep JSON doesn't care as long as its present.

BUUUUUTTT WAAAIIT! What if I type something wrong?!?!?!

Well for most mistakes there are free online tools like JSONlint. They will help you like so.

I will also have guides, and hopefully tools to help generate the JSON for you. Its really quite simple and powerful. And will hopefully unlock the potential for every user to tweak the game if they want to.

But does it really work?

Yes. Yes it does.



No comments:

Post a Comment