Steady Drop – Log #4 – Game Logic

 

Like I said in the last post, this one is about game logic.

I think games can be a pretty good simulation of the real world, and so far they do a really good job in this, even if most of the times there are only approximation of physics rules. Again, they CAN be a simulation but they do not HAVE to. So, in my case, I choose not to follow the stricts physics rules of gravity but I defined my own one.

 

Gravity logic

What I have at this point is only the gravity direction ruled by the device orientation. The amount of gravity force is determined by a simple algorithm: starting from a base multiplier, I add a certain value to this multiplier every N crossed unit and then I multiply the gravity vector for this multiplier.  In this way the speed increases in a sort of exponential way.

When the player stops the gravity, current force and speed are saved and they are applied once the player release the stop.

 

Point Logic

Let’s start with explaining the basic idea. I wanted a scoring system based on the distance that increases the points every N crossed game unit. The amount of increase depends on different factors. It depends on the gravity multiplier explained above and on a point multiplier that is progressively lerped to zero when the player stops the gravity and lerped to a maximum value when the player doesn’t stop the gravity. In this way a long stop equals to a smaller point increase, especially for high gravity multipliers. If you stop at the beginning there’s no big deal because the gravity multiplier is still low.

To do a recap:

  • Increase points every N crossed game unit .
  • The increase depends on the gravity multiplier and the elapsed time .
  • The gravity causes speed, which implies that the points are added more often.

 

Obviously, user-side the only things to be told are to keep falling as smoothly as possible and try to avoid to stopping too often. It seems a complex system but it’s not and it adds a certain level of unpredictability for the player.

The health is the maximum gravity stop time

The game world:

  • leaves room to the player to do basically whatever he wants
  • it’s “analogic”: the actions are not sampled or fixed

 

I need a system to connect all the aspects (gravity, health, score) together. I started to think about something that can affect the gravity, the points and the gameplay as well, and I think to bring in the time, too. We can stop the gravity with all the effects on point multiplier discussed earlier. But for how long we can stop it? Well…for a time related to the remaining health of the player! When stopping the gravity, a bar shows the player that the time is decreasing. When the available time is zero the time it starts to load but the player can stop the gravity again only when the time reaches the maximum value (the remaining health). I came up with this idea pretty far in the development but it is something that connects everything and I developed it.

This kind of relationship between stop time and health holds up everything giving importance to every aspects of the gameplay.

For visualization I choose two overlaid bars. When the time is increasing or decreasing the player sees the above bar that scales down or up revealing the bottom bar that represents health. In the image you can see the bar that represents health (green) and the stop time bar (lime-yellow) when the time is decreasing.

Schermata 2016-07-10 alle 14.03.30

 

This covers pretty much everything on game logics and since this time was a lot talking, I decided to give something visual as well. These are the current versions of the game actors. I think they will be the final ones, more or less. You can see the color palette I decided to use too.

actorScreen

 

 

I define myself as a creative developer.

Steady Drop – Log #3 – Level design

 

It’s been a while since the last devlog. I had some other projects to follow and a lot of stuff to do, but here I am. Let’s jump right into the subject: this post is about level design and my approach to level design in Steady Drop.

 

Level procedural creation

In this I started to think about full procedural generation where I put the rules into the algorithm and the level are generated with no manual level design at all. Sure, great approach, but I’ve found is not really suitable for what I wanted to do. Since the only level I have is potentially infinite I though more like a sequential loading.

Eventually I came out with a type of sequential loading where the level is loaded from basic parts that I call “slot”. The slots are loaded when needed progressively as long as the character falls down and are deleted/disabled when are offscreen because they are not usable anymore. The main operations of loading and deleting is shown in this code snippets below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public void spawnNext(float fallObjYOffset){
    if (fallObjYOffset > m_CurrentYOffset - 10) //if I'm almost there
    {
        //pick the right pool
        List<Env> currDiffEnvs = m_OrderedEnvs[m_CurrDiff.ToString()];
       
        //pick a random slot of the pool
        int eIndex;
        do{
            eIndex = Random.Range(0, currDiffEnvs.Count);
        } while(eIndex == m_LastIndex && currDiffEnvs.Count > 1);
        m_LastIndex = eIndex;
       
        //load the slot
        GameObject env = GameObject.Instantiate(currDiffEnvs[eIndex].gameObject,
                                                new Vector3(0f, -m_CurrentYOffset, -3f),
                                                Quaternion.identity) as GameObject;
        m_SpawnedObj.Add(env);
        env.transform.SetParent(transform);
        m_CurrentYOffset += envs[eIndex].offset;
        m_Spawns++;
    }
    if(m_Spawns == m_DiffSpawnSlot)
    {
        modifyDiff(1);
        m_Spawns = 0;
    }
    disableVeryFar(fallObjYOffset);
}

Basically, the slots are divided by difficulty in different pools and since the difficulty is progressively increased as the player goes down, a random slot are picked from a pool of the current difficultyIn this way each slot has to be independent from others and still give a sense of flow and continuity when put in a slot chain, so I had to find a easy method to create a set of separate slots that convey flow.

 

