Sixth update – Progress

36Screen
The main menu

I’ve been gaining a lot of motivation from using Trello and my Changelog script, which has culminated in finally creating the dreaded “Main Menu”, albeit with missing menu items. In the ~13 years I’ve been programming, I’ve created maybe 3 main menus. Needless to say, I consider this a great success.

Making a point system for my tasklist on Trello (easy=1, medium=2, hard=3) and automating the report has helped immensely. I’m now somewhat able to quantify my progress and it feels extremely satisfying putting tasks in the done list. It feels like a game. It has the added bonus of giving me a more precise way of predicting milestones, by comparing how many points I’m getting per week and comparing with how many point are left.

Here’s the PHP script that generates the changelog. It requires labels named ‘Easy’, ‘Medium’ and ‘Hard’ and your cards should all be labeled. It also requires a list in which you put all the cards/tasks that are done.

<?php
$key = "Your Trello API key";
$listID = "The ID of your done list";
$data =file_get_contents("https://api.trello.com/1/lists/$listID/cards?actions=updateCard&fields=name,url,labels&key=$key");
$json = json_decode($data);
$cards = array();
foreach ($json as $card)
	{
	foreach ($card->actions as $action)
		{
		if (isset($action->data->listAfter) && $action->data->listAfter->id==$listID)
			{
			$cards[] = (object) Array(
			'name'=>$card->name,
			'labels'=>$card->labels,
			'dateLastActivity'=>$action->date,
			'url'=>$card->url
			);
			}
		}
	}
$grouped = array();
$points = array();
$labelpoints = array(
	'Easy'=>1,
	'Medium'=>2,
	'Hard'=>3,
);
$fontsizes = array(
	'Easy'=>'75%',
	'Medium'=>'100%',
	'Hard'=>'150%',
);
$fontcolors = array(
	'Easy'=>'#00DD00',
	'Medium'=>'#DDAA00',
	'Hard'=>'#DD0000',
);
foreach ($cards as $card)
	{
	$date = new DateTime($card->dateLastActivity);
	$id = $date->format("\W\\e\\e\k W, Y");
	$day = $date->format("l");
	$grouped[$id][$day][] = $card;
	$points[$id][$day][] = count($card->labels>0)?$labelpoints[$card->labels[0]->name]:0;
	}
krsort($grouped);
foreach ($grouped as $date => $day)
	{
	$point = array_sum(array_map(function ($x) {return array_sum($x);},$points[$date]));
	echo "<h2>$date ($point)</h2><ul>";
	foreach ($day as $dd => $group)
		{
		$point = array_sum($points[$date][$dd]);
		echo "<li>$dd ($point)</li><ul>";
		foreach ($group as $card)
			{
			$size = count($card->labels>0)?$fontsizes[$card->labels[0]->name]:'100%';
			$color = count($card->labels>0)?$fontcolors[$card->labels[0]->name]:'black';
			echo "<li><a style='font-size:$size;color:$color;' href='$card->url'>$card->name</a></li>";
			}
		echo "</ul>";
		}
		echo "</ul>";
	}
?>

The sound of flushing a toilet

Free SFX goodness at the end of this post!

AudioHack
The audio listener is tied to a focal point near the ground, instead of directly to the camera.

This week I decided to work a bit on the audio to make this trailer for shits and giggles.

9 years ago I started making rap music (pretty typical gamedev hobby) and I got pretty okay at composing, mixing and recording and stuff like that. I also spend an ass-ton of money on recording equipment, software and instruments and about 4 years ago I stopped, because of just life happening. So to avoid having wasted a lot of money and time I’ll be recording all sound effects and compose all music for Software Inc. You can listen to stuff I made some years ago on Myspace.

For now, I recorded water boiling for the coffee machine, a refrigerator opening and closing, myself saying “bla bla bla”(not included in download) for meetings, punching on the keyboard, pouring water down a toilet and flushing, and my computer fan.

I had a problem adding the sound effects to the game though, since the only way to really hear them clearly was to position the camera directly above what you wanted to hear, and it seemed pretty unnatural. So I decided to move the listener away from the camera and down to the ground, to where the camera is focusing.

Normally, when I want to do RTS like camera movements, I add an empty focal object on the ground and add the camera as its child transform, pointing towards the focal object. When I want to move the camera around I just move the focal object on the ground. Rotation works by rotating the focal object, so the camera rotates with it, always pointing towards the focal point. Zooming is just moving the camera closer on the local z axis. So, my audio listener hack only required me to add the audio listener as a child transform of my focal object.

Anyway, I wanted to share my sound effects with you, since they were pretty easy to make, but required a lot of expensive gear you might not have. You are free to modify the files and use them any way you want, and you don’t even have to give me credit or anything like that. CC0 license.

Download here

The download is a 400 KB zip file containing 10 .ogg files.

Fifth update – GUI and game mechanic details

For this week I worked a lot on GUI stuff, setting up a pretty big pain for myself when the new version of Unity, and thus GUI system, hits.

Being a management game, there’s a huge correlation between the GUI and the actual game, so implementing GUI stuff also meant implementing a lot of the game mechanics. Here I’ll detail some of the core mechanics. I will start by noting that all software types, simulated company types and name generation files are contained in CSV files, so they can all be modded.

Development cycle

27Screen
Work items(right side) for design documents, alphas, support and marketing is now in the game, completing the development cycle.

I finally finished implementing everything needed to complete a development cycle. Each phase has a little box to the right of the screen, where you can see its progress, as the team assigned to it, is working.

You start at the design document, the trick here is to keep the progress bar in the center, if you do too little, the design document will be worthless, and if you do too much, it will be overly complicated. Both resulting in a reduced amount of achievable final quality.

