Seasick Games Development Blog

16Oct/12Off

Unity and simple waypoints

Unity again! Yesterday I tried to make my player gameObject to follow specific waypoints. I have published the code at GitHub. Get it and Do What The Fuck You Want with it. I always wanted to release code under this license. Finally ^^

Code explained

It isn't much code, so it is easily explained. The UnityScript file contains two classes. First we will have a look at the Waypointer.

The Waypointer class has two public attributes

  • speed ... The speed with which you gameObject will move
  • scale ... The scale of the waypoint hitbox. It is needed to tell if your gameObject reached a waypoint

As you can see, the class also has a private attribute - queue. It will contain a Queue object. This object is basically a "First In First Out" list. We can add waypoints on top of the stack, and remove them from the beginning if your gameObject reaches a waypoint. Since this Queue object isn't imported in Unity by default, we need to do this our self.

In the Update function we are doing only one thing: Get to the first waypoint in the queue. Ok, it is a little bit more. We have to check if there is a waypoint, and we need to look into the direction of the waypoint. Here you have the chance to improve the performance of the script. It isn't necessary to set the rotation of your gameObject everytime - we could set it once we remove a waypoint (given that there is another waypoint in the queue).

There is also a function for adding new waypoints. As you can see, this function isn't called anywhere. You have to call this function when you want to add a new waypoint. That way you could use this UnityScript not only for your player gameObject - you could use it on any gameObject you like. Think about several selected soldiers ... Of course your collision detection between them has to be way smarter - atm there is none ^^

I called this method from another component. With this component I can click anywhere onto the screen, and a new waypoint is added. Have some code ...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#pragma strict
 
function Update
{
  // Check if a new Waypoint should be added
  if(Input.GetKeyDown(KeyCode.Mouse0)) {
    var playerPlane = new Plane(Vector3.up, transform.position);
    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    var hitdist = 0.0;
 
    if (playerPlane.Raycast (ray, hitdist)) {                
      var targetPoint = ray.GetPoint(hitdist);
      gameObject.GetComponent(Waypointer).AddWaypoint(ray.GetPoint(hitdist));
    }
  }
}

This AddWaypoint function will create a new gameObject with a BoxCollider. The public attribute scale will be assigned to the scale of the colliders transform. Also we will set the position and mark the collider as trigger. This way your gameObject won't bounce of it. After that we just enqueue the collider.

One important thing: We are also attaching the second class of this script to the collider. The Waypoint class. This class only has a OnTriggerEnter function which will check if the colliding object (normally your gameObject) has a Waypointer component on it. If so, it will use this component to tell it, that your gameObject has hit a waypoint.

And we are back in the Waypointer class. When your gameObject hit a waypoint, we just check if it is the first element in our queue. If so, we will remove it from the queue. Your gameObject will move on to the next waypoint.

Downsides

At the moment there are a few downsides to this approach:

  • It is possible that this isn't working on your iPhone. I didn't bothered confirmed it yet, but Unity on the iPhone is only supported to a specific .NET compatibility level. Anyway - this has been a great opportunity to get into the .NET classes.
  • It will only work on plane terrain - or at least it will look odd on bumpy terrain.

Improvements?

There is enough space for improvements.

  • You could add a default prefab which will be used instead of the default collider. This way you could place something visible (and good looking) onto your screen.
  • As mentioned before - you could tweak the performance a little bit.
  • Add the ability to remove waypoints. Have a look at the Queue or implement your own FIFO list in pure UnityScript.

Unity and Mono/.NET compatibility level

Unity uses mono for all its magic. You can even import some .NET classes and use them in your scripts. It doesn't matter if you are using UnityScript, Boo or C#.

I haven't got into this topic very far, but you can set the API Compatibility Level in your projects settings (in Unity 3.5 you will find it in Player Settings > Other Settings). For me there are currently two entries

  • .NET 2.0
  • .NET 2.0 Subset

You can see on this page which features are supported in which level.

Tagged as: No Comments
30Sep/12Off

Unity: First steps

