NGUI – Big Game Project

This week, I have spent some time cleaning up a lot of code to make it more readable for others and fixing a lot of bugs. In our card game there are three main piles where cards go trough each turn. The main deck, the hand and the discard pile. Players draw cards and put them in to their hands and then discards them by playing them and when the deck has no cards, the discard pile is shuffled in to the deck again. We had problems where cards were the wrong amount of cards sometimes would be put in to the wrong piles. This is now fully fixed so soon a single player will be able to play the game by himself.

But I spent most of my time this week trying to figuring out how the NGUI-package from the assett store works. We want to use this package to display the piles of cards I mentioned earlier. It could simplify the process in the long run, but right now I am having a hard time wrapping my head around it. The biggest advantage of using NGUI is how it easy it is to make texture atlases. They are like one big texture with smaller textures inside of it. This way, the game doesn’t have to load a lot of different textures, but use one for many objects. As smart phones are weaker than a lot of PC’s and we are targeting smart phones, this is a good idea for better performanceImage.

Unity Master Server – Big Game Project

Unfortunately, I’ve been ill this week and because of that, I haven’t been able to do as much work as I otherwise would have. But I tried doing as much as I could anyways so I wouldn’t get too far behind schedule. I have finally finished setting up a master server for the game so players can find available games to play without having to know the servers IP addresses. Players can now choose between creating a private a server where the game is hidden and players connect by typing in the IP address or creating a public server so other players can easily find them. The game is currently using the unity master server which should only be used for testing purposes so I should probably be looking for other options as well. Amazon offers this service for free for a year so that is probably a good option later on and there shouldn’t be that much code to change either.

Here are a couple of images of how it looks like right now:

menu server connect publicservers launchserver

Unity Networking – Big Game Project

Last week I had to do a lot of research about networking in unity and that’s what I spent most of my time on. I have never programmed something involving networking so the whole subject was a bit foreign to me. Fortunately, there are many great tutorials online and very good documentation provided by Unity Technologies for me to study. I was actually able to implement a system where players can create servers where two players may join. These players can then press space to send message to each other using “RPC’s”. This was just to try out if I could make one action visible for the other player to find out if they were actually connected.

The concept of RPC’s (Remote Procedure Calls) is something I had trouble grasping at first, but it turned out it wasn’t that hard to understand after all. They are almost the same as normals functions but with a few minor but important differences. They need one more extra parameter to know on what machines to run the functions on and the more parameters an RPC needs , the more network bandwidth involved will be used.

I’m now trying to create a master server so players are able to find public servers without having to know the IP address for the player who created the server. There are different services available for this but I’m not quite sure what I should use. Unity is able to provide a master server for testing purposes, but I have also found a great guide online where I can learn some more about different ways to set up a stable master server.