When the progress bar is the greenest you promote it to alpha. You then assign a team of programmers and artists to the alpha, depending on what type of software it is. When the alpha is done, depending on how uneducated your employees are, a delay phase will start, you can skip it, but that will add a lot of bugs. Finally, the beta phase is entered where the employees fix as many bugs as possible until you actually release it.

When you release the product, a support item is added to the work items. The support item will continually generate support tickets until all bugs are fixed. Ignoring or cancelling the support item will decrease company reputation.

You can market the product through the entire development cycle. If you market it during development, it will create an awareness boost for when the product is released. When the product is released, you can talk to the press to continually add a little amount of awareness or create an advert to unleash a big awareness boost all at once.

Creating products

29Screen
The design document window allows you to choose exactly what product to develop and how to focus it. The bottom right corner hints towards the complexity of the product.

The design document window is where it all happens. Here you get to create the product, which entails some important decisions. First you pick a software type (the name can be chosen manually or generated by clicking the “Name:” label). Each software type has tiers, which control how long it takes to create and how much money it will make. Here I’ve chosen to make a Game with the tier Indie Game, which is the lowest for this software type.

Next you choose the operating system, if applicable. You can add as many operating systems as you like, each also having a tier (Phone, Console and Computer). Each operating system is in use by an amount of the population, so you lose the ability to sell the product by choosing very old, very bad operating systems. Choosing all operating systems for the computer tier will allow you to sell to 100% of the market.

Then you have to balance innovation, stability and usability:

  • Innovation controls how long the product will sell for, since more innovative software is interesting for longer.
  • Stability controls how many bugs the product will have and how many skill points your staff will get from working on it, since stability requires a lot of thought.
  • Usability controls how popular your company gets from releasing the product, since usability increases the user experience.

Finally, each product has its own needs, a game requires a Compiler, a Visual Tool, an Audio Tool and a Game Engine. You have to pick a product for each of these, which will control your products quality and how much you have to pay in license fees. Picking your own products will allow you to avoid license fees. Picking a lower tier product for a need will diminish the quality, so don’t pick a MIDI Editor for a AAA Game.

Software Inc. simulates the market for 10 years before a game starts, so you’ll have a lot of products to pick from. Hopefully, before early access, there will be an event based market on top of the simulation, so that you can edit exactly what companies spring up, which products they release and when. In this way you can have scenarios/missions like: “Buy out EA within 30 years”.

Hiring staff

31Screen
To the left is the window which starts the potential employee search and the right is what pops up after the chosen amount of months.

When you want to hire a new employee you pick a role you want to look for and how long you want to look. Your company reputation and the amount of time you wait will determine how many applicants you get. When the searching period is up or you decide to stop looking, a window will pop up with applicants and their level of education in the chosen role. Here you can use money to remove the 10 worst, like with an employment agency, and you can pay to interview each employee individually, which will reveal all their stats.

Roles include:

  • Lead(Can research tiers and motivate team)
  • Designer(Makes design document)
  • Programmer(Writes alpha code, supports releases and fixes bugs)
  • Artist(Makes art for alpha)
  • Marketer(Handles software marketing)

Any employee that is not a Lead can be set to take any job other than Lead.

Contract work

32Screen
Contract work allows you to make money, without all the risk of marketing a product yourself, but comes with penalties.

Releasing a product is a lot of risk, since you have to support and market it yourself. In the beginning of the game, it might make more sense to take on small jobs that have a guaranteed pay when you’re done. Introducing Contracts!

A Contract will have requirements with regards to total development time and quality. When you sign a contract you will get a small amount of money upfront. When you’re done, depending on whether you met the requirements, you will either receive a lot of money or pay a fine. Each bug the final product has will also issue a small fine.

Building customization

28Screen
Room customization. You can change the color and material of the floor, exterior walls and interior walls.

As a gamer, I’m not particularly interested in superficial customization in games; I like making houses in The Sims, but I don’t care for picking wallpaper and carpets. But since I’ve already added the actual building aspect, that level of customization seemed mandatory.

Marketing

30Screen
Marketing is simple: Decide how much money to use and for how long to design the advert/talk to the press.

Marketing is pretty straight forward. If you pay a lot in a short amount of time, you will gain the same awareness as paying a little for a long amount of time. Advertisements creates more awareness, but only at one single point in time.

How not to handle saving games

I’m a bit wary of serialization in Unity3D. I’m pretty sure everything is gonna break if I just go ahead and serialize everything in one go. I’ve tried using plugins, but they are usually chunky, slow and rarely work. Since I want to release Software Inc. as an early access game, save games need to be backwards compatible, so I decided to roll my own serialization, partly using the BinaryFormatter that comes with Mono/.Net. I’m still not sure whether the save games should be plain-text; if people want to edit save games, they are gonna find a way to do it, anyway.

I wrote a custom dictionary class that returns null if the key is non-existent, so that I can handle missing values from older save games. This can be done with the normal Dictionary<TKey, TValue>, but this makes the code easier on the eyes. Basically you just overwrite the indexer for the class using the syntax:

public TValue this[TKey key] {get; set;}

I then added an abstract class, Writeable, which has methods to serialize and deserialize an object into my dictionary class. It also marks each object it deserializes with a global ID, so that other objects referring to it can find it again. I then use this class to serialize everything that has anything to do with the MonoBehavior class, everything else can be handled by the build-in BinaryFormatter. It’s worth noting that I needed to implement a class to cast to and from Vector3/Quaternion/Color, since these are not serializable by default, luckily they are just a collection of floats.

Finally, I put all my dictionaries in a list and serialize it, while carefully keeping track of the order in which everything is put in the list. Done. Now my code looks like crap, but it works.