Tuesday, January 26, 2016

Me, me, magicka2!

So on we go as travelers in the endless (it seems) sea which represents my life. We have talked about school, early years, living abroad and a lot of stops on my career. And we will journey on now to that new job I was offered.



As the title might have told you it went to Skövde to work for Pieces Interactive hired on contract to work on Magicka 2. And I got a nice and well rounded role in a manner only a small/mid -sized company offers. I got to work in a lot of different parts such as tech-art and rendering/shaders, more pure gameplay, physics such as the rag-doll system, decals and the decaling system, water and how it freezes (this was a big one as you basically freeze water dynamically in Magicka so that you can walk on frozen parts, AI accounts for frozen parts, physics collide with frozen parts and so on, so basically it is no small task to implement the system to dynamically do this).

Anyhow I wanted to like have a stop on each of those listed topics and talk a little about my experience from them.

My role as technical artist

This is a bit of an overstatement as typically the technical artist is also an artist. My role were more in the render-programming family. I mainly worked on shader-code but also things like bringing in SSAO to the renderer and defining render-passes. Mainly I became sort of a consultant for the artists which defined as best they could how they wanted effects and I tailored them as best as I could. We basically had two options one über-shader and specific shaders. The bigger works I did in this area were for decals and for the water/ice shader.

My role as game-play programmer

I didn't do all that much gameplay actually but I worked a lot with the status system, which basically was the system handling statuses. Such as burning, wet, electified, frozen and so on and as anyone that have played any of the magicka games will tell you, there is a lot of deapth in spell-casting and statuses. I also feel that I might push into this scoop the game-pad work I did. I made the input handling for game-pad for the GDC exhebition and there are some pretty difficult-to-get-tight mechanics there. Basically you may tilt a percentage on your right stick to rotate but tilting full starts charging spells, and triggers beems and the likes. However when letting go of the stick there is another percentage threashold indicating casting the charged spell, or canceling the beam.

My role as physics programmer

I did some work on physics and the main area were for the ragdoll-system. Magicka is one of those games where spectacle things, powerful spells and whatnot is quite common. The ragdoll-system is in it's easiest parts just that, turning enemies (and the likes) into ragdolls upon defeat. So I didn't do much with that. The system I designed however were a bit more involved in how forces would effect ragdolls and how to apply forces on enemies becoming ragdolls. So every explosion and the like depending on type applies a huge amount of directed forces on ragdolls and this system ties it together.

My role as decal-system-developer

Best picture I could google showing some decals, and there actually are a lot of them it's just not always obvious.


This is something that kind of grew a bit bigger in a feature-creep fashion. Basically we had a system which didn't really do what we wanted. There is many decals in the game and there is different types of decals. Mainly there is static decals and dynamic decals, where dynamic decals are what you get for example when spraying fire. The system is a box-projection type decal and while I was doing it we realized that we might as well extend the decal shaders to make use of normal-mapping and specular-mapping. And this is not trivial as normals doesn't easily map in this fashion (because the idea of the boxed-projection becomes difficult as normals move up on the sides of the box). However I am quite happy with how it turned out.

My role as liquid-system developer

shows some of the effect of ice in the edges the alpha reference become lower and so you get the small islands.

This were a huge effort and it touched so many parts of the game as a whole that I were almost overwhelmed before putting it behind me. Basically there were liquid i.e. water which is a plane with many polygons and a shader to render water. However it also has to be a shader that renders ice. So first of all I had a bit sent to the shader defining how much frozen each vertex would be. So zero frozen would render water while moving up toward one (i.e. 100%) to be completely frozen. However how to handle the frozeness isn't trivial, I mean you can't really make use of alpha blending or anything because it will not look good. How we solved it is by using a "cracked" alpha from 0 to 1 and using the amount frozen as a 1-bit reference into that alpha-map telling us if we need to render or not, giving us small ice blocks when it's not solid, so when sending zero no ice will be visible, and when sending 0.5 we would have islands of ice visible while sending 1.0 would give a solid ice. This needs to render in two passes as we still want water in between the islands. So between two islands there is a kind of alpha gradient from one at one island, to zero in between the islands to 1 again reaching the next island, and the frozen-amount tell us which alpha-value to render a lower value goes toward rendering none of it, a higher value "creeps up" and make it feel like the ice builds up so to speak.

Adding to this physics need to be calculated if the polygons are frozen, but splashes and the likes needs to be created for when there were no ice. That was also a bit of a painful experience. :P I also had to create a way to interactivelly model the navmesh for dynamically change so that enemies could and would chase you out on the ice. Most work actually wen't into this system during my time at pieces and it must be one of the most complex and biggest systems I've ever written.

In the end we actually render highlights in a specific map on top of the water to get the white high-lights on the top of the waves, just to add to the complexity. ;)

It was really fun and I got to do so much different stuff working on Magicka 2. I will if it is possible get some development images and perhaps videos in later as edits or in a later post. Next time I will continue on telling you how we went back to Stockholm after my year at Pieces and how things progressed up till today. Then I can start focusing on the future once more!

No comments:

Post a Comment