Eighth Update – Personalities

I’ve just finished implementing the personality system in Software Inc! The personality system is a graph of personality traits, describing their relationship with each other and their attributes. Each employee in the game gets two personality traits.

The graph is of course moddable, so you can add traits and decide their attributes and relations.

Screen7M4

I’ve illustrated a tiny piece of the current graph in the image above. The circles are personality traits, the color of the arrows between them indicate how they regard each other, the colors of the rows in table next to the circles illustrate how a trait influences the employee and the color of the circles indicate their compatibility.

As an example, say you have the mean trait, then you will have aptitude, bad leadership skills and average diligence. Being mean also makes you dislike people who are generous and optimistic, and feel indifferent towards people who are pessimistic. Finally, if you are mean you can also be pessimistic or optimistic, but you can’t also be generous, since the mean circle isn’t blue or green. Note that this is not necessarily how it works in the real world, but the point is to give the player an intuitive sense of an employee based on her personality traits and these relationships are subject to change.

Screen6M4
This is how the employee detail screen currently looks. The personality traits are written in the top left corner.

So what difference does having personality traits make? When you put an employee on a team, her traits will be weighted against the other members of the team, determining how well she works together with the other members. If she dislikes a person on her team she might get angry and want to quit. Overall bad team compatibility will have an effect on your employees’ work quality, but a good team leader can alleviate the problem.

So what does aptitude, leadership and diligence mean? Well, each personality trait changes the characteristics of its employee, which affects their stats and behavior in the game. Currently aptitude, leadership and diligence are the only three characteristics, but the system allows me to expand these at any point, although they are not moddable. Aptitude controls how quickly an employee gains skills and education, leadership controls how well a leader does his job(research, employee satisfaction, etc.) and diligence controls how late an employee is and how often the employee calls in sick.

Development Progress So Far

Screen1M4

So this is how progress looks so far on Software Inc. There are huge spikes and rapid drops. The big spike in the beginning was due to a week where I had no obligations, it makes me wonder how quickly I would be able to finish this game if this was a full-time job. Probably less than a year, I’m sure.

I had a quick trip to Italy with my wife and didn’t bring a laptop with me, so that explains the first drop. Currently, I’m earning my bachelor degree in Computer Science and I will be done around May next year. I also work a part-time job at a pension company, but my job has had little to no impact on the amount of work I can get done, but my classes are draining me completely. I only have a couple of courses left and my thesis, but I’m just not motivated to finish it. It feels like I’ve finished all the interesting courses and now I’m just doing it to have something on my resume. So work on Software Inc. will be a little slow for the next six months, in between holidays. I’ll scramble to get it polished before the demo I have planned this month.

Screen2M4

Here is one thing that surprised me, though; during the current slow period the average amount of work I complete on Wednesdays has kept pretty steady compared to the other days. On Wednesdays I have 4 hours of waiting for the next class to begin, so I sit in a canteen and try to get a little work done on Software Inc. and it has proved extremely valuable. Which just goes to show that a little work on a regular basis can have a huge impact, although it doesn’t feel as significant as the big sprints, but the sprints have probably helped in keeping the Wednesday-average high to begin with.

Seventh update – Office management

A lot has happened since the last time I wrote a blog post, changes have been made. The changes have focused on managing the office life and on the GUI.

Screen2M3

The visual style is starting to come together, in the above picture you can see a green outline around the selected room. The trees really make the scenery come to life.

Screen6M3

I implemented a stock market. Initially I just wanted a “buy company” button, but this adds so much more depth. Basically, you can sell shares of your company to avoid paying interest on a loan, but giving away too much of your company will affect your company productivity.

You can also sell and buy stocks from other companies by observing their product life cycles, to predict when their income will have an upswing. If a company loses 100% of their shares, the company with the largest share will win the company’s products and the rest will get their stocks refunded.

In another update you will be able to create sequels to all your products, which will add a big bonus if done right. So taking over companies and their intellectual property will be very profitable.

Screen1M3

Here’s a screen of a lot of GUI. I have implemented staff; employees work on products and the staff will make sure that the employees have a good working environment.

Cleaning staff will dust off foot prints on the floor, which will increase the room environment and in turn increase employee effectiveness and janitors will fix broken stuff so that the employees can use it and enjoy doing so. Later I will add IT staff to fix computers and chefs to cook food.

Screen4M3

Screen3M3

Employees have also developed thinking and demands, specifically they can demand a raise when they are not satisfied with something.

In the second picture we can see that not having a toilet can be ignored if your pay is increased by 78 dollars per month, which is extremely realistic, if I have to say so myself.

Screen5M3

Finally, I have improved work items(design document, alpha, marketing, support, contracts, etc.) in the GUI. Before, they kind of took up most of the right side of the screen, but now they can be collapsed and pinned to the rooms of the teams working on them. They can actually be dragged directly on to a room and the team in that room will begin working on it.

I have also enabled multiple work item per team, each item will be given an equal amount of time from each employee, thus slowing down. If there are too many work items per team the employees will complain.

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.

Randomization = Super Sausage Corp.

This week, wanting to mix things up, I decided to focus on some superficial random generation. Always fun! So I worked on a random name generator, that I will be using to generate company and product names for the competitors in Software Inc. and an employee generator, which basically means I colorize and combine faces/hair/jackets/pants in to one texture, so that each employee looks a little unique.

Employee generator

25Screen
So creepy…

The employee style generator, or creepy-on-the-fly generator,  is basically a quick shader I wrote for Unity (which can be downloaded here) which starts with a base color, which is the skin color, and then adds layers on top of the base color, each layer being colorized individually. Specifically, the layers I add are textures for the face, hair, jacket (or blouse or what have you) and pants, and each of them has an alpha channel, so that they don’t overwrite the previous layer. I then have a class which keeps track of all the textures for each group and assigns them randomly.

The texture class also has Gradients for the skin, hair, jacket and pants to determine which colors can be used to colorize the textures and, effectively, which colors are more likely, by how much space they take up in the gradient. Gradients in Unity are extremely cool and allow you to visually edit color gradients to use directly in your scripts, I really recommend that you try them out!

The generator is far from finished. If I get someone competent to model the employee, I hope to use BlendShapes to morph the model between skinny/obese and woman/man. Currently, there are only male looks, not because I’m being sexist, but female hair is just harder to model and texture.

Name generator

Names
Screw Coredumping, Super Sausage Corp. sounds way better!

My random name generator uses a tree like structure to generate random strings of words. A generator can be loaded from a file with a very simple structure, eg.

-start(base)
-base(base2,end,stop)
Hello
Hi
-base2(end,stop)
, you
-end(stop)
.

Will create a generator that can generate the strings:
Hello
Hi
Hello.
Hi.
Hello, you
Hi, you
Hello, you.
Hi, you.

It works by starting from the first node start (nodes are the ones with a hyphen in front of the name), it appends a random string from the list of strings below it (in this case there’s nothing to pick), it then picks a random node from the parenthesis of the current node (which can only be base in this case), and then it continues until it reaches the node stop.

I then have a generator for each type of software and for the companies. It’s a very simple algorithm, and as you can see in the picture above, the results can be pretty dumb, in a good way. The source can be downloaded here.