User-friendly data tools for my JRPG

Image result for persona 5

I haven’t done a project blog in regards to tech in like forever. In fact, I haven’t blogged in like forever. HI! So yeah I finished Persona 5 (hence the picture) and it took around 90 hours. And that game is a JRPG. And I am working on a JRPG so see it is kind of relevant right!

So today, I am talking about how I am doing some of my data tools. JRPG are giant houses of numbers. It is like your overpacked loft… but instead of the random crap you have collected, it is numbers. And you want to be able to change these numbers all the time for balancing.

As I said before I built a sort of equivalent CMS system in my game. It is the loosest phrase of “content management system”, but as I said in the previous post, I modelled what I was doing by separating data, etc from my work at MediaTonic, who have a quite frankly world class CMS that is hundreds of times better than others I have used. Like I mentioned previously, I make heavy use of scriptable objects:

For some designers, however, double-clicking on the curve and editing it from the editor can be quite cumbersome. And writing Editor GUI code in Unity is quite frankly out of the question, because it is well… horrible… so I came up with a slightly better solution.

Google sheets. In google sheets you can build your data really nicely, view it in graphs and curves to see progression and can be used for balancing.

I came up with a sheet schema as above and then wrote some a little editor script:

And also a static parsing class to parse the data from a csv file to my game data:

 

What the editor script does is add this little button to my battle character scriptable objects:

And uses the parsing code to fill out those curves.

Therefore we can use the power of a spreadsheet program to plot our graphs and then load the data in and apply it to our scriptable object.

Neat, huh?

 

 

Content Management System Inside of Unity

In my professional work we have this awesome web-based Content Management System. In my indie project I do not have this so went about building a similar system directly in Unity using the power of Scriptable Objects. I am making a JRPG at the moment and that needs a lot of content so makes sense right?

Scriptable Objects are an underused gem in Unity and are a great way of storing data. Let’s look at this example:

Here I have a battle character in a scriptable object. I have built a system where I can use Animation Curves to define stats per level RPG Maker style and set up what ability is available at what elvel and all that other fun stuff.

In fact, I have a whole load of similar scriptable objects that hold all my data.

The neat thing I can do here is put these Scriptable Objects into asset bundles

And build them into my Streaming Assets

Now I can upload my asset bundles to Google Cloud, Amazon or Azure and download them when I need.

Cool huh?

Unity Tilemap Tips

In order to make my awesome JRPG I needed some sort of Tile System to create awesome maps. I have some code to load data from Tiled, however, Unity recently added their own system and doing it in the editor itself is much cleaner in my opinion than doing it in an external tool. However, apart from the Manual, there are not a lot of tutorials on how to use it and I found the manual pretty sparse.

The way I wanted to do it is the way I had previously set out with Tiled:

Essentially I wanted there to be 3 layers. Background, Middle and Foreground. However, the docs were not great in showing a way to do that, and inevitably you were not able to set a layer per tile like I had been doing in the past when loading from Tiled. So looking back at Tiled itself, I realised the layers were actually 3 tilemaps. The solution in Unity; create 3 Tilemap objects

 By creating 3 maps and then using the sorting layer to decide the draw order I could essentially have 3 layers like I did previously.

Similarly, as the player character only interacts with the middle layer, I only needed the physics object to be on the middle layer gameobject.

 

The last thing that did catch me out, and is a bit of a pain is having to go through is setting up if the tile is “Walkable” or not.

You essentially have to go to each individual tile asset and select the collider type. Which makes sense to be fair.

There are a load of awesome brushes as well you can grab from here:

https://github.com/Unity-Technologies/2d-extras

Which includes placing Prefabs and Animated Tiles. You do need to grab the Beta of Unity though which is less than ideal.