The first 3 weeks of full time developing! Routing System, Products, Products Specs, Products Density. Now each product has its real density in KG/m3.

Posted by on

Hi!

It's been a busy 3 weeks. My last post was 3 weeks ago and I was talking about the 20 weeks I had ahead. Well now I only have 17 weeks for the release. The release day of the Game is May 5th 2015. Obviously the game still has to go through Steam Greenlight.

The last 3 weeks have been crazy we had New Years eve, and the holidays and so on but I still managed to work as much as I could and I accomplished quite a few things.

The Routing system is awesome. It works flawlessly. I'm combining 2 routing systems in one. And it's based on crystals that I place in the terrain. I did some major research on how to do it and evaluated different options at the time. I even created a Reddit Post about it because it was though to do the Routing system nicely and softly on the CPU. Anyways I will further explain myself in a post I will dedicate only to the routing system of the game because I did it from scratch twice and I think the last version is worth a post on its own.

The last week I'm being basically working on finishing all the production and buildings that are left. I added all the products in the game. Also I added to their Density that way I will stack them in the Storage buildings by weight but they will occupy their volume based on the product specific Density.

For each Product I create a price, research their Density, and gave a factor of production

Below find all the products in raw C# code for the ones that like code. Below code is in the Production.cs class

``````    /// <summary>
/// Will load the base price of each prod
/// </summary>
{

//liquids

_prodSpecs.Add(new ProdSpec(P.Nail, 200, 4874, 20));//for ship repairs

//militar

}
``````

The first number in each row is the price, then the density in KG/m3 and then their production factor that I used to determine how much a person will produce of that product. In the class Profession.cs I'm setting that .

``````    /// <summary>
/// Will set the ProdXShift Needs to account on:
/// Age, School Years, Product to produce now, Genre, Tool
/// </summary>
private void SetProdXShift()
{
if (_person == null)
{
return;
}

if (ProdXShift > 0)
{
return;
}
var age = AgeFactor();

var genre = ReturnGenreVal();
var yearSchool = _person.YearsOfSchool;
var produceFac = GetProduceFactor();

//Grown man will prod 4.5KG of wood with 10 year of school
//              (10 + 10     + 30        + ) * 0.09         = 4.5KG of Wood per shift
//              (10 + 10     + 30        + ) * 0.008         = 0.4KG of Weapons per shift
ProdXShift = (age + genre + yearSchool) * produceFac/1000;
}
``````

The formula is really trivial but I liked it and it made sense to me. As of now when playing the game I have found that all profession are fair. The only unfair one is the amount of work for the Builders, as it is now zero.

This week for the 1st time in a long time I found myself playing the game and enjoying it for a long time. So take that as a good sign. After more than 1 year and a half developing SugarMill it becomes hard to say if is fun or not. And since I have all the shorcuts I can spawn 10, 100 guys or do buidings right away.

All the Volume inventory relationship is done. Now as part of an inventory item, everytime the amount is changed it will recalculate the Volume of the item. Chunk of code from InvItem.cs

``````    /// <summary>
/// How many KG of this Item
///
/// Everytime is set.
/// Will recalculte the Volume
/// </summary>
public float Amount
{
get { return _amount; }
set
{
_amount = value;
Volume = Program.gameScene.ExportImport1.CalculateVolume(Key, Amount);
}
}
``````

And my GIT client is helping a lot. I have been using GITHub for basically school projects but for the 1st time I have included it in the game and I must say it's really helpful. Especially when you want to look back and see what code was changed in that moment. So I will stress that incorporating GIT in your projects is extremely helpful. Git Hub Client. One of my best teachers always said that not using Version Control was unprofessional. As a result I now love it.

The same teacher also said "as your code changes and your software matures your LOC (lines of code) grows". Mine is now scoring 19 358. I do try to do everything as clean as possible when comes to code. But at the same time it needs to be legible and understandable if you need to get back to any class or method.

Bill Gates says: “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.”

Thanks for reading. Have an awesome day. And Happy New Year to all!

Hope this year brings to you all you deserve and want!

Cheers!

Thanks for the update. Glad your routing works fine, can't wait for the details :)
Thats a great idea with the density, if I understand correctly, so if one worker produces 10kg wood, you know how much space this will ocupy? So 10kg of feathers are bad for storage :D

Author

So in 1 cubic meter you can store around 500 KG of wood.
The formula goes:
Vol = mass / density
Vol = 10 kg / 500 kgm3
Vol = 0.02 m3
So yea not a lot. Gold is one of the most dense in one cubic meter you can store like 19 000 kg crazy.

Yea the least dense they are, the more Volume they will occupy in your storage. I came with that idea because I grew up in a Dockers family and work my self in a Dock as an IT guys for a long time. The place was just right across were I lived. In that big dock they always were looking after they storage areas in busy times. Other times the dock was really inactive. I'm just reflecting all that in the game. :)

Thanks for the clarification! Nice how events from our lives enter the games sometimes... :)

Author

Indeed the event from our lives shapes our games, no doubt. I'm looking for any kind of feedback on the game. I know is too early but I will appreciate all possible feedback when the game is on steam

When I can find the time I will evaluate it and write my findings in detail. I will be very harsh of course, in the interest of the game ;)