Events

Global Game Jam 2016: Space cake delivery!

Did someone order cake?!

In this 2D click adventure game, you deliver cake as you fly past the amazing sights of deep space! But day after day, the same old job stays the same. The money adds up, but to where? Levels are gained, but for what? Is there not something more out here? Will you be able to break free from your every day Ritual? By talking to the other creatures and listening to their advices, you will be able to increase your freedom within the game. Experiment and see what happens when you break your Ritual.

Check out our game “Space Cake Delivery” below.

Global game jam 2016 project page
Play it online here
Download it here from the playstore

Project Y

[ProjectY] Using the GameJolt API in Unity3D

Been a while since my last post, for my latest project I have been playing around with the GameJolt API. For those who don’t know GameJolt, it’s basically a platform like steam but then for indies. Currently GameJolt has been confirmed to run properly on PC and Mac builds, and also Webplayer and WebGL builds (source). GameJolt is a very easy way to incorperate a login and leaderboard system into your project. All you have to do is:

– in unity: import the GameJolt API package (download).
– in unity: add the GameJoltAPI prefab in your game scene.
– in unity: go to Edit -> Project settings -> Game Jolt API. You will need to set things here after you create your game at GameJolt (see next 2 steps)
– at GameJolt.com: create a game by selecting “+add game”.
ScreenHunter_132 Jan. 11 17.04
– at GameJolt.com: take note of a few things that you’ll need later to do requests and which are to be used in the settings: First you need to get the Game ID and Private Key which you have to fill in the settings which has been highlighted 2 steps back. You can find these at your API settings under the Game API tab (see image below). To get there you’ll have to go to your dashboard and select your game.
Then there is your “Game Token” and your “TableId”, you will need these to add scores and get your leaderboard. Your game token can be found at you user tab (see image above). To get the tableID you’ll have to go to your dashboard, select your game and go to the GameAPI tab where you’ll find the TableId under the scores selection.
ScreenHunter_135 Jan. 11 17.14

ScreenHunter_133 Jan. 11 17.04

For the standard login you can call: GameJolt.UI.Manager.Instance.ShowSignIn();
After that you can use  GameJolt.UI.Manager.Instance.ShowLeaderboards(); to show the overal leaderboard of your game. However if you want to get user specific data you’ll have to create a custom view and use GameJolt.API.Scores.Get(); to get data.

Example User specific highscore get:
GameJolt.API.Scores.Get(LeaderboardResult, _tableID, 5, true);

private void LeaderboardResult(GameJolt.API.Objects.Score[] scores)
{
for (int i = 0; i < scores.Length; i++)
{
Debug.Log(scores[i].PlayerName + ” – ” + scores[i].Value);
//do stuff with the scores here
}
}

 

other

Facebook SDK for Unity

Want to incorporate Facebook in your Unity game? have a look at the Facebook SDK for Unity it’s free, easy to use, contains examples and does what it promises :) note: currently in beta! (warning, does not support desktop applications yet!)

A quick setup:

– Import the assets from the above link into your project.
– Create a custom script to handle Facebook calls.
– Add using Facebook.Unity; so we can use the FB class
– Add using Facebook.MiniJSON; so we can process the received data that we get from the HTTP requests that we are going to do.

For everything else there are many example code and scenes in the added asset. Furthermore you can access the SDK documentation by going to Facebook > SDK Documentation:

FB_SDK

Some things to keep in mind / to do:

– For android builds, make sure the minimum API level is the same in both the projects manifest and the one you get from importing the asset, otherwise you will get a “Unable to merge android manifests. See the Console for more details” error when trying to build. The SDK uses API level 15 which is android 4.0.3 “Ice Cream Sandwich”. If you set your project API level to 15 (in build settings > player settings > android tab > other settings > Identification > minimum API level) then it should work fine.

– There are 2 ways to initialize FB. If you use: “FB.Init(this.OnInitComplete, this.OnHideUnity);“. Then make sure you’ve set the App data in the facebooksettings. Otherwise you’ll get a message stating “You didn’t specify a Facebook app ID.  Please add one using the Facebook menu in the main Unity editor.”

FB_SDK2FB_SDK3

– If you have trouble generating the android manifest and it’s saying “Keytool not found” then make sure you’ve installed Java and the JAVA_HOME variable is set right and you’ve added the right folder to the PATH variable.  You can access your system variables (on win10) by going to “this PC” and right click it and select properties > Advanced system settings > Environment Variables
ScreenHunter_114 Dec. 16 11.57 ScreenHunter_115 Dec. 16 11.58

Project Y

[ Project Y ] Bullet hell bullets system version 0.4

First things first, I decided to keep it a 2D game but started all over from scratch and building it up again. At the moment I have a working bullet system which I mostly have been polishing the last week. The result is that I can have around 2000 bullets on my screen before my frames per second (fps) drops to below 50-60. This is a huge improvement of the first version which only could hold about 400. Here is the version 0.3 which is only slight less efficient:

What I basically started out with was a simple system:
– a spawn script with bullet pattern coroutines in it which places an x amount of bullets over an y amount of time in a z degrees of rotation.
– a bullet script with constant forward movement attached to the bullet prefabs
– a simple object pool that pools the bullets that are not needed and where I can request new bullets.

This then evolved into a system where the bullet behavior are all regulated by 1 manager that does 1 update for all the bullets on the screen. Because having 1000 bullets on the screen all with their own update results in a extra 1000 updates which is not very efficient. After removing the script from the bullet prefab I immediately saw a performance boost, which was expected.

The last thing I did was giving the 2d prefabs their rigidbody back. Yes putting them back, I  initially removed the rigid bodies because I thought that would make it more efficient. But this is not true it seems. Thanks to Luuk pointing it out, it seems when you move an object with a collider and without a rigidbody, the complete static collision data needs to be recalculated, which is slow. So: what you should do, is to make sure that all objects you intend to move have attached rigidbodies,  if you don’t want the objects to be moved by the physics engine as me, then just set isKinematic on true. For best results, just use Rigidbody.MovePosition(). Which I did and BAM bullets on screen ++!

 

Pigeon shit

[ Pigeon shit ] Unity data persistence – serialization

After looking at the found options I decided to go with serialization and if feasible google play services. This because serialization basically supports everything and is easy to implement. You just have to make sure all the data that you want to save has the serialize tag like so:

[System.Serializable]
public class GameData { 
//all data goes here
//
}

And then you can save the data with a function like this:

using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public void Save(GameData data){
   BinaryFormatter bf = new BinaryFormatter();
   FileStream file = File.Create(Application.persistentDataPath + “/gamedata.gd”);
   bf.Serialize(file, data);
   file.Close();
}