Posted on

Sean: Memories

All-right, so I haven’t written an entry for a few weeks. My bad. My time got a bit screwed up by my trip to Tahoe for my uncles wedding. Coincidently, if it hadn’t been for him, who knows if I ever would have picked up playing video games in the first place. One of my early childhood memories is sitting in the soft carpet of an attic, shag carpet covering the walls as well as the floor. Sitting in front of an old 10 inch color tv with fake wood paneling, I distinctly remember playing Quackshot on the Sega Genesis. I think it is safe to say that had I not been introduced to video games at that age or by an uncle that has always functioned more as an older cousin than an uncle. I don’t think that video games would have the grip they do on me. Or maybe they would but not in the way that compels me to want to make them, study them analyze them, understand them and want to make them better. All this from a tiny little computer in an attic somewhere in Cincinnati.

Butterfly effect and all that shit.

Aside from me reminiscing and going to a wedding I also added a few small changes to the character animation tree in Dawnroot. One can now cut objects and have them disappear. At the moment when you can cut chunks of grass they explode into a smoke bomb. Yay programming art! I have also been working with Hadi on a podcast idea that we want to attempt in the very near future. Honestly there isn’t that much else to talk about. Development continues to march forward as close to as planned as not to matter and all I can say is that I am so grateful to my team for the effort and creativity that they have poured into this project.

Until Next Week,

Sean Bacon

Posted on

Christian: Level Editor 2: son of Editor

Just as I hoped, last week has illuminated several bugs, but it also did more. I discovered that my level editor as it stands just isn’t up to the task. The main problem is that it has to step over unity’s built in editor in order to work, which leads to awkward workflow. I can only right click, because left clicking selects objects in the editor, and having a proper GUI takes quite a while to create, because none of unity’s handy UI objects can be used. So, this week I’ll be working on a stand alone level editor, that should be easy for anyone to use, and much faster in general than the one that I built earlier.

Posted on

Isla: Link roundup 9/27/16

For submissions, suggestions, or things to add, send ’em my way: @isla_es.

Videos of the Week: The “12 Principles of Animation” series from AlanBeckerTutorials (@alanthebecker)

Song of the week: Vanilla – Summer (SoundCloud)

Reading material: After extensive preparation, our Kickstarter failed hard. Here’s what we think went wrong. from the makers of Abatron

Excerpt: “Who we are: We are a father son and grandfather team who started making our game 3 years ago. We’ve hired some awesome talent to help speed up the progress and have become like a second family to each other.

The campaign in question: http://kck.st/2bz5z29

How we prepared: We hired a marketing person a year before the campaign launched to help handle social media and spread the word about our game. Posts on forums, reddit, indiedb, etc were kept updated. We also did weekly/bi-weekly devblogs to keep the community active and informed.

By the time our Kickstarter launched, our social media following looked like this:

Twitter – 3k+

Facebook – 12k+

Newsletter – 2k+”

Reddit thread of the week: What do you guys think of 4th wall breaking game mechanics? (OP removed)

Excerpt:  “A few that come to mind:

Eternal Darkness: Some of the sanity meter effects would do things like pretend your console was crashing or someone turned off your TV.

Fez: At a certain point, the game “crashes” and your system “reboots”, going through the splash screens, etc.

Animal Crossing: If you shut your system off without saving to avoid a bad result becoming permanent, you get scolded the next time you turn the game on.” – /u/caltomin

capture

Artist of the Week: Cartoonist -Boulet- (@Bouletcorp)

YouTuber of the Week: Geek Remix (@GeekRemix & @GeekRemixALot)

Podcast of the Week: “Another Castle” (iTunes)

Description:ANOTHER CASTLE is an interview show focusing on creators and thinkers in the New York game development scene. It is hosted by Charles J Pratt and produced and edited by Noah Sasso, with music by Chris Graves (www.kracfive.com) and art by Rachel Morris (www.rachelem-illo.com).”

Random Link of the Week: Click it if you dare

Posted on

Ken: Shifting the goalposts on me

I have been informed that a “conspiracy” has to be something where one group of humans is doing something intentionally to another group of humans. It cannot be something that humans are doing to themselves, or allowing to have happen to them out of ignorance or because they think something is normal.

Alright then, behold my new conspiracy theory:

