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

Types of games, that do not need a lot of level design (kind of)

As a programmer who likes to make games I often find myself in situation where I have to make some playable content/levels. Because let’s be honest – even the best programming patterns/practises does not really matter for player. What matters is content. But I (and propably many of you) don’t feel like level design master. But fortunetly there are ways to make games without designing levels, and in this article I decided to aggregate some of them.

System based games

In this approach you are designing game around systems, that are interacting with each one, sometimes even without player’s input. What’s interesting, player is often treaten as just one of entites presented in game’s world.

Good example of that approach is of course – Civilization. Every player, doesn’t matter if human or AI has set of similar ways to rule it’s empire and same goals. Also every outcome from Civ playthrough is valid – from taking over the entire world in future, to being flooded by barbarians in ancient times. And it is still fun!

GandhiMeme

Gandhi with his powerfull and peacefull message

Another example which I enjoyed was a small indie game called Westerado. It is closest thing to Red Dead Redemption on PC that you can have, so deffinetly check that out.

20170328111210_1

„The Ecstasy of Gold” plays in your head

On the beggining of the game your family is murdered and your farm burned down by some mysterious desperado. In his last words your brother gives your some clue about the responsible one. Rest of the game is revenge/detective quest to find this guy and put the bullet between his eyes. The detective part includes talking to other characters in game world, but with one interesting twist – you cant draw your weapon at any moment during conversation (actually outside of them too). That action can end in many ways, one of them being pierced with bullets by other people who may not like your voilent behavior, or even getting the answers from person being at gunpoint.

20170328112456_1

There are of course other excamples of game being in most part deigned around systems. Metal Gear Solid, XCOM, Fallout are just few of them.

RNGs

Random Number Games (or procedural generated games if you like it more profesionally) are games where content is in most cases generated from randomized mix of prefabricated components that in most cases work well with itself in many combinations. Theses components could be for example pre-builded rooms for dungeon crawler, or set of events that player can ecounter during playthrought.

Good example that comes into my mind is FTL – Faster Than Light. In this game you are in control of a spaceship and it’s crew. Yor mission is to deliver crucial data for Federation that can help them win the war over Rebelion. The catch is – whole Rebel fleet is after your one small ship, and most of the time they are just few FTL jumps behind you.

20170328234458_1

Believe or not, but it IS easy to get your ship in presented state

Game is mostly about ship and crew managment. Other important aspect are these random events. After every jump one is taken from event pool, and player has to deal with it’s consequences. Sometimes it’s a space station sending distress signal, friendly ship with resources to help you in your mission, but most times it will be rebel/pirate/rouge ship really happy to blow up your life support system to give your crew horrible death because of oxygen deprivation. Guess why I never completed that game.

Another example are all these endless runners. That concept was propably covered from every possible angle, but I will try to give my opinion anyway. With strong mechanic it could be long lasting, addictive fun (I mean, Flappy Bird, Temple Run, etc.).

And it would not be completed list without all those rougelikes/lites. Games like Enter The Gungeon, Crypt of the NecroDancer or Binding of Issac. As I mentioned before, these are games with prefabricated dungeon modules, that are put together by magic and random number generator.

Simulations

I had hard time putting these on my list, but here it goes. My resoning for that is as follows – if you are creating simulation, it does not require you to build levels around some mechanic, but recreate reality that you understand and have knowledge about. For example, if you are creating let’s say forklift simulation, you have to know it’s „natural enviroment” (wartehouse for example).

In other cases, if you are creating battlefield simulation, all you have to do is take Google Earth’s satellite pictures of area that will fit your game and recreate it in your engine.

When I was young I played a lot of Operation Flashpoint: Cold War Crisis (today it’s called ARMA: Cold War Assault because of licensing problems between Codemasters and Bohema interactive). What shocked me about that game was it’s map design. You see, Everon, Malden and Kolgujev had a lot of eastern european flavor to them. Small towns, landscapes or even small details like roadsigns they reminded me of places where I’ve been. It might be not the best for designing levels, but sure it was more reallistic.

There is vide choice of sims across the market to take inspiration from: flight simulators, car simulators, life simulators and list goes on, and on, and on…

Summary

When you are making piece of entertainment like song, you usually take instrument you are good at playing to accompany it. I think that the same thing goes to videogames. If you are good at programming, and mediocre at art, sound or level design try to take most from your programming skills.

Types of games, that do not need a lot of level design (kind of)

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

Making game in five or so hours

Yesterday I accomplished something I wanted to do in long time – made (almost) full game in short time.

The game is endless runner, where player controls team of soldiers charging towards enemy.

It’s on GitHub , here.

Game was made in GameMaker.

Now, the question that propably is in your head – Why?

That’s the game design strategy of one of my favourite game designers – Jonatan Söderström (aka. guy who was co-creator of Hotline Miami (Hotline Miami is one of my favorite games FYI)) .

And it kinda works. Putting myself on strict time limit made me focus more on game mechanics. I had only few hours to make something that is engaging. Of course, it’s still a prototype, but prototype that shows basics of a game.

I will work more on that in future.

Making game in five or so hours

The solution

Recently I had very sad post, about certain things in my project not working too well. Today I found and implemented solution to that issues.

As I said before, I was thinking about holding default need values in XML file. That’s exactly what I did. There is an XML file with defaults in project, so you can check it out (and set your own values if you like).

Few words about the implementation. It is not rocket science, but some of you might find it interesting.

So that’s how XML looks like:

<?xml version="1.0" encoding="UTF-8"?>
<needs>
  <need>
    <need_type>Food</need_type>
    <value>50</value>
  </need>
  <need>
    <need_type>Water</need_type>
    <value>50</value>
  </need>
</needs>

I think it speaks for itself. It basically holds list of objects, where each one of them has need_type and value property. Before I’ve made parsing code I needed a data structure.I used Xml2CSharp.com, these are classes generated from it (after some changes in datatypes):

    [XmlRoot(ElementName = "need")]
    public class Need
    {
        [XmlElement(ElementName = "need_type")]
        public NeedType NeedType { get; set; }
        [XmlElement(ElementName = "value")]
        public double Value { get; set; }
    }

    [XmlRoot(ElementName = "needs")]
    public class Needs
    {
        [XmlElement(ElementName = "need")]
        public List<Need> Need { get; set; }
    }

I could propably do it myself, but saddly I am lazy person. Anyway, this solution works just fine, so it stays that way for now.

And finally – InitializeNeeds method

 public static void InitializeNeeds(PillAi pillAI)
        {
            var path = "Assets\\Resources\\Needs.xml";
            var reader = new XmlTextReader(path);
            var serializer = new XmlSerializer(typeof(Needs));
            var defaults = (Needs)serializer.Deserialize(reader);
            foreach (var need in defaults.Need)
            {
                pillAI.Pill.Needs[need.NeedType] = need.Value;
            }
        }

This solution still needs some work, but it does what it should. Default need values are no longer hardcoded.

But still, it is far from the solution I imagined. Yes, you can edit the XML but only before you build the game. After that, all asset files are packed into*.asset files. I want them to be accesible in builded version, so that is unacceptable. In the next post I will find the way of doing that.

But for now  – happy saturday! It’s the best day of the week, IMO 🙂

PS: I’ve updated „About me” page and it is in english now.

The solution

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