So I wrote yesterday evening about unity. After I published the post, I started to make a little Jump'n'Run. I think it is a good way to get to know unity, because it covers a wide range of needed features:

  • Camera movement and controll
  • Controlling "the player"
  • Collision detection (unity does all the heavy lifting for you)
  • Triggering death and finishing a level
    • Loading new levels on success
    • Reloading the level on death
  • Collection points while running through the levels
  • Animation (I animated the "coins" to bounce up and down)

What did I learn from this?

  • When you want to do an animation on a prefab ("template" for assets) you need to create the animation on it, but you can only changes the values on an existing GameObject. Furthermore I noticed, that I needed the prefab to be contained into a parent. Otherwise the animation will work with absolute values, and all your GameObjects which inherit from this prefab, will be in one place (at least if you have a positioning animation). With a parent, the positioning will work relative to the parent. Took me a while to figure this out .
  • The community is great, and seems to be very noobie friendly (as long as you care to search first)! Every question I got was asked before, no need to ask for myself :)
  • Controlling the character takes a lot of time to tweak. And as you can see, I didn't managed to do it the right way. The controls are still a little bit blury.
  • There isn't realy much coding.

Today I tryied out the building options - As you can see I attached here a build of the web player. Control your "character" with WAD (yeah, there is no S :) ), jump with space. It is a bit small, but it demonstrates how quickly you get something to show with unity.

There is surly enough space to polish this up, but it wasn't ment to be a finished game. Just something to learn from.

Next up ... maybe I'll try a breakout clone. I'm sure there is something to learn from :)

Tagged as: No Comments
29Sep/12Off

Unity 3D … My next challenge

Again ... no posting for a longer period. Yes, I'am kinda lazy :) Dispite my lazyness I manage from time to time to get my focus on some things. This time it is Unity 3D. You may be familiar with it - it is "just another" game engine.

But this one is special. Not only there is a free license for it, you can build your games for Windows, Mac, Linux (with version 4) and the web. If you are willing to pay, you can even build for Android, iOS, PS3, Xbox 360, Nintendo Wii and Flash. Pretty awesome right? But wait there is more! There are no anual fees or royalties per title!

Unity will make all the heavy lifting for you

  • Rendering
  • Lightning
  • Terrain
  • Physics
  • Audio
  • Networking

The editor itself is very user friendly. Not sure yet, but for coders maybe a bit too friendly :) I'm used to use my Keyboard a lot - with Unity I need my mouse more often than usual.

A killer feature is the ability to start the current scene you are working on directly from the editor. You can even tweak some attributes and make changes while playing.

Unity also comes with a asset store, where you can purchase things like models, materials, audio, scripts, particle systems, editor extensions or even complete projects.

I'm looking forward to create somthing I can publish again :)

Tagged as: No Comments
15Aug/12Off

European GDC 2012 – Day 2

AAA goes F2P: Same skills, different mindset

The guy who held the talk, is a former journalism student, who didn't get a job as journalist and ended up in the AAA industry, participating on various titles like “Total War”.

Free 2 play is all about game mechanics. You need to earn the users will to pay for it. Only nice and shiny graphics wonts sell.

There is a “3 Minute Hook”, in which you need to be able to get the player into your game. Kinda remembered me of the low attention span from a talk yesterday (5 reasons …) - but in this case it was somewhat different. When a player buys a retail game in a store, he is paying 30-60€ for it. Don't playing it would be like flushing money down the toilet. So players are willing to give the game a try. In a F2P game, you won't have this generosity. You need to get the player hooked as soon as possible – otherwise you will lose him. He talked about that 70% of registered players will stop playing at the 4th day.

One of the hardest parts in F2P is the fact, that you have to deal with different players, who have a different background and skill set. This makes balancing very very hard. So you will need mechanics which will prevent the gap between those players becoming to big. That could mean bonuses for bad players and subtle mechanics to hold “too good" players back. But this could also be very dangerous.

Addiction is the key to keep players playing (and paying). There are several approaches to this

  • People want to feel needed, if there is nothing to do, they will stop playing
  • People need to feel, that they want to check on the state of the game. Is someone attacking me? Is my building ready?
  • Community!
    • It is easy to give up a game – but it is hard to give up friends. Even if you met them online.
    • Know what is going on in your “area” (Activity stream)

 

