Nowadays online chats are an important part of everyday life. From a multiplayer game all the way to Whatsapp, Twitch and Discord, a chat is an integral feature of so many online services.

For this reason I wanted to try and write a basic chat in Unity3D. I will use this as a starting point and keep building on top of it. I want to experiment with different server infrastructures in the future.

Turns out that the Unity HLAPI makes this process surprisingly simple! Let’s have a look.

Setting up your scene

Since this was to be a simple project, I decided to go with just one scene which I have called Main. In the main scene there are two important game objects.

  • Network Manager
  • UIChat

The Network Manager will be responsible for the creation and destruction of game objects. While the UIChat will be used as a helper to display the chat as the players type in their messages.

Network Manager Setup

We need to set-up a couple of things in the Network Manager, since it will be responsible for spawning game objects over the network.

First of all, we need to register a player object to be spawned when a player connects. For this, I have created a prefab called PlayerChat and reference it in the Network Manager inspector under Spawn Info –> Player Prefab field. I will explain what PlayerChat does in a moment.

I also created a prefab, called UIChatEntry which I’m going to use to represent a single chat message. The prefab needs to be registered to the Network Manager as well.

Note that all these objects have a Network Identity component attached, which is used by the Network Manager for Creation and destruction of such objects.

PlayerChat.cs

PlayerChat is the game object which represents the user within the chat and there is going to be one of these game objects per user.

public class PlayerChat : NetworkBehaviour
{
    [SyncVar]
    public Color playerColor = new Color();
}

You will notice that PlayerChat is a NetworkBehaviour. This is because we are going to have network functionality within the class.
The second thing you’ll notice is the SyncVar attribute on top of the playerColor variable. The Network Manager is only responsible for the creation and destruction of networked game objects: this means that it leaves the state synchronisation up to us. SyncVar does exactly that, it syncs playerColor across all PlayerChat instances on the network. This way I can have a different colour per user, and that user will have the same colour on all other clients. That is, if I’m a user with a Red colour, all the other clients connected to the chat will see me as Red.

    public override void OnStartClient()
    {
        base.OnStartClient();

        chat = FindObjectOfType<UIChat&gt;();
        chat.sendButton.onClick.AddListener( OnSendButton );
        playerColor = new Color( Random.Range( 0, 256 ) / 256f, Random.Range( 0, 256 ) / 256f, Random.Range( 0, 256 ) / 256f );

        Debug.Log( "Client" );
    }
    
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();

        CmdSendChatMessage( "New Client joined chat... say hello! \n" );

        Debug.Log( "Local Player" );
    }

    [Command]
    private void CmdSendChatMessage( string inMessage )
    {
        if ( !string.IsNullOrEmpty( inMessage ) )
        {
            chat.CreateChatEntry( inMessage, playerColor );

            Debug.Log( "Received Message " + inMessage );
        }
    }

OnStartClient is called in all instances when a Player Object is created. I’m using this method to hook up a reference to the UIChat object and to determine the colour of the player.

OnStartLocalPlayer is then called only in the instance that represents the local user. This is useful since we want to send the Welcome Message only once, when the user logs into the chat. Since there are going to be multiple PlayerChat objects, it is very useful to have a method that identifies the local user only.

To send a Chat message we call the CmdSendChatMessage method with a string representing the message. This method has the Command attribute above it. The attribute is used to invoke a method on the server from a client. When the server invokes this method, it calls UIChat to instantiate a UIChatEntry for the chat message. The UIChatEntry will then be created on all clients.

UIChat.cs

    public void CreateChatEntry( string message, Color inPlayerColor )
    {
        UIChatEntry chat = GameObject.Instantiate( chatPrefab ).GetComponent<UIChatEntry&gt;();

        chat.ShowMessage( message, inPlayerColor );
        PositionEntryInGrid( chat.gameObject );

        NetworkServer.Spawn( chat.gameObject );
    }