Very few people control very many things!

My evidence is visual therefore it is irrefutable.

Here is your food providers!

The seeds to grow your food!

Your banks!

Television!

Internets!

Airplanes!

And your media companies!

 

You are all very foolish if you think the things you consume with your mouth and your eyes are very diverse! Look at how much power these big companies and their boards actually have! They are far more rich and powerful and influential than you!

Posted on

Hadi: Back from the wilderness

Hey guys!

Let’s get this journal on the way, should be a short one!

So on my last entry I was hoping to have a pixel logo ready, well things changed a bit. We have started looking for alternate ways of funding Namespace and if this works out I will be extremely pleased.

Other than that I went backpacking near the continental divide. Here are some pictures;

img_1333

img_1320

So these next two should be a lesson to anyone who is too lazy to read a map;

img_1334

You will end up like me thinking the trail goes up, right? No, no, no, it doesn’t……

img_1286

This was my view climbing up the side of the mountain with a 50lb pack. Good times 😀

So there you are folks, that was my week.

Until next time,

img_1297

-Hadi

Posted on

Dre: Journal entry for Dre!

So there have been some developments with the company. Everything has been going well. I have been finishing up almost everything with our initial release and moving on to more artsy stuff.

I’m overall pretty happy with everything I’ve done. The world has been developing in a very positive way. Pieces are fitting together and puzzles have been working themselves out. There are still some small issues to be resolved, but I feel the major things have been addressed. There is still a lot of promotional art to be done and some projects I need to prove myself with, but I’m really liking the progression. I want to be involved in more game play decisions, but that is the next step… Pixel art, level layout, animations… These are on my mind. I have created games before and I think I could be a great asset in these areas.

My main job is as a game designer, so I understand art assets, sound, cohesion, and implementation. I want to be involved in this whole process and think I can improve the product as a whole. We shall see!

-Dretonomy

Posted on

Christian: The prototype

This is going to be a bit of a shorter journal entry, as I’ve mainly done two things this week. I have begun working on the prototype of our first level, and I finished up my tutorial on reflection. I’ve talked with sean and he agrees that I should start on the first level in order to get the game really moving, to see what still needs doing, and of course checking to see that our game is fun. So far it’s been going well, with the prototyping really showing where the level editor could be better. But as the level begins to take shape, I have hopes that the bugs that will be exposed will be easy to fix.

Posted on

Isla: Link roundup 9/20/16

For submissions, suggestions, or things to add, send ’em my way: @isla_es.

Videos of the Week: Baldur’s Gate: Durlag’s Tower – #1: Dungeon Master’s Guide – Design Club” from Extra Credits (@ExtraCreditz) (We recommend watching ALL videos in the “Durlag’s Tower” series)

Song of the week: [Castlevania Remix] – Tears of Blood (Bloody Tears)” by Joshua Morse (@JoshuaMorse)

Reading material: What Cons Are Like When You’re a Famous Cosplayer” by Allison Tierney (@allison_elkin) at Vice Gaming (@VICEGaming)

Excerpt: “I went to Northwest Fanfest in Vancouver, and the afterparties… A requirement of being a guest was that we had to go to this VIP afterparty, and the VIP afterparty was at this club with a clothing-optional room. This club was decorated all like a Turkish bath, and there were people I was guesting with at the con who were just like naked, laying there, and drinking. It was wild; it was the weirdest thing I have ever experienced at a convention. [Full article]”

Reddit thread of the week: Marketing tips from my first 48 hours on Greenlight” by /u/PM_ME_UR_FAVE_TUNE (of “Color Jumper“)

Excerpt:  “It’s been a very stressful past two days, and there have definitely been mistakes along the way, but I wanted to pass along some of the key points I’ve discovered trying to get the word out there.

Post. Your. Link. Everywhere. – This is my biggest fuckup by far. I posted a few articles elsewhere and on reddit and I included a link to the game demo, but not the Greenlight page itself. I am pretty sure I lost out on a bunch of precious votes because people either didn’t see the link or didn’t care to click several times. Minimize the amount of clicks it takes between the user and that “yes” button!