Secret souce for location based game's feature …

… learning from Shadow Cities. Shadow Cities is a game from a Norwegian company. The speaker didn't gave any numbers on their players, but told us, their game is played in over 40 countries (numbers would have been real nice).

Location based doesn't (exclusively) mean that you play on a real map where you are. Every game which handles real life locations could be seen as location based.

The speaker talked about eight key “ingredients”, when it comes to location based games.

  • The critical mass challenge
    • If no one is playing in your city, you will feel alone, and will stop playing. Deal with it! In Shadow Cities, you can teleport to your friends.
  • The sense of location
  • The open world vs. curated experience
    • Thus you have such a big world, you can easily feel lonley (critical mass), but it also can get cluttered very fast.
  • Stationary vs. movement
    • Most of the people play their game from home and work (76%)
  • Playing with neighbors
    • Strong emotions
  • Geodata
    • Where do you get your data from? Openstreetmap is a good choice, but isn't 100% reliable. Before you begin planning such a game, you need to have a look at the data, if it is even possible.
  • Infrastructure: Battery, positioning and latency
    • GPS is battery sucking bitch!
  • The brite social graph
    • Again it comes down to balancing. In location based games, it is even harder, because you could achieve a balanced distribution of power in a country, but does this make your city or neighborhood also balanced?

Post Mortem: Developing a city builing game ...

... thats ready for quick content iteration. That speak was a ... yeah ... SHIT! The outline for this talk seemed really interesting, but most of the topics were only touched slightly or never mentioned. In addition I often did not understand the speaker.

So here is what I could take from this talk

  • Lot of iterations
  • Minimize the gap between what the user wants, and what you provide
  • Parallelize planing & design
  • In order to scale design, the company shares all design documents with all the designers. Even back to 2005.
    • Every design decision could be understood

The Voodoo art of dynamic WebGL

Awesome talk, awesome dude (another guy who participated in making Lemmings (smile)). But I think I went over my head, when I went into this talk - since my knowledge of WebGL is very limited. Besides some IE9 bashing (using Chrome Frame is the only solution - every thing else isn't worth it) here a short list what I took away from this talk.

  • Your GPU is powerful - let it have it. All the time. You are doing something wrong (or you have so less to render (smile)), when the GPU has nothing to do.
    • Use batches of commands
  • Sprites (ok, nothing new)
    • When you make your sprites/texture pages, sort the pictures per size.
    • Big pictures first, starting in the upper left corner.
    • Add borders/padding to pictures to avoid unexpected behavior, when you scale an image.

Of course there was way more in this talk. Waiting for the slides (tongue)

Love engine postmortem:

Lean and mean C engine design. The guy who held this talk, kinda surprised me. He sees things very differently than most of us. The talk wasn't only about his engine - it was also about how you should develop things. There are a few quotes/things i want to share with you.

  • Great code is not written, it is rewritten
  • C++ should be named ++C if it really was any better than C
  • API is the key to collaboration
  • Code which makes fun to write should be written again, Code which doesn't make fun to write, should be written in a way it is reusable
  • Engine decisions affects the game design
  • Technology unlocks creativity.
  • Engines should be throw aways
    • Developing an engine is inexpensive (A couple of engine engineers vs. hundreds of artists)

Cheaters, hackers, script kiddies ...

... the dark side of online games. The talk started interesting, but as the speaker started talking about SQL injections, I left and decided to have a look at the dom of cologne (smile)

Filed under: Games No Comments
13Aug/12Off

European GDC 2012 – Day 1

First day on the conference. Main language is English - even some of the hosts volunteers only speak English. Not a problem - just mentioning it. Of course all talks are held in English.

So what did I listen totoday?

$100,000 Whales ...

... and introduction to Chinese browser game design. The guy who held the talk, is a former gold farmer who decided to go into the Chinese browser game market. In China there is a very competitive market around browser games. Every day, there are dozens of new browser games. The only way to get into this market, is to use a existing publisher which already have a big enough user base to monetize your investment. The downside of this ... they take up to 90% of the revenue. But 90% of $ 24,000,000 is still pretty much money! Per month! Another downside of publishing browser games in China with a existing publisher is, that you need to revenue your investment in two weeks. Chinese browser games are very fast living.

But how do they make so much money in such a short time? Not only the market is very very competitive, also the players are. Whilst western players have a little problem with "Pay To Win", the Chinese players don't. Players will buy gear to progress within the game, instead of progressing within the game to get gear. The better the things are you can buy, the more they cost. As an example: A pet in Tier 1 costs $5, Tier 2 $20, Tier 3 $125 ... and this goes up to Tier 10! So it isn't a big surprise (ok, it was for me :) ) that there are players (the so called "Whales") which pay $100,000 and more to be the best player on their server. Ranking is all to them. Every Chinese browser game has a extensive ranking. Not only who has the best gear - the list goes from "How many kills did someone have" to "How often did you pause to take a piss" ^^