This class is simply used to display the chat messages by instantiating a UIChatEntry and then calling NetworkServer.Spawn. The Spawn method is used to create game objects over the network. The Server will serialise the UIChatEntry instance and send its data to the clients, which will, in turn, deserialise it and create their own copy of that instance.

UIChatEntry itself is a very simple class which just contains a player’s colour and the message to show.

public class UIChatEntry : NetworkBehaviour
{
    public Text chatText = null;
    public Image backing = null;

    [SyncVar]
    string text = null;
    [SyncVar]
    Color color = new Color();
}

Test the project

In order to test the project you will need 2 players chatting to each other. It is very easy to set up 2 clients talking to each other. You will build your project for one client and run the chat within unity for the other.

To build your project go to File -> Build Settings… and select PC, Mac and Linux Standalone. Then click Build and Run.

Press Play in your Unity Editor. The Network Manager will show the default HUD. Click Lan Host.Once the project is built and is running, click LAN Client.

You can now chat between the two clients!

Conclusion

We have seen how we can write an online chat using Unity HLAPI. We represent one message in the chat with a Networked Game Object.

Further implementations could involve writing the chat without the help of the HLAPI; write a host server which accepts connections and acts as the middleman in exchanging messages between clients.

You can find the code for this chat on my personal GitHub: https://github.com/lormori/UnityChat

References

https://docs.unity3d.com/Manual/UNetUsingHLAPI.html

Back in the day when I started Uni, I had no idea what Version Control was. So, when tasked to choose my repository I just picked up what a friend of mine recommended. I then installed TortoiseHG on my Windows machine, created a BitBucket account and there I was, using Mercurial as my repository of choice.

I then realised that many many many many people use Github to share code and work on open source projects. Also, I discovered Github does not use Mercurial but uses Git as their distributed version control system.

For this reason I decided to try Git and learn how it works. My very first question was: how can I move Mercurial repositories into Git? I could just copy/paste the projects in the state they are and create a brand new Git repository with them. But what if… what if I wanted to move them to Git and keep all the previous changelists. How do I do it? Let me show you.

Prerequisite – Install Git and TortoiseHG (Windows)

First, I had to install Git (of course!) You can follow this link that has a super useful guide to do so and it’ll tell you all you need to know. Next install TortoiseHG from here: I use it as a Mercurial client but it also has a neat and useful extension which we are going to use to convert Hg to Git, called hggit.

Once everything is installed there are a few extra steps before the convertion.

Enable hggit in TortoiseHG

Open TortoiseHG workbench, go to File -> Settings and the Extension tab: select hggit.

Now that is enabled, we need to add a few extra settings to our mercurial settings file. This file is usually found in C:\Users\YOUR_USER\mercurial.ini

Add the following to the file:

hgext.bookmarks =

[git]
intree = True

Convert Mercurial to Git

In order to do the conversion you’ll need to open your Powershell / Command Prompt, navigate to your mercurial repository and then execute in order:

hg bookmark -r default master
hg gexport --debug

This creates a git bare repository. Bare repositories are generally used for sharing purposes, so what you need is a working directory instead: that is where you will be able to do ‘commit’ and ‘push’ onto your repository. To do this, you have to set the bare flag of your repository to false and reset the repository to start fresh (still in Powershell or Command Prompt):

git config --bool core.bare false
git reset HEAD -- .

Almost there! your folder structure should look like this

You can delete the .hg folder and there you have a git repository.

You can check the status of your repository to make sure everything is in place:

PS D:\Dev\UnityChat&amp;gt; git status
On branch master
nothing to commit, working tree clean

If anything has gone wrong you can reset the repository with:

 hg gclear 

command.

Push your Git repository to Github

Go to your github account and create a new repository. You can do this by clicking the ‘+’ sign on your profile page.

Once the repository is created you can push your local repository on Github with:

