• Register
Post news Report RSS SugarMill : Dev Log 8 : 20 weeks

A short summary of what I did in the last 20 weeks. SugarMill was greenlit by the Steam community.

Posted by on

Hi everyone

Roughly 20 weeks ago I announced I began working on SugarMill full time. Here I am 20 weeks later with the game pretty much done. Have been working with a lot of stuff and this is a short summary of the things I addressed:

  • Performance
  • Bug Correction
  • New Art
  • Greenlight Campaing
  • New Routing System
  • Trading System
  • Ships


Past Fears

The things I feared the most was the performance of the game. I initially wanted to put 10 000 citizens in the game, each with their daily routines, works, schedules, church time, relax time etc. But I ended up making a test with 1000 that was inconclusive and then 500. The game can accommodate 500 citizens at 60FPS HD no problem in my PC. My PC is 3 years old, hopefully majority of people can play it at 60FPS.

I could certainly keep working on performance and stretch it to 1000 and maybe into 1500. However time is something we don't control, and its gone now. I spent 3 weeks improving performance of the game and learned alot.

Slowly understood that I only had 16.66 ms for each frame to target the 60 FPS, it was a learning curve that I am more than happy to explain. Understanding the Unity Profiler completely took me for a ride also. I have to say that is awesome and does help a lot. Thanks to the Unity Team one more time for their awesome job.


Professions:

At the moment the game has 9 different professions. They all inherit from a base class that is Profession.cs and they all work alike.

Builder:

The builders ask to BuilderManager.cs if there is something to build. BuilderManager will give something that already has been greenlit by the game. This means that all the resources are available and all citizens check their routes and updated them consequently if needed. This is to avoid citizens walking inside buildings and so on. Once BuilderManager give a string:MyId they will look up the building in Registro.cs and will route there. They work in a building called Masonry.


WheelBarrower:

They are really like the Builders, the only difference is that they ask class Dispatch.cs what is up so they can work. Dispatch will return to them an object of the type Order, and Order is composed of an OriginKey and DestinyKey, an amount and a product. Then they can route there, pick the object go back and drop it at the Destiny. I must say that wheelbarrowers can carry up to 4 times what a normal worker does and they do use their wheelbarrows. Once you run out of them you need to produce more wheelbarrows at the Carpentry, otherwise they will not carry as much.

Farmer:

This class is really simple as it doesn't need to do any routing since the farming work is done within the boundaries of the farm. Once they are in there they create a random route inside the farm. Once they are in the last point they play the 'isHoe' animation and spawn a hoe too.


FisherMan, SaltMiner:

This class is really the same as a farmer. They work exactly in the same way.

Forester:

By far the profession I have spent more time in. As each tree is in a different place and they have to replant the trees, its quite fun being the forester. At the moment it's working perfectly. Foresters in SugarMill are really important as the wood is a basic need for everything in the game.

Homer:

Really complicated class. As all classes drop their produced items in the storage what brings they back to Home is the Homer.cs object. Every call from the profession objects is done in a different way.

Insider:

The easiest class by far. This class is for all the professions that work inside a building such as an Foundry worker, Teacher, Carpenter, etc. It is as simple as let the time run a bit while the citizen is inside the building and before leaving produce the good based in various factors.

Routes Cache

Really important caching expensive computed objects. TheRoute.cs is the object I finalize each route and they do have a few properties but the more important are the CheckPoints. Each CheckPoint has a few attributes:

public class CheckPoint
{
    private Vector3 _point;
    private Quaternion _quaterniRotation;//this is the rotation needed to be in the exact good position
    private Quaternion _quaterniRotationInv;
    private bool _inverseWasSet;
    private float _speed = 1f;

    public Vector3 Point
    {
        get { return _point; }
        set { _point = value; }
    }

    public Quaternion QuaterniRotation
    {
        get { return _quaterniRotation; }
        set { _quaterniRotation = value; }
    }

    public Quaternion QuaterniRotationInv
    {
        get { return _quaterniRotationInv; }
        set { _quaterniRotationInv = value; }
    }

    public bool InverseWasSet
    {
        get { return _inverseWasSet; }
        set { _inverseWasSet = value; }
    }

The position is the world-position of the Point, the QuaternionRotation is the rotation of the person and the QuaternionRotationInv is for the return trip through the same route. InverseWasSet marks if the inverse rotation is being defined or not.

At the moment the Project is scoring 24 000 LOC. I have being working on this for so long that I can't remember how I started.


The progress of the game through the last 1.5 Years

Date: April ‎14, ‎2015


Date: ‎October ‎5, ‎2015


Date: Mar 12, 2016


What I wanted to get done and couldn't

I did want to have it on Early Access on May 5th. However I want to make sure the game is playable and as bug free as possible for the that. I prefer to have it completely bug free when release on Early Access and that's my personal goal.

The art might still need a lot of work, most likely the game will be missing a lot a features but I want to make sure that all bugs I know off or can detect will be corrected.

The good

I have learned a lot about Unity and C# I could say I know more now that when I started and I still have so much to learn. However if you are reading this and think you want to become an indie developer go for it. I would recommend to start with a simple project so you can learn the basics of the Engine and some programming as well, the most important thing is that at the end you publish your game somewhere.

Once more thanks all. I was astonished when saw it took less than 2 weeks to pass Greenlight. Thanks seriously all.


SugarMill is heading to Early Access sooner than later. Keep the tune.

Thanks for reading and have an awesome week!

Happy mothers day!

Post comment Comments
saintworks
saintworks - - 17 comments

Awesome article - thanks a lot! Keep up the great work and I'm already looking forward to play it!!!
You mentioned that you are using the Quartenion functions and working on performance - I did not check that up, but usually Unity imposes some overhead to run such "in-engine" stuff on the main thread. Eventually, if you take the good old Vector3 calculation this might help to improve performance, if you outsource that to a separate thread - but as mentioned, I'm not sure how much performance improvement such an action would have.
Don't forget the tutorials and ingame hints (OK - it's a insider joke ;-).

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: