maandag 31 oktober 2011

Stunt Double

A few posts back I mentioned we were working on a new game prototype which was basically a downhill ski-game with a special twist. Well the special twist is that in this game you're driving a car downhill while slaloming, grinding and jumping insane ramps!! It's like SSX but with cars! 

The prototype proved to be quite fun to play so we got a go on this project.
There was one problem we've soon noticed while playing the prototype: the car stunts looked a bit boring when the cars only turned, rolled and twisted in the air. It missed that extra wow factor you need in an "extreme sports" game like this. 
Another problem is that cars can't really give the player any feedback when successfully performing a stunt, we could have shown some sparks or particles but that wouldn't look very impressive. 

Then someone here got the ingenious idea to turn the cars into cabriolets and put two characters inside. Now we're not only limited to car stunts but we can also add character stunts and even combine them. This change made the game instantly more fun to play and by adding the characters we can give the player much more feedback by making them wave, cheer and shout. It also adds to the overall arcady feel of the game.

Work in progress image of the two characters inside a dummy car.
One of the drawbacks is that this decision does add to the complexity of the game, beside relatively simple the car animations we also have to animate two separate characters which also have to interact with the car and each other. We do think this extra effort will set this game apart and make it much more attractive and fun to play, I guess we'll know in a few weeks when the game is released.

-Matt


woensdag 26 oktober 2011

Shootin’ Cybertrash!

Hello all!

Let me first introduce myself, my name is Eugène and I now work at Xform for several months as a 2D/3D Artist and it’s a hell of a job! :D

 I’m going to tell you about my first project here. It is an unannounced game, not released yet. I am not sure if I can talk about it or show much of it.
But what I can tell it’s a “Browser Based Side Scrolling Gun and Run Action Shooter” game with 3D graphics! We tried to give you  the feeling that you are playing an old school 2D Shooter game of the Nes/Snes era! So expect a difficult game!

It takes place in a destroyed Earth and you have to make your way through hordes of enemies and tons of explosions with a kick ass character! This game will rock! Ha!

For this project I’ve been working  on the levels, menu’s, modelling and texturing stuff, placing dummies (enemies in game) etc.  In every level you will face enemies, hard jumps, upgrades  and more. Some enemies are placed  in really sneaky places where you don’t expect them!

Here is a sneak peak of one of the levels.


This is a print screen of my viewport in 3DS Max. You can see some dummies which are in the game enemies. The big blue boxes are “camera triggers”.  If u pass these objects (you won’t see them in game so don’t worry)  the camera will zoom towards or away from the player to gain a better view of your surroundings and what lies ahead. The explosive objects.... I think those things don’t need any explanation of what they do!


This game is going to be called “Shootin’Cybertrash”. We will keep you updated about this project. And wish you all good luck in completing this hard game hehe, when it is released of course. J

Well this was a little introduction of myself and the game where I’ve been working on.  Next time I’m going to talk about the project where I’m working on now. 

Greetings, 
Eugène

woensdag 19 oktober 2011

Jumps!

This week I've been working on a 3d mockup environment for a new project. It is going to be a car game. I can't tell you that much about it yet though.
The game does feature big jumps, they are actually a big part of the game. These jumps should be easy, spectacular and inviting for the player to take. The player should be able to just drive on a ramp, perform the jump and land almost perfectly on the other end without much of trouble to continue driving. It was my job to test several jump setups using the mockup to see what kind of distances, heights and speeds we should use. We also wanted the jumps not to be too low in height, it should look spectacular!

The first step I took was to gather information of what we already got. I already had a test version of the game with the main physics up and running, so I could check how the car behaves on the mockup. I knew that our car has a certain speed at the moment of jumping, behaves in a certain way in the air and while landing. I was not able to change the car speeds/handling for this test. I started by just setting up a simple jump over an imaginary river or cliff. I used big numbers to quickly test what works and what doesn't. For example, the first jump I made was planned to be 10 meters in length. This jump felt way to short, I instantly jumped over the landing zone. Therefor I increased the length by, easy numbers, 10 meters. So now I had a jump of 20 meters in length. 


This was already more like it, but still a bit to short. Most of the time I still landed to far over the landing zone, so the distance wasn't far enough and I increased it by another 10 meters. This did the trick and I was now able to land pretty much perfect in the planned landing zone. However I wasn't pleased by the height of the jump, it wasn't high enough. I started tweaking the ramp, to get more height out of it. First I tried 'straight'  ramps, not curved. This worked fairly well but gave a harsh ' bump' while driving on the ramp when it got steeper. Curved ramps was the solution, and gave the car a smooth ride into the air.

Now the jump was looking good and it felt 'big'. However changing the height of the jump also influences the jump distance. I reduced the jump length by 5 meters, and reduced the angle of the ramp slighty which gave a perfect jump with good height. The hard part is to give the player enough air time to enjoy the view as well as making the jump not to short in length. I hope to be able to tell you more about this game soon, it is going to be a pretty interesting project :)!
 
-Joep


donderdag 13 oktober 2011

Skidmarks!

Hi!

It’s been a long time since I wrote something. Too be honest I didn’t have anything worthwhile to write about as I was hands deep in deploying our new augmented reality kart racer. Play it on www.redbullformulaface.com. It is great fun!