PS D:\Dev\UnityChat&amp;gt; git remote add origin https://github.com/lormori/UnityChat.git
PS D:\Dev\UnityChat&amp;gt; git push -u origin master
Enumerating objects: 138, done.
Counting objects: 100% (138/138), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (123/123), done.
Writing objects: 100% (138/138), 73.24 KiB | 1.46 MiB/s, done.
Total 138 (delta 80), reused 0 (delta 0)
remote: Resolving deltas: 100% (80/80), done.
To https://github.com/lormori/UnityChat.git
* [new branch] master -&amp;gt; master
Branch 'master' set up to track remote branch 'master' from 'origin'.

And there you have it, your whole project is now on Github with your previous ChangeLists. You can carry on working on it and ‘commit’ new stuff this way:

PS D:\Dev\UnityChat&amp;gt; git commit -a -m &quot;test commit&quot;
[master f78ecd0] test commit
1 file changed, 1 insertion(+), 1 deletion(-)
PS D:\Dev\UnityChat&amp;gt; git push
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 483 bytes | 241.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To https://github.com/lormori/UnityChat.git
3bdd378..f78ecd0 master -&amp;gt; master

Conclusion

It is relatively easy to convert a Mercurial repository to Git, if you wish to do so. Just install Git and TortoiseHG on your machine and you are closer than you think you are! Once it is all up and running, you can now use your Git repository with the command line, but there are a few visual clients you can use instead. You can just use TortoiseHG with the hggit extension enabled, or you could download SourceTree, which seems very good for the job. In the end, it is up to you which tools you prefer to use while working: what matters is to get the job done.

I hope you’ll find this useful, and just in case you want to have a look, you can check out my new shiny github repository that I created this way. It still contains all the old commits from the mercurial one!

References and further reading

https://helgeklein.com/blog/2015/06/converting-mercurial-repositories-to-git-on-windows/ – Major article I followed
https://www.sourcetreeapp.com/ – Cool visual client which I might adopt
http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/
https://gist.github.com/seankross/8830032
https://stackoverflow.com/questions/11656761/git-please-tell-me-who-you-are-error
https://gitforwindows.org/
https://help.github.com/articles/create-a-repo/
http://www.rockstarprogrammer.org/post/2008/apr/06/differences-between-mercurial-and-git/
https://importantshock.wordpress.com/2008/08/07/git-vs-mercurial/
https://ericsink.com/entries/hg_denzel.html

Flocking is usually referred to as the behaviour that animals follow when travelling in groups. In the natural world, flocking can be easily seen in birds that fly together, but also in fishes, insects and so on. I did a small AI project some time ago, and I thought I would share it with everyone.

Flocking behaviour can be modelled using three rules:

  • Alignment: As the name suggests, alignment is the rule by which an agent of the flock tries to align with the rest, essentially steering towards the average forward direction of travel of its neighboring agents.
  • Cohesion: Cohesion is the rule by which an agent tries to move towards the center of mass of a flock.
  • Separation: Separation works very similarly to cohesion, but it is the short distance repulsion between agents.

Using a few principles and ideas, it is possible to reproduce this behaviour in computers which can be used in games as well. This article will focus on the implementation of the Flocking Behaviour in Unity3D engine. I have seen many demonstrations and tutorials of the flocking behaviour in 2D on the web, but I couldn’t find a tutorial for how to implement this in Unity. Also, I wanted the demo to be in 3D, so even if the difference between 2D and 3D are minimal, this gives me the excuse to write an article about it.

I decided to go for a fish tank theme, where all my agents are fishes instead of birds. Because why not.

Entity.cs

First off, we will need an Entity class to hold data about the state of an agent inside the flock. The agent will have a velocity Vector3 that will be updated each frame so as to align and move according to the flocking behaviour.

public class Entity : MonoBehaviour
{
    private Vector3 mVelocity = new Vector3();
}

