April 28, 2014

Turtle travelling

Hello everyone,

These last days, I've been working on 2 new features in the game:
  • Travelling on the back of a turtle
  • Having a cyclic world (well, technically, this is a torus)
OK, these 2 features are slightly linked...

I - The Turtle


At some point in the game, the player can travel the whole world without restriction. Of course, this means he can't only swim because it would be waaaaay too slow. So I wanted to create a cool means of travelling... and, thinking about my creation creed "freedom, humour, oneiric", I chose to make him ride a turtle! I first created the 3D model in Blender and the texture in GIMP as usual.

Another texture far from optimized...

But creating a new feature is not that easy. A lot of questions are raised about this turtle:
  • How is it controlled? 
  • How fast should it be? How long would a player travel between islands without being bored? How can I reconcile this with the minimum necessary distance between islands to be sure that I don't clutter memory or slow down the game?
  • Can the player use items while being on the turtle back? If yes, which ones?
  • Can the player jump? Or crouch? Is it interesting/useless?
  • How can the player switch from the turtle riding to swimming?
I didn't answer to all of these questions, but I made a few choices. 
I implemented the same kind of controls for the turtle as for the player.
Using the Bo (the melee weapon) seemed kind of useless on the turtle's back. Range weapons, however, can be interesting for water fights. The problem is that shooting from the turtle back at high speed gives the impression that all projectiles are very slow in comparison... It's even possible for the turtle to be faster than an arrow.

So I set up 2 different travelling speeds:
  • At low speed, the player can shoot
  • At higher speed, no shooting is possible, but the turtle can quickly travel between islands.

The turtle in-game.

In order to give more feedback to the player while travelling on the turtle, I used lots of little tricks:
  • Foam and ripples behind the turtle
  • Little water splashes
  • Random bigger water splashes
  • Water trail behind the fins
And for the highest speed
  • Wind trails around the turtle
  • Shorter camera focal length
  • Fish eye effect to accentuate the speed feel

And in both cases, additionnal turtles randomly spawn around to accompany the player for a few seconds. This gives a bit of life to the travel!

Riding turtles!


II - Cyclic world


If the player can go everywhere on his turtle, this raises the question of the world limits. I can simply put some kind of uncrossable wall/mountain/obstacle at the edge of the map, but I don't like this idea. It goes against the freedom feeling I want to give to the player.

So I chose to make a cyclic/tile-able world. The idea is that if the player leaves the map on a side, it re-appears on the other side. Basically, this is a "simple" translation of the player. However, there is a lot of other objects to "teleport" to the other side of the map: particle effects around the turtle, other turtles, all the projectiles that the player can shoot, and of course the camera, which is a bit tricky, because it has a very smooth movement based on previous position and velocity that I must recompute after teleportation.

Another problem is that there is a specific kind of object that I can't translate: trails... because they are dynamically computed in the world space and I can't access the information of vertex position (this is a limitation of Unity, I guess because it is cached in the GPU in some way). So I can't move them, and I can't recreate them on the other side of the map by copying and translating vertex positions.
If I don't teleport the trails, this creates a very visible glitch during teleportation: they suddenly disappear. I finally chose to make them disappear progressively while the player approaches the map border, which is hardly noticeable.

If the player sails exactly on a border, a new problem appears: I don't want to teleport him on nearly every frame (this can be a heavy operation depending on the number of objects to teleport). So, I wait for the player to go past X meters beyond the map border before teleporting him to X meter inside the opposite map border. This creates an "hysteresis" behaviour which prevents multiple teleportation calls and drastically improves the frame rate on map edges.

Additionally, instantly teleporting the player and the camera can create a break in the ocean animation. To avoid this behaviour, I had to carefully tune all ocean texture scales to be sure the global period matches the world size, but at the same time I wanted to avoid obvious repetitions... Another compromise to make by playing with prime numbers!