Twitter is simple, Facebook is difficult, both are useful – This isn’t really news to anyone, but it’s worth iterating on. Using hashtags like #GameDev, it is incredibly easy to connect with other users on Twitter. However, Facebook is (in my opinion) a hot mess when it comes to getting noticed. I found that being a part of smaller developer groups on Facebook is a good way to get noticed and votes because things won’t get buried as quickly.

[Read more]”

Artist of the Week: Artist and illustrator Sergle (@serglesinner)

YouTuber of the Week: Darkness (@DarknessJackson) (Who did calligraphy when he was younger)

Podcast of the Week: Irrational Games Podcast

Description: “In any game development studio, you’ll find a bunch of inspired and imaginative people who have a lot to get off their chests. To save on counseling fees, we decided to sublimate these repressed feelings about their gaming lives by sticking a microphone in their faces and creating a series of podcasts that offer an insight into what makes us – and our games – tick.”

Random Link of the Week: Click it if you dare

Posted on

Ken: More of this, then?

It looks like I am to add more of the conspiracies in order to keep my current arrangement. Well that is acceptable. This week, I will not give you a list of many true things, but instead I will explain one thing in many details.

These things are your enemy:

You think I am being silly. I am not!

You see, darkness is good. Darkness is necessary for getting good sleep and being healthy and not having your sicknesses accelerate and if you don’t sleep well and on a natural schedule, you will start to have problems, but the thing is, all human cities are so full of light that you cannot LITERALLY CANNOT have a natural light schedule. There is ALWAYS more light than there ever would be naturally you cannot escape it!

If you follow a normal dark/light cycle, you will be happier and healthier, but if you do not, you will become stressed. So what is happening in cities? EVERYONE is stressed unnaturally ALL THE TIME. There is no rest! You are always exposed to too many lights and sounds and sirens and people and you get no space and no quiet and no rest!

You think it is normal. It is not normal. You think human behavior in cities is normal, but it is not! If you put a bunch of animals like Mr. Scruffles in a place where they were constantly exposed to more light and noise than they would be naturally that would be considered animal abuse! So why do so many humans think that living with THIS:

Or THIS:

or THIS:

or THIS:

is acceptable? You have people on this planet who don’t know what the milky way looks like and thought stars were some kind of POLLUTION!

You are making yourselves unhealthy physically and mentally and you don’t even realize it! Because you think it is light and it’s harmless to you!

… I mean…

… and “we” don’t even realize it….

… “harmless to us

…right.

Posted on

Tutorial: Saving script values in Unity with Reflection

For our project DawnRoot, We wanted to have an interactive AI, Not AI standing in the same spot giving the same lines of dialog every time. Instead, we wanted our AI to move around the world, meet their needs for food, drink, and sleep, and otherwise appear as life-like as possible. To that end, we implemented a system where each action (e.g. eat, drink, sleep, etc.) was its own script. This works quite well as an organizational method, as the actions an AI can perform are limited simply by the actions that they have attached to their game object. However, what we ended up in is a situation in which all actions are derived from a single parent class, but nevertheless have their own unique variables to keep track of. This was fine until it came time to save the AI’s state. Our options were to have either a specific saving function / struct for each AI action, as well as an entry for that struct in the AI’s save file, or to find a way to make a single save method work for all of the AI actions.

It turns out that it is a relatively simple matter to create a general purpose struct for holding script save data, using a feature of C# called reflection.

What is reflection? Put simply, it is the ability for a program to “Reflect” on its own state and make decisions based upon what it finds. For example, Reflection lets you search for variables in a class by name, or get the type of an unknown object. This flexibility comes at a cost however, and it should be noted that reflection is very slow. In our case using it for a function that only gets called occasionally isn’t so bad, but if reflection is needed every frame then your performance is bound to suffer.

With that in mind, let us begin! The goal of this tutorial is to use reflection to create a struct capable of storing the state of any script. While reflection works on any variable, I’m going to restrict the tutorial to covering serializable variables, so that the struct can be saved to disk without any hicups. To test our save method, we’re going to use the following two scripts. Notice that the scripts have no common variables with the exception of the dataHolder, which will hold the save data structs that we create.

screen_shot_2016-09-16_at_11-39-59_am

screen_shot_2016-09-16_at_11-40-16_am

To start, let’s create our files. For the purpose of this tutorial, I’m going to create four files: SaveDataHolder.cs, ScriptSaveData.cs, TestScript1.cs, and TestScript2.cs. ScriptSaveData.cs will be our main script, but the other three are needed to demonstrate how the save system works.