The Entity class really only needs to hold its velocity because position and orientation are contained in the transform component of the MonoBehaviour class.

On its update function, the flocking behaviour adds to the current agent’s velocity so as to get a smooth movement each frame.

void Update()
{
    mVelocity += FlockingBehaviour();
    mVelocity = Vector3.ClampMagnitude( mVelocity, mMaxVelocity );
    transform.position += mVelocity * Time.deltaTime;
    transform.forward = mVelocity.normalized;
    Reposition();
}

It also sets its forward vector with the one of the velocity vector.

Applying Flocking behaviour rules

When calculating Alignment, every agent of the flock will check the direction of all the other agents. This means that each agent will check all the other agents and calculate the average direction of the flock. To get this direction you can simply access the forward vector from the transform of the game object.

private Vector3 Alignment()
{
    List<Entity> theFlock = App.instance.theFlock;

    Vector3 alignmentVector = new Vector3();

    int count = 0;

    for( int index = 0; index < theFlock.Count; index++ )
    {
        if( mID != theFlock[ index ].ID )
        {
            float distance = ( transform.position - theFlock[ index ].transform.position ).sqrMagnitude; 

            if( distance > 0 && distance < mRadiusSquaredDistance )
            {
                alignmentVector += theFlock[ index ].transform.forward;
                count++;
            }
        }
    }

    if( count == 0 )
    {
         return Vector3.zero;
    }

    // forward step
    alignmentVector /= count;

    return alignmentVector;
}

Cohesion is none other than the vector pointing towards the center of mass of the flock. In order to calculate cohesion, each agent needs to calculate the average position of all the other agents. Then, it needs to calculate the direction towards the center of the flock from its current location. Since the step is very similar to the previous one, I will highlight the differences only.

for( int index = 0; index < theFlock.Count; index++ )
{
    if( mID != theFlock[ index ].ID )
    {
        float distance = ( transform.position - theFlock[ index ].transform.position ).sqrMagnitude; 

        if( distance > 0 && distance < mRadiusSquaredDistance )
        {
            cohesionVector += theFlock[ index ].transform.position;

            count++;
        }
    }
}

if( count == 0 )
{
    return Vector3.zero;
}

// cohesion step
cohesionVector /= count;
cohesionVector = ( cohesionVector - transform.position );

Separation is the last vector that needs to be calculated. Separation is expressed like the average distance from the current agent to all the other agents. Since the average distance vector obtained this way will point towards the other agents, we also need to invert it to get the separation vector.

for( int index = 0; index < theFlock.Count; index++ )
{
    // [excluding code...]
    separateVector += theFlock[ index ].transform.position - transform.position;
    // [excluding code...]
}

// [excluding code...]

// revert vector
// separation step
separateVector /= count;
separateVector *= -1;

Putting it all together

Instead of running the three loops separately for each rule, I decided to combine all the calculations into the same loop. Once all the three vectors are calculated, the easiest way to combine them is to simply sum them up. This will result in the velocity vector that is returned by the FlockingBehaviour method, as discussed previously with the Update method.

I also decided to add weights to each single vector. This makes it possible to change the flocking behaviour at runtime and experiment with how these three rules work together.