I also had to work on a few other "little" things: adding wave/water sound while moving the turtle, creating the "horn" sound which is used to call the turtle (this will be justified in the story), collision tests with islands, ... I can't talk about everything here!
And here's how it feels at the moment:

You can notice the cyclic world thanks to the basic grass square island. Of course, in the end game, it will be real islands. This is only a technical test.

Finally, riding the turtle is kinda cool! Of course, I should add more objects on the ocean to give it more life (floating barrels, plants, barges, boats, fishes, and other sea animals), but, each time, I'll have to deal with the teleportation problem. I'll also have to carefully position islands far enough from the map edges so that they won't suddenly appear when the player is teleported.

See you next time!
Peace!





April 14, 2014

New Demo !

And here is the last demo of World of Thieves, a 3D adventure/stealth game between "Zelda" and "Beyond Good and Evil". Don't hesitate to test/share/reblog/comment/like if you want to help me!




Survey: Don't forget to complete the online survey after playing the game!
Bug hunt: As usual, contact me for bugs or any feedback.
Get all the news:if you don't want to miss anything, subscribe!

Install Notes


  • Linux

Under Linux, you have to change the execution rights on the game file:
chmod +x worldOfThieves.x86

If you use this 32-bit version of the game on a 64-bit operating system,
you may also have to install 32-bit libraries.
I was successful with the following commands:
On Ubuntu:
sudo apt-get install ia-libs
On Fedora:
yum install libstdc++.x86
... which doesn't seem to be the exact same thing. But it did the trick for me.

By the way, I noticed the game is really slow on my Linux systems. It was only playable with the lowest quality settings possible. Maybe this is due to my graphic drivers, but I'll have to test further. It even crashed at the beginning of the pirate warehouse level. Don't hesitate to tell me if you experiment such problems.

  • Mac OS

Haha... I didn't test on Mac, because I don't have a Mac. But the beauty of Unity is that I can release on Mac from a Windows system anyway.
So, if Mac users out there want to give it a try and tell me what's wrong (or what's right, hopefully ;) ), you're most welcome!


What's new since the last demo?


