CategoryGaming

Edge Guardian available on Steam!

This time I just want to spread the word about my two good friends Maurizio and Marco from Hypotermic Games, who have finally got the chance to publish their first game on Steam, Edge Guardian !

In a nutshell, it’s an action beat-em-up for the HTC Vive where you’ll find yourself in a cube-based world, forced to punch your way out through thousands of enemies.

I don’t own an HTC Vive, but even if I haven’t had the possibility to try the game, I can easily say that it’s gonna be really addictive. Take a look at the gameplay if you don’t trust me.

Good luck guys!

Installing RetroPie on your Raspberry Pi

I have an “old” Raspberry Pi model A collecting dust on my desk.

“What can I do with you?”, I asked him one day.
“I want to be beautiful”, he answered.
“You will be my precious…”

And this is how I started working on what will (one day, eventually) became a wonderful home-made arcade cabinet 😀

First thing I have done is installing the software, so after some googling I found this nice linux distro called “RetroPie” . In order to have it up and running, as it’s usual in the linux world, there are some steps that need to be followed…..

Assuming you have downloaded the RetroPie img and copied it on a SD, the first step is expanding the filesystem to the entire SD:

sudo raspi-config

you need to reboot after that:

sudo reboot

then make sure everything is updated:

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

next step is to run the Retropie setup, so go to the /home/pi/RetroPie-Setup/ folder and run

sudo ./retropie_setup.sh

at this point you may choose to install the binaries or the sources. I guess it all depends on how much time you have at disposal 😀

now you’re almost done, all you have to do is copying the rom files to the SD and start playing! There’s a nice guide about it, just pick the method you like most 🙂

Hi my name is Simon. I want to play a game.

Who’s Simon? Nobody? My God, are you living under a rock?
Simon is an elecronic game created in the late ’70 where you basically had to push some buttons in a specific sequence that gets longer and longer. Still nobody? Ok, here’s the wiki.

Why this introduction? Because Simon is a game, and I love games. Also, Simon is an ELECTRONIC game, I am learning electronics and probably there’s no better way to learn something than using funny examples as exercises 🙂

After a couple of hours of experiments and tests this is what came out:

As you can see I’m using an Arduino board to do all the heavy lifting and just some LEDs, resistors and pushbuttons. My goal was to keep the number of components to the bare minimum (but I’m pretty sure there are better ways…)

Talking about code, I have used a very very simple State Machine (something like this one, but much simpler) with four states:
1) build a random sequence of LEDs
2) show the sequence to the user
3) wait for input and check for error
4) show the result and reset

Warning: may be addictive, do not play for more than 1 hour.

Unity: Using an FSM to control your GameObjects

Thanks to my good friend Maurizio, who’s been helping me removing the dust from my memory, today I’ll show you how to use a simple FSM to control your GameObjects 🙂

First, if you don’t know what an FSM is, please read this, and maybe this too.

Done? Good. Now take a look at this (use arrows and spacebar for jumping).

See? It’s just Mario walking on a small platform. He can jump (obviously, he’s Mario) and can fall from the borders.

There are tons of ways to implement this and one of them is using an FSM.

The Player  and the bricks have only a BoxCollider2D, no Physics components. On the Player I have added a Script component that acts as a controller (code is on GitHub).

The idea is to let the controller initialize the FSM adding the needed States and define for each state the Transitions (basically destination State and condition ).

For this demo I have implemented three States: Default, Jumping and Falling. The transitions are simple:

FSM Transitions

  • Default -> Jump: on “spacebar” pressed
  • Default -> Falling: if no collision occurs on -Y
  • Jump -> Falling: after 0.5 seconds
  • Falling -> Default: if a collision occurs on -Y

The states themselves are pretty simple:

  • Default: checks  for input on the horizontal axis and moves the player
  • Jump: adds an impulse to the Y of the player
  • Falling: applies gravity to the player transform

How to reference an array of scripts from another script in Unity

Just a quick and dirty tip (actually, more of a reminder for myself), probably there’s a better way but for now it worked for me… Basically in Unity I needed a quick way to reference a list of scripts from another script. The idea is to have a “main” script holding a list of sub-scripts used to create instances of different game objects (some kind of dynamic factory). The first step is to create a base class for the sub scripts:

[csharp]

using UnityEngine;

public abstract class HazardCreator : MonoBehaviour {
public abstract GameObject CreateHazard ();
}

[/csharp]

then some subclasses:

[csharp]

public class EnemyCreator : HazardCreator {
public override GameObject CreateHazard(){ ….. }
}

public class AsteroidCreator: HazardCreator {
public override GameObject CreateHazard(){ ….. }
}

[/csharp]

then in the game hierarchy I created a GameObject used as “controller” and a child GameObject that contains all the factory scripts. As last step I assigned a script to the “controller” GameObject:

[csharp]

public class GameController : MonoBehaviour {
void Start ()
{
var factories = this.GetComponentsInChildren<HazardCreator>();
if(null != factories && 0 != factories.Length)
Debug.Log("Found " + factories.Length + " hazard creators");
}
}

[/csharp]

As you may easily notice, the call to GetComponentsInChildren is helping us getting all the scripts inheriting from the HazardCreator base class 🙂

 

 

© 2017 Davide Guida

Theme by Anders NorenUp ↑