Fun fact aside: It is possible to buy a "Bot", which will kill and farm while you are asleep. This bot is fully integrated into the browser game. So the users won't download a suspicious script, the will use the integrated bot, and will pay money for it :)

5 Things about American Online Gamers ...

... that will surprise european developers. The guy who held the talk, had nearly 25 years of experience in this industry. Cool guy, you can read more about him on his Wikipedia article.

  • The attention span is very very low. So you have to hold the audience attention for the first minutes, to get the into your game.
  • Reading level is very low in the USA (he excluded Canada explicit), thus you need to show instead of tell (as less text as possible)
  • Players are celebrities and want to be unique.
  • Recognize that we are in the queue, user is the master.
  • History won't sell ... Americans only know, that after the dark ages we got cars and plains, and that there were many wars in the last century.

Small Teams, Big Problems ...

... How to produce sustainable agile development for growing teams. The talk began later because of technical difficulties, so the speaker had to speed up the talk. Bad ass accent, fast but monotone voice. Sadly nothing surprisingly new. At that time I thought it would have been better if I watched the CryTek "My First Game with the CryEngine Free". But I wanted to go to see the ...

Core Games, Real Numbers ...

... Comparative stats for MMOs & Social games. I'm sure this talk was awesome ... I didn't see it .... To see this one, I would have needed another kind of ticket - which would cost 200 € more. So I decided to make a break, have a look at the bookstore, and wander through the "Expo Floor".

Free-to-Play game design is f*#!1ng awesome!

Very cool talk from the guys at Bigpoint! I hope I get the slides in time, because I don't remember everything - long day, and my scumbag brain lets me down.

One of the main takeaways for me from this talk, is that this business model will only work for a small portion of games. A $50M CoD could never revenue via F2P. He should us a formula - it was kinda like this:

Cost for acquiring user < Conversion * ARPPU * Lifetime * Virality (ARPPU = Average Revenue Per Paying User)

If you can manage to beat this magical line, you can buy your users and make money :)  Otherwise your model doesn't work, and you need to tweak one or more parameters.

The wonderful world of UX

How can we make games that resonate better and learn form approaches to music. Also a cool guy, works as producer for Ubisoft Singapore - studied music. What is UX? UX means "user experience". And this isn't the user interface only. It's about what information is presented in which way. How can the user interact with the information, and what do you want the user to feel? He compared the parts of an user experience with members of a band. As example he also compared UX with Jazz and Blues. A "Jazz UX" is very complex, not easy to understand, but can be very powerful. It may may even require some more knowledge. Strategy games and simulations are often "Jazz powered games". Blues on the other hand is kept very simple, and clear.

Jazz: Gran Turismo; Blues: Some arcade racing game, I forgot the name of :)

You definitely need to see the sheets.

Applying retro techniques to HTML5 development

Also a talk from a very expirienced developer. This guy helped making "Lemmings"! So awesome :)

The talk itself covered the following:

  • Avoid loops ... you don't say?
  • Images sprites ... yes we know them
  • Scrolling. Browsers are not very good at rendering and composing at the same time. So you need to render your stuff on a "shadow area", and transfer them back to your "main area".
  • Audio sprites. Not entirely new, but still something I didn't thought of
  • Floating point vs. fixed point. Isn't a problem on desktop machines, but it is on other devices. Smartphones, tablets and what not aren't that powerful as desktop CPUs.

CryTek GDC Night

