Project goals for this month

Hello there!

It’s been a while since I wrote something about Simulation Pills. But to reward your patience I’ve decided to give you peek into whatever I am planning for this month:

  1. Implementation of item system
  2. Automated need based crafting
  3. Non-telepathic communication between pills

So there you have it. Hopefully I will be able to obtain goals listed above, and back up project with some more commits as the time passes. Also I wold like to write more „quality” posts, like that one.

That’s all for now!

Project goals for this month

Moving on

So that was pretty lazy weekend for me. I’ve decided to have some kind of reboot. I was watching „Under the dome” and „Vinyl” (amazing shows, totally recommended), reading newest Jaroslaw Grzedowicz book called „HEL3” (with cover reminding me the last DOOM) and hanging out with friends. I desperatly needed that.

So having that out of boat, here is update on the project:

It is not much – if pill does not know the location of need fullfiller it starts moving in random directon, until fullfiller is found. It looks kinda rad to be totally honest. Just like nomads, vagabonds (call them what you will \m/) searching for new place to live.

Still it would be fun, if they searched area in organised way with friends. I will propably focus on that in the next update (or on something completly different), so stay tuned!

Moving on

The struggle

Today something about  why this happened:

Przechwytywanie

Maybe something about operation execution order in Unity too.

First of all, let’s look at piece of code

public static void InitializeNeeds(PillAi pill)
{
    var gc = GameObject.FindObjectOfType<GameController>();
    if (pill.GetNeedsDictionary() == null)
    {
        pill.SetNeedsDictionary(new Dictionary<NeedType, double>());
    }
    foreach (var key in gc.DefaultNeedVaules.Keys)
    {
        pill.AppendNewNeed(new KeyValuePair<NeedType, double>(key, gc.DefaultNeedVaules[key]));
    }
}

What you can see is static method that defines needs for every object on scene. It should do the job. But what I get after runing the game is…

error

Not the greatest result, isn’t it? But thankfully, Visual Studio has some cool debugging support for Unity, so let’s find out what went wrong.

And because it will be important later, this is GameController’s Start method

        private void Start()
        {
            DefaultNeedVaules = SetDefaultNeedValues();
            Pills = FindObjectsOfType<PillAi>().ToList();
        }

Again – DefaultNeedValues should be initialized first in order for InitializeNeeds method to work. What actually happens is InitializeNeeds being executed first. That means, my approach being wrong.

But that is actually okay. Default need values were one of ugliest examples of hardcoding I have made, and believe me –  I have made some.

I am thinking of keeping them in some kind of XML. So my next post will touch the subject of XML parsing in Unity.



			
The struggle

A pill that speaks

In world that I am creating every pill needs to fill its needs. As you may remeber from previous post, there are two basic needs implemented right now – food and water.

These needs will be possible to refill at „Need refill stations” as I call them now. I am not 100% sure how the refilling process will look at the end, but that is not today’s post subject. Today I will tell word or two about implementing communication between pills.

So firstly – why?

Well, communication is one of basic skills of intelligent lifeforms.

Secondly – how it works?

To be totally honest, o took the cheap and easy way of giving them telepathy. Every agent stores two lists of objects. First one is list of „Friends” – these are object that pill already met. Second one is list of known need fulfillers –  objects that pill will go towards when coresponding need fullfillment value is bellow the refill trigger value.

Now whenever two pills met, two big things are happening.

  1. Pills are chcecking their friends list, to check if the other pill is there. If not, pill is added to list and becomes friend.
  2. What follows friendship status check is information exchange. Both pills are exchanging informations about known need fullfillers, and update them if there is need to do so.

Information exhange occurs also when one of pills meets new need fulfiller.

That is basically it. It may not seem as much, but it looks like good starting point.

I have to admit, the project is a bit of clusterfuck right now. Coding without plan is can be at times a crazy fun, but this time I want my project to serve some purpose (even if that purpose is weird and uncommon). So I have a question to all reading – what kind of planning method do you use in your personnal projects? And how do you set goals in these projects? Are these goals clear or fuzzy?

Oh, all code is already on GitHub.

PS. The question stated at the end of post was also tweeted. If you are into tweeting, feel free to respond me there!

 

A pill that speaks

I’ve just drawn some ugly looking UML diagram.

Well, that was one hell of a clickbait. But let’s get into details, shall we?

 

I’ve decided, that this time, since goal of the project is to serve people of the internet who want to build their own world of wonders inside of a computer, I need to document whatever I am doing with it.

And yes, I think that means UML too. But since target of this project are developers I need to provide some kind of instruction. It will be in some kind of GitHub wiki I guess.

This week, while developing some code for this project I tested two UML tools.

One of them was StarUML. You can see output of my work bellow.

skrenuml

It is not impressive (never meant to be!). All I really wanted was simple class diagram, to not get lost, and well… It delivers, sort of.  But it requires time and skill, and I am not software analysis specialist.

So I needed something simpler. Luckily though, Visual Studio has cure for my needs.

umlvs

It can be generated, and updates automatically as I edit the code. So it’s good for what I need right now.

How to make your own? Simply, really:

howtoclass

When it comes to implementation… Well there was some progress, indeed.

There is some basic intelligence implemented already. I’ve made up the following scene:

scene

We have some kind of 3D box, our Pill and lots of grass. Our AI agent has hardcoded two basic needs – food and water. When they decrease bellow some level, he seeks for fulfiller of that need and goes there. That’s kinda it.

I am not going to get into details of the implementation, because you can check them out on my repository.

As the final note – question. How do you come to topic of documenting your code? Do you use UML, or just make notes?

I’ve just drawn some ugly looking UML diagram.

Get Noticed 2017 – Let’s get this started!

Here I go again. Maciej Aniserowicz is making his big Get Noticed competition again. I am of course down for it, so I decided to reactive my blog. If you are here the first time – welcome, please enjoy your stay. I will try to post valuable content as often as I can. You may find that most of the content is written in Polish, and sadly it will stay that way for some time.

For people who already know me – i hope you will like new face of my blog.

Okay, if we have greetings out of the board, let’s discuss my project!

Simulation Pills

What is that? Well I am glad you asked.

Computers bring us big power. Power to create living, breathing worlds… Well, sort of. We are still quite limited. But with enugh ammount of skill and hard work it should be possible to create simple world and put there simple „organisms”. It is not going to be perfect mock (like Matrix), but something smaller and simpler (like terrarium).

But why Simullation Pills?

Well…

pills

Look at these capsules. What do you think about idea of these capsules being living organisms which are going to be simulated?

Well it actually does not matter, because decission was made. Also that title sounds so cool.

If it comes to my tech stack, I am going to do it with Unity3D, and Visual Studio.

So I think there is really nothing else I can do, than post link to my GitHub repo with source code.

https://github.com/damoch/simulation-pills

If you want more info about me, there is state-of-art GitHub page answering your questions.

Bye!

PS. If my broken english hurts your feelings in some way, well everybody started somewhere.

Get Noticed 2017 – Let’s get this started!