At the moment I have a bit more time to look into other things. A couple of years ago we did a small kart game (http://www.shockwave3d.com/gamepage.cfm?id=794) which was extremely fun to work on.

The last few years we occasionally put some time into expanding it, so we have quite some stuff lying around to make a ‘new’ game. Well, we’re not actually remaking it… it is not really a sequel… it is more a ‘rebuild’ with additional stuff. Nevertheless, it was time to finally upgrade and implement skidmarks!


I’ve been tackling skidmarks for quite a while now. I found it to be harder than I would like. Not really the technique behind it, but more in an Adobe Director kinda way. There were three options I looked into.

1.       Create small transparent planes at the bottom of each wheel. Place them each frame or after a certain threshold distance compared to its last stored position.
2.       Draw into a texture. Have an additional texture layer and paint in it where the wheels are. If you have a lightmap texture you could also draw into that one, I think.
3.       Build a mesh trail.

Honestly I didn’t do any real stress testing on the first two as I already knew they weren’t really viable. Although I’d really like solution 2. In the end there shouldn’t be any performance issues on how many skidmarks you have and above all they will be displayed indefinitely! Solution 1 and 3 need to be ‘tempered’ so performance won’t drop too much.  Unfortunately, I still think it might be too slow to do any additional raycasting and lookups to know where you should draw into the texture. Furthermore, you can’t directly draw to any texture in the VRAM in Director, so when updating skidmarks you constantly have to send the texture to the VRAM as well. You’d also want a decent texture resolution or else your skidmarks would look like huge blobs. All in all this will cost too much CPU power and performance will drop. A cool solution, but currently not feasible. I went with the 3rd option.

A couple of our games feature rockets. The rockets leave a trail behind when fired. I used this as a base to create a skidmark feature. The very first version of this effect would rebuild an entire mesh each frame (or each update). Meaning the mesh could become very large, complex and time consuming to update. I rebuild this effect with two optimizations.

1.       The mesh uses a maximum amount of vertices and faces. It is created as a long segmented plane. I build this mesh beforehand (or sometimes I store more of them to be used and reused) so we can avoid any performance drop when creating a skidmark. The downside is that the mesh and detail is limited. So a trail or skidmark cannot be very long. The mesh will also get 2 sets of texturecoordinates (and a new shader). The first layer is a tileable texture. The second one a transparent texture (a gradient), so we can fade the trail at the end.
2.       All vertices are initially placed at the location where they should spawn. Each frame (or update) all 2 vertices (of each segment) will get the position of the 2 vertices (previous segment)  before them in their vertex list. So i.e. vertex 5 and 6 will get position 3 and 4. The only exceptions are vertex 1 and 2. This will be set to the source of the trail/skidmark. So each update we 'move' the mesh 'along' the previously stored positions.




These updates made it much faster. So ‘fast’ that at my current work machine I can have multiple sets of skidmarks for 8 cars at the same time. Not sure if this will make it into the final game, but it is worth testing J

-Pieter

woensdag 5 oktober 2011

A math problem

Dear readers,

Today I'd like to write about a little math problem. Pieter came to me asking if I could find a function with some desired properties. To give a simple example of why this could be useful: Suppose you want to make an animation of an object bouncing by simply changing the y position of the object. For this you could use a function that given a certain time in the animation returns you a number which you can use as the y position of the object. You can easily control the animation by adjusting the function and you can also easily skip to any part of the animation.

Now for the problem: Pieter wanted a function f(x) where the following properties hold: f(0) = 1, f(10) = 10 and somewhere between x = 0 and x = 10, let's call this t, the function should reach it maximum point at 12, so f(t) = 12. The image below shows the function he was roughly looking for:
The red line shows the possible function. The blue dots represent f(0) = 1 and f(10) = 10. The green line represent y = 12 where the function should reach it's maximum, we call this value t.

Now we could of course use a spline that is fitted to the function, but this is not as efficient (or as fun) as a parabola. A parabola is a second degree function of the form: f(x) = ax^2 + bx + c. So how do we find the a, b and c values? We start by substitution of the desired points. For f(0) = 1, this becomes: f(0) = c = 1. So c = 1, that was easy. Now for f(10) = 10: f(10) = 100a + 10b + 1 = 10, simplified to: 100a + 10b = 9. We have 2 variables here and only 1 equation, to solve for a and b we will need another equation. The problem now is that we don't know a third point which would give us another equation. We could try to just guess a point, for example f(6) = 12, but the resulting function will not have it's maximum at y = 12, but higher.

The crucial thing here is to realize that when we reach a maximum the derivative of the function in that point is exactly 0. For a parabola the derivative is of the form: f'(x) = 2ax + b. We can use this to get another equation as we want to reach our maximum at t (it does not matter where t lies as long as it's between 0 and 10). So we want that f'(t) = 0. Using substitution we get: f'(t) = 2at + b = 0. Good, now we have the 2nd equation we were looking for and can solve for a and b you might think. But unfortunately we've added another variable t, so now we have 3 variables and 2 equations! That didn't seem to help us very much then... But wait :) Let us now try to express a and b using t. Using the equations 100a + 10b = 9 and 2at + b = 0, we can express b as b = -2at, plug this into the first equation to get 100a - 20at = 9, from which we get that a = 9 / (100-20t). We can then substitute a into b = -2at to get b = -18t/(100-20t). So now we have our a and b expressed as t to get the following function: f(x) = (9 / (100-20t)) x^2 -18t / (100-20t) x + 1.

Now remember that t is the point where the function has its maximum which we want to be at 12, we can express this as: f(t) = 12. From this we get another equation: f(t) = (9 / (100-20t)) t^2 -18t / (100-20t) t + 1 = 12. We simplify this and get: -9t^2 + 220t - 1100 = 0. We solve this using the abc-formula and obtain two values for t, namely t1 = 7.011 and t2 = 17.43. Clearly t2 is not between 0 and 10, so we pick t = t1 = 7.011. We then plug t in to a and b and get the final function: f(x) = -0.22377 x^2 + 3.13769 x + 1. Which can be seen here:
The final function with the desired properties: f(x) = -0.22377 x^2 + 3.13769 x + 1

-- Stijn