I sat till now to write this post, and now I will get dressed, and head over to this party :)

Filed under: Games No Comments
12Aug/12Off

European Game Developer Conference

So I asked my employer if the company would pay for the trip to the European Game Developer Conference in Cologne . And he said yes - awesome!

I already arrived today, otherwise I would have missed the first sessions. The flight was fast, the airport a little bit confusing. I endlessly  walked around the whole airport to find the train station . The conference centre is only two stations away from the hotel. So it won't take too long for me to get there tomorrow. The hotel isn't the Ritz, but it is clean - I'm in the "Paris" room :)

Enough chit chat ... let us have a look at my agenda for tomorrow:

As you can see, there is much more tracks I would like to listen to - sadly I cannot fork or clone myself :/ Luckily, it seems the host is recording the tracks. But I'm not sure, if the recordings are covered by my access pass.

After this brain challenging day, there will be the "Crytek GDC Night" :) Looking forward to it ...

Filed under: Games No Comments
4Feb/12Off

Long time no see

Sadly I wasn't able to work on my stuff lately. Instead of figuring out how to move those brain thirsty zombies around, I was playing around with node.js (more on that another time).

I was thinking about writing something here, but what would it look like, if I came with empty hands? So I decided to push my first zombie game onto GitHub. I even found a name for the project ... "Zombie Zero". Now I am thinking about working again on those zombies. Maybe adding the possibility to save your highest score and even an cooperative multiplayer mode. I also thought about adding a kind of "calling home" feature. Not in a bad way! I just want to know about the users who are playing this game, to answer a few questions of mine:

  • How long do they play?
  • How often do they play?
  • What scores are they reaching?
  • Maybe even tracking the accuracy

Tracking is kinda "a bad thing" ... at least when you don't know about being tracked. So that should be an option to enable or disable as one likes.

17Jan/12Off

ZombieRage – current state

I made a short video of the current state the project I'm working on.

As you can see, it is not much, but its something :) The menu is working - even with settings, where you can change the window size. There is also an intro, but I was a little bit lazy to put this into the video also (it is just text - so you haven't missed anything). The zombies are walking in my direction, and as you can see, I used the sprites mentioned in my previous post.

The next part (which I tried to avoid in the video) is integrating a neat path finding algorithm. The first thing I stumbled upon was the "A*" algorithm. At the moment I'm not sure how I can get this into my code without having the frames per second dropping below 25 ... but as always - there is a solution out there :)

Tagged as: No Comments
15Jan/12Off

I found my zombies

The game on which I'm currently working involves zombies. In my last game, the zombies were only represented by boring circles. So I'm eager to change this - but my graphical skills are limited to a few things I learned decades ago.

Luckily there are many sources on the net, were you can get stuff for your projects. I've found a spritesheet for my zombies on OpenGameArt.org. I will use those for my current project - *braaaaains* :)

If you are searching for free stuff like those, you will find many different pages. There are a few good, but most of them are outdated and nearly dead. Have a look at a few sites I've been looking at:

12Jan/12Off

The first zombies

Did I mention, that I love zombies?! So the first game I wrote was a "kill zombies or be killed" game. Could it be, that 83 percent of all first games have zombies within? It had no textures (not counting the blood splatters I used in the menu) and no sound. The "ground" was light grey, the zombies dark grey, the player white and the bullets were yellow.

Drawing some circles onto the screen - yeah, what a challenge ... It got interesting when it came down to calculations on how the zombies should move. Probably any middle school kid would had laughed at me. But having to remember Pythagoras and his guys was serious business. But I managed to get along and get the zombies moving :)

My next challenge was collision detection. Without detection collisions the zombies wouldn't be able to catch me, neither would i be able to shoot them. In addition, the zombies would stack over each other. So whenever a zombie or any other entity changes its position, you need to check against every other existing entity if their outlines are overlaping. This easy aproach has also its disadvantages - the more entities you have, the slower it gets. There are ways to get around that - but more on that an other time.

To sum it up for you:

  • Kill zombies
  • Every round they are getting faster
  • Did I mention bullet time?

Executable package for Windows: Download
Source code: Download

Tagged as: , , No Comments