Welcome to the first article in the series of articles on Adventure Creator focusing on hierarchy and scene structure in your adventure projects. The articles in the series will take form as general best practices and productivity ideas.
Adventure Creator (AC) is a toolkit for Unity which you can use to develop a complete 2D or 3D adventure game without writing a single line of code. But you CAN write code if you like to get any desired custom behavior and maybe some bugs, yummy!
The series will not teach AC basics but is meant as an upgrade to existing tutorials which already have that covered. Hopefully, it will be a helpful toolbox on your first adventure with AC. If we’ve had this back when working on Bear With Me – Episode One, it would have saved us a lot of time. This is basically us sharing what we’ve learned while developing Bear With Me with Unity and Adventure Creator. Since Bear With Me is an episodic 2D game it probably makes this series more relevant to 2D rather than 3D projects.
If you have never used Adventure Creator before, but you’d love to, then bookmark the article and first go through this initial tutorial. Play around with AC for some time. When you have created a couple scenes, NPC’s, items, action lists… come back here to get down and dirty.
You will be able to make the most out of this series if you already have an AC project behind you. Also if you are knee deep in your first project and you are struggling to find that lamp sprite in the scene hierarchy, action lists are becoming huge and hard to manage, you just can’t get that dialog playing in the background, you are trying to think of a simple way to implement a closeup scene… or anything like that.
Project Structure – How not to lose track of what is where?
As a Unity project gets bigger, project folder structure gets tougher to work with and you start to lose precious time digging through your project. It’s hard to name each asset distinctively and memorably so you can easily search for it later. So keeping your project structure clean is important.
This is an example of a “not-so-good” project structure:
As you can see on the picture above, the scroll bar can go even further down where we have some more assets floating around. The folder named “MyAdventureGame” looks promising though. Saving time on project structure management early on just does not pay off, you always lose much more time in the long run when it comes to finding what you are looking for. So what can we do? Let’s take a look.
This is an example of better project structure:
As you can see the highest level has only 3 folders; AdventureCreator, MyAdventureGame and Plugins. We are working with MyAdventureGame folder most of the time. That folder has 12 sub-folders which represent groups of assets in the 2D game when working with AC. This could be brought down below 10 but this is already manageable.
The next images shows how the sub-folder structure looks inside. Again, some folders are too crowded and could be better managed but this is already far better to work with than then the “not-so-good” example which I do not even dare to expand to show you the sub-folder structure.
So this is the basic concept:
- define major groups of assets in your project, for 2D AC project it would probably be something like we did
- define subgroups for each asset group, and stick to it
- we also recommend adding a parent folder suffix to each sub-folder name, which makes the search easier later on.
Also, it might be useful to implement tagging for each asset, maybe a custom editor extension. If we would assign each asset a “scene name” then we could search all the assets for the particular scene quicker and speed up our work when focused on the particular scene. In case of Bear With Me, we thought of grouping assets around the scene so you’d have a scene folder which would contain action lists, prefabs, sprites, etc. for a particular scene. But many assets were not related to one particular scene so we predicted this would get messy.
Scene structure – Preparation is half the work
Same as the project structure, scene structure tends to get messy when a scene holds many objects. You suddenly can’t find that particular sprite. “Was that under geometry parent or movable parent? Wait, where is the geometry parent!?” AC scenes can easily get clogged.
This is an example of a “not-so-good” AC scene structure:
I don’t want to expand all nodes, it does not get prettier. 🙂
And this is an example of a productive AC scene structure for a 2D scene:
One more, now with expanded folders:
Now, the important thing is, scene structure is in relation to how you build your objects in your scenes. For example, NPC’s, items, hot spots etc. The scene structure on the image above goes well with the object structures that we used in our scenes. A bit more on those in the next section.
Also a very useful technique is to use scene templates. A scene template is an empty scene containing elements which are present in every scene of your game.
This is an example of a scene template:
Each time you create a new scene you just copy the template and rename it. That way the structure is already prepared for you when creating a new scene.
So take some time to think about how you will structure your scenes. Create a template that you find useful and well organised and simply reuse it every time you create a new scene.
Scene elements – Combine by logic
This is an NPC object which works well with the scene structure we showed earlier.
The parent object named “Brian” has only a NPC component attached (together with the remember NPC and paths components which come automatically with the NPC component). The parent “Brian” has a “BrianHotspot” child which has a hotspot component attached. This child is parenting markers and interactions related to him.
There is no need to separate the interactions, hot spots or markers under other parents in the scene. The NPC is an object for itself so it holds all those asset groups as children.
We do have a Hotspots parent in our scene though. We only put hot spots which should not be parented under something else, like NPC’s, inside of it.
The essence of it is to not separate elements of one logical unit over multiple scene parents if not really needed.
This is how we organize our scene objects which are not intractable, like background elements for example:
The important thing is to have layers. In this case three layers work for us. Our Player is always in the middle ground layer. Everything we put in the background layer will be behind him and everything we put in the foreground layer will be overlaying him.
The middle layer is where most of the action usually happens. If we want to implement sorting maps with some objects, we put them in the middle ground layer. Let’s say we have a table on our scene. We want our player to be able to move around the table. In Unity, we have defined sorting layers according to our environment structure; Background, Middle-ground, and Foreground. When playing with sorting maps we simply adjust “Order in layer” for our table sprite which we put in the middle layer. This kind of grouping makes scene setup easier.
That’s all for now folks
That’s it for the first article in the series, hope you found it helpful and thank you for reading. If you also have ideas and solutions, please let us know! Throughout the upcoming articles we will talk about more specific stuff like managing action lists, implementing closeups, implementing a map mechanic and much more.
If you have any AC related topic that you want us to cover let us know. Good luck with your adventure games!
P.S. If you want more, click here: Adventure Creator Tips & Tricks – Part 2: Action List Optimization