It's been 3 months since the last demo, so what's new you may ask? Well, probably nothing that you will notice :(... Because the main story, quests and levels are almost identical. So what did I do? I worked a lot on more core/fundamental stuff. This is the injustice of working on the development side... Almost all the work is invisible:

  • smoother camera moves
  • better camera collisions
  • lots of feedback added during fights: camera shake, blur, vignetting and chromatic abberations when a hit is taken
  • visualisation of sound waves on impacts
  • various post-processing effects: depth of field, bloom and screen space ambient occlusion
  • speech bubbles for the pirates
  • crouch position for the hero
  • blocking skills for the hero and the enemies
  • better collision tests for the climbing moves
  • charge animation for the hero mega attack
  • a few more items (not usable in the demo however): bomb, flute, cure fruit
  • hud/gui improvement for contextual actions, hints and help
  • 2 more collectable categories (not in the demo): ill animals that you'll have to cure (only sheeps at the moment) and flowers
  • control redesign for item use
  • black stripes during dialogs/cutscenes
  • fully open world with continuous dynamic background loading (you won't notice in the demo)
  • better path finding for enemies
  • music management system with music depending on the location of the player  and with smooth audio transition between zones
  • a few more buildings on Tera Island and some funky sheeps
  • re-recording of the intro music with better sound and rythm quality
  • music for Tera Island
  • shoot cool down for range weapons
  • different target icons for each range weapon (not in the demo)
  • game (and menus) playable with a joypad
  • fog with dynamic color changing
  • flag with physical simulation on the Thief Guild
  • redesign of the day skybox
  • better rendering of far away objects
  • dynamic light variation of "thin" objects (grass, ropes, ...)
  • better answer selection in dialogs



What's broken since the last demo?


You didn't expect everything to be better did you? I'm aware of a few bugs/regressions:
  • The inventory is a bit less functionnal: you have to use the keyboard to change the current page (missions/inventory/map) but the mouse to select items inside each page. And sometimes the current page changes when you click somewhere else.
  • The new camera positionning algorithm is nicer, but less stable. It totally crashes the game in some very specific locations and I can't spot why at the moment. I'm working on it...
  • On Linux, the image is locally reversed on impacts... This makes a strange effect.

 

Controls


  • ZQSD or WASD: move the character. It's both AZERTY and QWERTY compatible
  • Space: jump and climb
  • Shift: crouch and block
  • Mouse move: move the camera
  • E: weapon selection menu(useless in this demo)
  • Left click: main weapon (Bo) or contextual action
  • Right click: secondary weapon
  • Tab: inventory/map/missions


Have fun! Peace!

April 5, 2014

Music!

Hi everybody,

After a long silence, I'm going to talk today about music in the game, and more specifically how I make it. I recently tried to re-record the intro music because I had made it quite quickly in the first place.

I - First audio tests: Ardour


For the first music recording, I used the Linux software "Ardour", which is the "equivalent" of Protools, a famous recording software in the audio/musical industry. It may not have all of its features, but it was enough for me. I quickly described this setup at the beginning of this post.

The sound softwares are really great (and free) under linux, and they have a very different philosophy than the ones of Windows or Mac: they all rely on a "sound server" software (called JACK) which is designed to treat the audio information with a minimum delay to have a real-time response, but, above all, ALL audio softwares are compatible between them because they use the same Input/Output interface (relying on JACK, the sound server). So, under linux, each software has a speciality (audio recording, post processing, effects, synthetizers, drum pattern creation, score editing, midi recording) and you can mix them as you want, whereas on other OS, it is generally difficult to make softwares from concurrent companies communicate between themselves.


The incredibly powerful and intimidating interface of Ardour, the reference of audio recording softwares on Linux.

However, in my case, the problem is, Ardour is above all an audio recording software, which means it is designed to record REAL instruments, if you have the good microphones, and hardware setup. It is very powerful, and I recorded the intro music with my simple Yamaha Keyboard, but I'm not a perfect musician, and I could hear a lot of mistakes (on the rhythm especially). In this case, there is no other solution than to re-record again and again to correct the mistakes. Moreover, I am limited to the (poor) sound quality of my little keyboard, which sounds a bit cheap.It's not a big problem in the kind of video game I plan to do (because, except in big productions, it's quite rare to have a symphonic orchestra recording the music), nevertheless, this poor sound quality annoyed me.

Here is the first try of the intro theme recorded directly in audio from my keyboard:



If you can't see the audio player above, try this link
 
So after testing "real" instrument recording, I switched to another pipeline: MIDI recording.



II - The promise of MIDI tools


As a lot of compositors, I finally chose to use a MIDI sequencer in order to create the musics. I use LMMS, a simple but powerful software from the Linux world (again) but which works also under Windows.

[By the way, at the moment, I use it with Windows because my full pipeline production is a Windows-based (for development, graphics, audio...) but all the softwares I use also work under Linux... except Unity, my software development tool. But when they'll decide to port it to Linux, I can switch my full pipeline production under Linux for better stability while keeping the exact same softwares.]

Anyways, what is a MIDI sequencer?

A MIDI (Musical Instrument Digital Interface) sequencer is a software that enables you to write/record musical scores, but in a simplified version (not the real classical notation, even if it is sometimes also possible): when I "record"/"write", the computer doesn't actually record the SOUND coming out of my Yamaha keyboard, it records the NOTE, its PITCH and DURATION (with a few more informations), and it creates a simplified musical score with these notes. The 3 big advantages of this method are:
  • You can make many change AFTER having recorded the musical part: change the sound of the instrument by using what we call "soundfonts", change the tempo, ...
  • You can correct errors with a simple click on the score (move a note, change a duration, change the velocity...)
  • You can "quantize" the score, that is to say that every note is played with a perfect timing according to the tempo of the song (thus, there is no rhythm approximations).

Of course, not everything is perfect, but this new process simplifies a bit the musical creation.

For each recorded instrument part, you have to select a "soundfont". This is pretty much the same thing than a "font" for a text except it doesn't define how characters will look like, it defines how notes will sound. This is some kind of instrument bank. And there are lots of them on the internet, with different qualities, sizes, and instrument types. In the end, I've got many more sounds available than the simple sounds from my Yamaha keyboard, with a better quality too.


The LMMS MIDI sequencer. In the left window, the blue segments represent different pattern/melody parts. Each line is a different instrument with different settings. For each blue segment, you can modify it note by note on the right window (the "piano roll") where you can add notes, delete them, move them, change their duration or velocity... As you can see, it's not a real musical score; the visual representation is quite simplified and intuitive.

III - Installing LMMS


[This part is a bit technical, so go to the next one if you want]

So this seems quite cool, but setting up the software correctly took me some time, because I have a basic soundcard. Indeed, on Windows, the sound drivers always introduce some "lag" when recording from audio devices. It seems to be a known issue. Thus it is impossible to record from my keyboard because each note is systematically played 1/4 beat late. This drived me crazy.
Fortunately, the ASIO company has some kind of "generic no lag driver" which seems to do the trick. But this new driver seemed not to be supported by LMMS natively. I had to find a precompiled DLL driver library with the ASIO driver support and replace the native LMMS DLL driver library.
I wouldn't have had those problems under Linux, but this finally saved me a lot of reboots when working on audio composition.

However the version of LMMS I got also had a MIDI recording problem with soundfonts tracks (Haaa, free software ;) ). But the community is great, and a new version correcting the problem was released a few days after.

The last problem was using soundfonts. I found a huge soundfont with great quality but it needs more than 1.5 GB in memory (yes, you read well), and the 32-bit version of LMMS can't load it. So I finally had to re-setup my whole pipeline in 64 bits (LMMS + real-time DLL drivers). To this point, I still have a few audio output problems from time to time, but it's globally OK.

Achieving to have a "stable" setup is sometimes long and difficult, but once it's done, you can finally work! Because yes, until now, I haven't produced anything.

But after trying various instruments, learning how to use the software (I read the documentation and tutorials for a few hours), I finally could re-create the intro theme! And here is the same song than before, but recorded in MIDI with a better sound quality (I hope):



If you can't see the audio player above, try this link
 
All this work for this 1 mn of the same music... Depressing isn't it? But now I know I can easily create other music, and that's the good part. This first part took me several days to achieve, but after that, I created another test track in a few hours only. Meanwhile, I keep listening to the original soundtracks of my favorite games on youtube for hours to understand how they are built. Very enlightening :)


IV - Integrating the music in the game


Now I have musics of better quality, but how are they played in the game?
In the game, I created a few different "musical zones". When the character enters a zone, it starts the corresponding music (with a little fading-in for a smooth start). An when the character leaves, it stops the music.
But this is not as simple as that, because sometimes, I want a different music for a little cinematic taking place somewhere where there is already a musical zone. So I added some kind of priority information for nested musical zones. Moreover, I also have to deal with memory managerment (musics have a huge impact on memory use) and I must clean them when the character leaves a zone, especially now that the world is streamed into memory...

Anyways, that's the basic process of creating a music for a video game. That was a bit complicated to setup (especially using LMMS under Windows with my poor sound card), but this should be easier now to create additional musics.

Thanks a lot for reading until here, and see you next time, maybe for an updated demo!

Peace.

PS: The final news which made me depressed: the last version of Ardour (the soft I first used) now handles MIDI recording/editing... But I didn't see that before. Anyways, my work in MIDI is not lost, since I should be able to import it in the new Ardour version. I might give it a try one day, but I'll have to update all my linux installs. I guess I'm not finished with all that musical stuff...