screen_shot_2016-09-16_at_11-48-25_am

Open ScriptSaveData.cs. We will start by adding a couple ‘using’ statements to the top of our file. Add using statements for System, System.Collections.Generic, and System.Reflection. Once done, your file should look like this:

using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Reflection;

public class ScriptSaveData : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

The next step is to change our class into a struct to save our information into.

public struct ScriptSaveData {

	public ScriptSaveData() {
	
	}
}

To save the state of any script, we will need at least two variables for our save data struct. The first is the Type of the action, since we want to be able to store one of any number possible scripts. The second is a collection of all of the variables in the subclass. In this case, I’m using a <string, object> dictionary to store the name of the variable and its associated value.

 

public struct ScriptSaveData {

	public Type scriptType;
	public Dictionary<string, object> scriptVariables;
	
	public ScriptSaveData() {
	
	}
}

Now we are ready to start making the information gathering function. In this case, I’m going to use the constructor function of our save data struct for that purpose. This way, we can pass the constructor an object, and have the save data for that object returned to us. Start by setting up the constructor function to initialize our variables.

public ScriptSaveData(object script) {
    scriptType;
    scriptVariables = new Dictionary<string, object>();
}

It is now time to use our first bit of reflection! To get the type of this action, call the reflection function GetType() after the passed in action like so.

public ScriptSaveData(object script) {
	scriptType = script.GetType();
	scriptVariables = new Dictionary<string, object>();
}

Next up is the meat of the data gathering, using reflection to make a list of all of the variables in the subclass. To do this, we’ll use the GetFields() function.

In C#, fields refer to variables without any accessors, e.g.

public float x = 3.3f;

Properties refer to those variables with accessors, e.g.

public float X {
	get { return x; }
}

The GetFields function can take a number of binary flags to help filter what values to acquire. For our purposes, we want to use the Instance flag, and both the Public and nonPublic flags. The instance flag indicates that we want the fields specific to an instance, and will ignore any fields that belong to the class itself. The Public/nonPublic flags indicate that we want the private fields as well as the public ones. By connecting these flags with bitwise or operators, we can say that we would like all of the conditions during our search. This should return a list of variables for the given script, stored inside a list of FieldInfo Objects.

public ScriptSaveData(object script) {
	scriptType = script.GetType();
	scriptVariables = new Dictionary<string, object>();

	FieldInfo[] foundFields = script.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}

After making the collection of FieldInfo objects, we iterate through it to add the string and value to our collection of variables. Monobehaviours and other unity objects like Vector3s aren’t serializable, so if we store them and attempt to save our struct, we’ll get an error. Therefore we will include some extra code in this case to screen any fields that reference non-serializable objects. To do this, we use the IsSerializable property of the FieldType property. When we have a field that is of a serializable type, we simply get the name and value of it using the appropriate functions and add them to the dictionary we made earlier.

foreach(FieldInfo field in foundFields) {
	if (field.FieldType.IsSerializable) {
		scriptVariables.Add(field.Name, field.GetValue(script));
	}
}

The last step for the information gathering function is to make the struct as serializable. This will make it possible to save this struct to a file, though this tutorial won’t cover the steps for actually doing so.

[Serializable]
public struct ScriptSaveData {

	public Type scriptType;
	public Dictionary<string, object> scriptVariables;
	
	public ScriptSaveData(object script) {
		scriptType = script.GetType();
		scriptVariables = new Dictionary<string, object>();
	
		FieldInfo[] foundFields = script.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
	
		foreach(FieldInfo field in foundFields) {
			if (field.FieldType.IsSerializable) {
				scriptVariables.Add(field.Name, field.GetValue(script));
			}
		}
	}
}

Now, we can save the state of any script by simply creating a new ScriptSaveData instance!

Of course, once we put our data into a serializable format, we also want to be able to take it back out again. We are going to do this by making a new function in our ScriptSaveData struct. This function will take a script as input, and assign the values contained in the save data to the fields the target script contains.

public void LoadIntoScript(object targetScript) {

}

We need to include a check for the right type, because we want to avoid feeding it save data from the wrong script.