private Vector3 FlockingBehaviour()
{
    List&amp;lt;Entity&amp;gt; theFlock = App.instance.theFlock;

    Vector3 cohesionVector = new Vector3();
    Vector3 separateVector = new Vector3();
    Vector3 forwardVector = new Vector3();

    int count = 0;

    for( int index = 0; index &amp;lt; theFlock.Count; index++ )
    {
        if( mID != theFlock[ index ].ID )
        {
            float distance = ( transform.position - theFlock[ index ].transform.position ).sqrMagnitude;

            if( distance &amp;gt; 0 &amp;amp;&amp;amp; distance &amp;lt; mRadiusSquaredDistance )
            {
                cohesionVector += theFlock[ index ].transform.position;
                separateVector += theFlock[ index ].transform.position - transform.position;
                forwardVector += theFlock[ index ].transform.forward;

                count++;
            }
        }
    }

    if( count == 0 )
    {
        return Vector3.zero;
    }

    // revert vector
    // separation step
    separateVector /= count;
    separateVector *= -1;

    // forward step
    forwardVector /= count;

    // cohesione step
    cohesionVector /= count;
    cohesionVector = ( cohesionVector - transform.position );

    Vector3 flockingVector = ( ( separateVector.normalized * App.instance.separationWeight ) +
                             ( cohesionVector.normalized * App.instance.cohesionWeight ) +
                             ( forwardVector.normalized * App.instance.alignmentWeight ) );

    return flockingVector;
}

If you want to check out the whole project, you can find it on my Github.

Further implementations

Since every agent in the flock has to check against every other one each frame, this can be quite expensive when dealing with large number of agents of a flock. It would be a cool exercise to try optimizing the algorithm so that this is avoided. One way to go about it could be to subdivide the space into smaller spaces, for example using a grid approach. Each agent will register to the corresponding cell and then check their behavior only against the agents currently in its own cell, and the cells adjacent to it.

If you had a close look at the Update() method, you have certainly seen that there is a Reposition() method call in it. The reposition method force the fish to stay inside the boundaries of the tank. One thing that I would like to improve is the steering pattern of the method. It would be nice to have a smooth curve instead of the sudden change of direction that is currently implemented, so maybe adding an avoiding behavior of some sort would be great to improve the AI.

What about adding new rules to the flocking behaviour itself? Maybe adding Fear to the Entity state? This could be used if the flock has to run away from a Shark. Or maybe the flock is following some object of sort, like when lions follow the leader of their pack, for instance. That could be fun!

Flocking behaviour has a simple enough implementation but carries fascinating results that imitate natural behaviour. Use it in games when you are dealing with large groups of agents can be the way to go! Or maybe you have a fish tank where your Solid Snake-like character is thrown in by the baddie during a boss fight.

When working with Unity UI system, sometimes it is useful to know what the size of a given RectTransform is. Maybe you need to know how big a widget needs to be, or to see if a mouse pointer is within that given rect.

There are two ways to do so.

Using sizeDelta

RectTransform.sizeDelta

The catch with this is that it returns a size which is relative to the parent object, so it is possible to get zero/negative values if the RectTransform is smaller than the parent object. BUT, if the pivots of the transform that you are trying to measure coincide, then sizeDelta will return the actual size of the transform.

This is especially important to note when working with transforms that are set to stretch, because their pivots do not match up.

Using rect

RectTransform.rect

The other way to get the size of a RectTransform is to use its rect property. This one always returns the correct size of the transform, so I would suggest to use this whenever you need the size of a transform and don’t want to worry about how its pivots are set up.

The only problem with this approach occurs when you are instantiating new objects, like a prefab for a vertical list, and accessing their rect property on the same frame that they are created. Unity, in fact, takes one frame to re calculate the values, so you might end up with incorrect results if you do not wait.

I found two solutions to solve this problem.

Solution 1: Rebuild Canvases

Canvas.ForceRebuildCanvases()

If you need to call this only once then this is probably the easiest solution and the quickest. However, re-building canvases allocates quite a bit of memory, especially if it is called repeatedly when instantiating many objects for a list in your UI.

Solution 2: Wait one frame

You can do this in a couple of ways.

StartCoroutine(ReadRectSize);

IEnumerator ReadRectSize()
{
 // Read rect transform size....
}

Calling a Coroutine is a simple way to wait one frame to then grab the size of a RectTransform. The problem with this approach is that the implementation is less straight forward than rebuilding canvasses, since you will have to write a new method. However, it is still quite readable.

bool readRectSize = false;