Level design

In the last couple of months I started to read about different techniques of level design along with image composition, functional level design, “level design has to serve the gameplay” and others best practices and tips on the matter.

Finally, I found that this approach on Gamasutra could be very suitable for what I was trying to achieve, and you will find references of it in the following explanation of my level design pipeline.

Basically what I’ve done are very simple few steps.

  1. Defining the component palette: all the enemies, obstacles and even the player.
  2. Divide a blank sheet on three and drawing a curved path on each part. This is my ideal falling path, my flow.
  3. Mark the points of the path that are on the center and draw a horizontal line. In this way the horizontal line delineate a slot.
  4. Populate every slot with components of my palette in a way that makes sense along with the curved line of the flow

In the slide-show you can find an example of what I’ve done.

ld0ld1ld2ld3

 

I chose to divide the vertical column when the flow pass through the center because in this way every slot has its flow starting and ending in the same area and they can be put in random order and still maintain a pretty consistent flowIn this way during the game, each slot can be randomly loaded as needed from a set of independent slots (like shown above).

 

 

I hope you liked this post :-). The next post I will explain the point system and the overall logic, stay tuned for more devlogs and other articles.

 

I define myself as a creative developer.

Steady Drop – Log #2 – Graphics Style

Improvements

In the last post (here) I forgot to mention that the inputs of the game are both the gyroscope and the touch screen: by holding the finger on the screen you can stop the gravity force.
I have to make a short document with a more detailed description of the game. I will post it soon.

In the last few weeks I converted all the logic of the game to be strictly 2D. Before I had some legacy of a 3D prototype that I made for the initial tests. I had to convert Rigidbodies, Colliders and stuff to the 2D version of the components. No big deal.

Beside that, I created a state machine that goes through the game states (like pause, loose, play, etc…) with a menu system that can load a menu based on the state of the game. I have to refine the transitions a bit and it’s perfect 🙂

Component pallette

I’m also working on creating my pallette of components that will compose the levels on two different layers: design aspects on one hand and graphics style on the other.

Desing & technical
Currently I have:

  • the player: the object that is falling down (triangle).
  • a wall: an obstacle that cause immediate death to the player if the player touch it (square).
  • a gravity magnet: it can pull towards or push away the character while is falling (circle).

Every object can move around or not, for example we can have movable walls. I’m planning to have a discontinuous laser and a pendulum object.

Graphics style
Here some examples of the concepts so far

steady drop actors

Once I have a concept and behaviour that I like for every component I will start to create some levels for testing the overall result. [SPOILER] The next post will be on level design 😛

I define myself as a creative developer.

Steady Drop – Log #1 – Starting off

This is the first post of Steady Drop dev log. I’m going to start this dev log maybe a little too late (my bad), but I’m going to do a recap. First of all, what is Steady Drop? Steady Drop is a 2D game about controlling the gravity by tilting your mobile device while, your character is falling down.

Starting development

The development started in summer 2015 when I had the idea that the input on a mobile phone can be given in several different ways other than the classic input methods (swipe and tap). At the time I choose the gyroscope to be the main input that served the gameplay and I imagined  a game that could satisfy this paradigm. So I grabbed my sketchbook and after some sketching session and I came up with a falling game. (Only recently I realize that Ridicolous Fishing has similar inputs, but the gameplay is pretty different). Then I passed into Unity 5 and started the development.I had the vision of the game pretty fixed in my head, so the first couple of weeks I worked on to get the input controls right. The gyroscope attribute is very easily achievable in Unity without requiring any native plugin for the devices, so I used that to create a first prototype and I was pretty happy about it.Then I thought about structure of the game, level organization, menus and so on. I came up with something similar to Cut the rope 2 or Two Dots in term of level selection but with down scrolling (since is a falling game). I started to develop the architecture for the game actors and all the managers and the level handling. At the time I was thinking of a playful graphic style and some themes for level groups (like space, sky with clouds, ground and underground. I was planning to release the themes on regular time spans. I also studied  the character design and a little bit of the game plot placed in a believable world and environment.

Change of direction

To make it short, I was planning to add a lot of things (maybe more) and after a period of time where the things was stalling, I decided to cut the fat of the project and resize it a bit. Instead of having multiple levels I choose  one infinite level. Also because a continuous fall divided into levels maybe was not a great design idea. I also redesigned the graphic style choosing a more minimalistic style with flat 2D shapes and no themes at all. So I had to go through some refactoring sessions to change direction and to get to the point where I am now. I regret a little bit this change of direction but without it the project would fail.

Current state

I’m currently working on the visual style and on the tools to make the things looking good on different screen resolution. I’m thinking of using svg format for images and I found this plugin on the assets store, I will try it out soon. I’m also planning to integrate an analytics framework and a life system based on how many add you watch (like Threes game), we’ll see. Since is a side project, I’m working on it in the spare time, so be gentle with me if it’s taking me a lot of time to finish. I will post other previous and present development stuff in future posts. Stay tuned!

I define myself as a creative developer.