public void LoadIntoScript(object targetScript) {
	if (targetScript.GetType() != scriptType) {
		Debug.LogError("Tried to load the save data of a different script");
	} else {

	}
}

From here, we loop through our collection of variables, and assign them to the fields by using GetField(), SetValue(), and the same binding flags as we did to gather them.

public void LoadIntoScript(object targetScript) {
	if (targetScript.GetType() != scriptType) {
		Debug.LogError("Tried to load the save data of a different script");
	} else {
		foreach(KeyValuePair<string, object> field in scriptVariables) {
			targetScript.GetType().GetField(field.Key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(targetScript, field.Value);
		}
	}
}

And that’s it! the actual saving to a file is done by using C#’s serialization class, but this is covered in a large amount of tutorials, so I just wanted to focus on how you can write one save function to save all of your classes. Your final ScriptSaveData.cs file should look like this:

using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
using System.Reflection;

[Serializable]
public struct ScriptSaveData {

	public Type scriptType;
	public Dictionary<string, object> scriptVariables;
	
	public ScriptSaveData(object script) {
		scriptType = script.GetType();
		scriptVariables = new Dictionary<string, object>();
	
		FieldInfo[] foundFields = script.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
	
		foreach(FieldInfo field in foundFields) {
			if (field.FieldType.IsSerializable) {
				scriptVariables.Add(field.Name, field.GetValue(script));
			}
		}
	}

	public void LoadIntoScript(object targetScript) {
		if (targetScript.GetType() != scriptType) {
			Debug.LogError("Tried to load the save data of a different script");
		} else {
			foreach(KeyValuePair<string, object> field in scriptVariables) {
				targetScript.GetType().GetField(field.Key, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(targetScript, field.Value);
			}
		}
	}
}

Now, it’s best to test it out to see if it works! First, open SaveDataHolder.cs and make it look like this:

using UnityEngine;
using System.Collections;

public class SaveDataHolder : MonoBehaviour {

	public ScriptSaveData saveData1;
	public ScriptSaveData saveData2;


}

The purpose of the savedataholder is to provide a temorary place to store the data of the two test scripts. Now, open TestScript1.cs and make it look like this:

using UnityEngine;
using System.Collections;

public class TestScript1 : MonoBehaviour {

	public SaveDataHolder dataHolder;
	
	public int power = 10;
	public float speed = 15.5f;
	public string attackName = "Fireball";
	public Vector3 spawnOffset = Vector3.zero;
	
	
	// Use this for initialization
	void Start () {
		dataHolder.saveData1 = new ScriptSaveData(this);
	}
	
	public void LoadSaveData() {
		dataHolder.saveData1.LoadIntoScript(this);
	}

}

And make TestScript2.cs look like this:

using UnityEngine;
using System.Collections;

public class TestScript2 : MonoBehaviour {

	public SaveDataHolder dataHolder;
	
	public bool active = false;
	public bool hasTarget = true;
	public string enemyName = "Ork";
	public Transform targetTransform;
	
	
	// Use this for initialization
	void Start () {
		dataHolder.saveData2 = new ScriptSaveData(this);
	}
	
	public void LoadSaveData() {
		dataHolder.saveData2.LoadIntoScript(this);
	}

}

The final step is to make a scene to hold all of our objects. Here, I have made a scene with the data holder, TestScript1, and TestScript2 attached to their own objects. I’ve also made two buttons, one each to call the ‘LoadSaveData()’ function on TestObject1 and TestObject2 respectively. Finally, I have assigned the dataHolder object to the dataholder field for both Test scripts using the inspector.

screen_shot_2016-09-16_at_12-42-46_pm

To perform our test, all we have to do is run the scene, and play with the values of the test scripts! On startup each script saves its starting values, and stores the savedata in the dataholder. When we click one of the buttons, the saved data is loaded back into the script, resetting it to its starting values.

reflectionsaving1

…well, almost. You’ll have noticed that I’ve included some unserializable fields on the test scripts. The Vector3 and the Transform are both unserializable, and so are not saved in the save data, and aren’t updated when the save data is loaded. In order to save these values, you would have to make your own custom classes/structs marked as serializable.Then, convert the unserializable value to your custom equivalent, and store the custom value as a field on the object.

Hopefully this tutorial will be usefull as you start to experiment with saving and loading your game!