void Update()
{
    if(readRectSize)
    {
        // read rect size...
        readRectSize = false;
    }
}
void InstantiateObjects()
{
     // create objects
     readRectSize = true;
}

If you don’t want to use Coroutines then the next solution is to use a Boolean flag. When instantiating objects you can set the flag and then check it on your Update function. This is the safest solution in terms of simplicity and memory allocation, but it comes at the cost of having to add an extra flag in your implementation.

I’m a strong believer that User Experience is one (if not the most) important part when developing software. In fact, it is essential to present any software (from games to apps) to consumers. It doesn’t really matter if you’ve got the most awesome piece of software in the world if your user experience is crap. Simply it won’t deliver the expectations the end user has, no matter how great your idea is. If your UI is too complicated and fiddly, it is possible that a whole bunch of cool functionality will remain buried behind too many clicks because the user doesn’t even know they exist neither has a clue on how to get there!
It is with this principle in mind that I built this website, and I took the challenge as a learning experience. I’m no web designer neither a frontend developer, but it is always nice to get a feel on how other things work outside your own experience. For this reason it is possible that the UX (aka User Experience) between this webpages still sucks and I screw up big times, but I learned a lot just from doing it. Maybe next time will be even better.

So, first I started thinking that the website needs to be readable and easily accessible from most of the devices, in particular mobile devices. There are lots of browsers, smart phones and pads out there: you probably don’t want to miss them! This was my focus point, and all the rest has been developed with this in mind.

So here is a little list of 10 tips that I learned and used. Some are just principles to keep in mind, some are tools that I used.

  • Bootstrap helps A TON with regard to different screens’ resolutions that you have to deal with. Thanks to that, it is now really easy to access my website from different devices, especially from smart phones. Note that this website works on top of WordPress, so we can say that this is a theme for WordPress. Check This out if you want to know how I did it, it helped me a lot. Also This.
  • Keep it simple! I started that I wanted to have loads of cool looking shiny stuff, but I ended up having a website that was too noisy and it just felt complicated.
  • For the same reason above: The less the better! Don’t overload the user with too many information that doesn’t need yet, but instead make it simple to “reach” the information he is looking for. That’s why I chose to have just four big colored squares on my home page. Each one is nice and simple and you get straight away where they are pointing to.
  • Flat design. I chose the art and the colors all by myself, but before that I did some research on what a good design should look like. Turns out that the trend is the so-called flat design. Just search for it on google and you’ll find loads of articles about it. It basically follows the rule of no shadows or highlight in your art/buttons/gui and instead it adopts just pastel and contrasting “flat” colors. This apply perfectly to my idea of “keep it simple”.
  • Mouse clicks are different from touch screens. Test the pages both on your smartphone and your pc! Some ideas can be super cool and working perfectly when you have a mouse and keyboard, but what about touch screens on mobile devices? That hover effect is simply beautiful when you got you arrow on it, but it doesn’t really work with touches! For instance, the titles for each entry in my port folio page appear only on hover! Try to keep them pressed from a smart phone… It’s just a mess.
  • Get feedback! A good piece of advice that I got is that the flat buttons on the home page do not really feel like buttons, especially when you click on them. This is because nothing happens on click so you don’t really know if you pressed in the right area or not. That’s why I added an on-click effect on them: At least you know that something is happening!
  • Use custom fonts and match them. While reading some articles I discovered that the trend is to use two custom fonts in you website. Initially I didn’t even know you could load and use different fonts from the default ones that are supported by the browser! So look online for cool custom font matching, choose the ones you like and make them yours!
  • Talking about fonts, Font Awesome makes a great font for icons. I’m using it in the navigation bar for github and Linkedin icons and many more.
  • Learn from the best. I read quite some material about flat design, bootstrap, color matching, fonts. Since I’m not an artist, I simply got big inspiration for colour patterns, designs and ideas from others that are better than me! For instance, being a windows phone user, I decided that my website would look like  the WP home page metro style. I think metro style is gorgeous and it applies perfectly to my focus point. Big simple squares also make it ideal for a responsive layout!
  • I wanted my website to feel like an app. Do you check your Facebook through your browser, or do you use the app? How about you Twitter feed? It’s much nicer to get a layout that is designed to feel good on a small screen, where everything is under the reach of your thumb, rather then having to zoom in and out continuously just to press a button.

So this is it. Maybe some principles are wrong and maybe are not applied at best on this website, but I think there is some good stuff in it that could be helpful.
I did my best for this website and I’m quite proud of it, having done everything on my own. If you enjoyed the article you can check the source code for this WordPress theme on my personal Github repository here.

Python seems to be the new thing. Everyone talks about it, everyone seems to appreciate it.
So I decided to give it a go, and started studying it.
I found out that it is extremely simple and easy to get along with.
I’ve been working with C# for mostly of my last two years, and I have to say, learning a new language is a really good challenge for me.
It felt like something fresh, and I really enjoy this new beast. I still have to get my head around it as like what are the best practices to write good python code. But still, I really like it.
I followed a series from the Google Developers channel on youtube and I highly recommend this series because it is really easy and clear, especially for new comers like me. I mean, at the end of the lectures, I was able read an Apache file to gather information about sliced images that I had to download from the web. Download these images, save them to a folder and put them back together in an html file to get the final image. Isn’t that awesome?
Here are the links of the first two lectures for each of the two days. Have a look! I believe this is really good stuff.

Google Python Class Day 1 Part 1

Google Python Class Day 2 Part 1

I finally managed to finish my website. At least for now. I feel quite proud with it, since it is the very first time that I spent some time on it and I really work hard to make it happen. It’s no completely finished, but I wanted to put it online to share it with everyone, to gather comments and know what people think about it.

I’m currently using WordPress as a CMS and what I did was to create a brand new theme for it from scratch. I started with Bootstrap, in this way I was able to have a responsive website in just few steps.

I then followed this tutorial to create a responsive theme for WordPress with Bootstrap.

After that the hard part was to give this website a style. I’m not a designer so this has been a real challenge. I went for a flat design since this seems to be the trend nowadays and this is the final result. I will keep changing and modifying it, but I wanted to have it real and clear right at the beginning of the new year!

For those interested, you can find the source code for this website on my Github. Feel free to have a look, download and modify it how you like it! =)

Happy New Year!

Yesterday has been my very last day of Uni. Yes, exactly. That’s it.

After mmm.. I don’t know even how many years, I finally came to an end and finished my studies. At least for now. This means no more worries about exams, lectures, thesis and everything related to it. This will be a great Christmas holidays.
Is it time to grow up?


Thanks Filo for this photo.

Finally, after struggling a lot with the maze generation algorithm for my Creative Coding module at Goldsmiths, I managed to implement it and have it working properly. I redesigned it completely because there were different errors in the previous version and it was faster to start it again from scratch then check the code over and over again.
So, after 1600 lines of code, the cubeMaze generator is ready to be used to create the final labyrinth mesh for our iPhone game!

Here is a snapshot from one of my teammates work, which shows the mesh generator ready to get my data!

cubic maze

For my first assignment of the Workshop in Creative Coding at Goldsmiths we have to utilize OpenFrameworks to create an iOS mobile application.
It is a group project, and one of my team mates came up with an idea base on my maze generator that I implemented for my Intro to Game Programming Assignment.

The idea is basically to riproduce my maze generation algorithm on the surface of a cube. So in these two days I went crazy trying to provide the right algorithm that will be used to produce the final labyrinth mesh. After struggling for ages because of the thousands more controls that I need to do, I finally managed to get something acceptable. Here are my results coming just from the console.

Every face is printed one by one, the E character represent the wall, and where there is nothing it means that there is… nothing! The player will be able to move between the empty space… I hope.

ofMaze