Page 1 of 1
A few quick questions...
Posted: Fri Jul 23, 2010 11:21 am
by Choscura
Hi everybody, I've got a few questions that are a bit technical but not really under the category of tech support... I'm interested in the logic behind how some of the things in the myth games were accomplished. I'm sorry if this isn't the place for this, if that's the case please move it to the appropriate place.
First, I'm interested in how the blood/scorching effects were achieved. I haven't looked at myth in probably a few years but I do remember that the colors for the map were determined by a large bitmap image (right?)- so I want to know how the blood effects and scorches were overlaid this, and (to a lesser degree) how terrain effects like the 'ripple' on the ground when a wight explodes. Are these textures that are overlaid? are they painted onto a temporary copy of the bitmap that the map's ground colors are derived from? are they their own textures?
Second, how were the flying body parts dealt with? I remember being very impressed and even playing with this for a little while when I first played the demo on my imac way back when, but now I want to know how it's done. To be clear, I'm not just talking about heads and gizzards and such flying about when a character dies, but also about being able to affect the position of those organs after they have landed somewhere (say, by throwing a grenade at the ground next to them).
Third, how was health dealt with? the health bar always seemed very smooth to me, and looking at it now it looks like it might even have been a floating point value, but this seems illogical- floats were too processor intensive back then, weren't they? I'm less curious about this (although I still want to know).
And finally, a fourth (unrelated, non-technical) question: why hasn't Myth been re-implemented, maybe using something like the flat red ball engine (basically the same as the myth game engine, although I'm not sure about myth 3)? It seems like something that some CS student would do as a term project- do a quick import of all the sprites in TFL or SB, put them in, and twiddle the controls until everything behaves the way it's supposed to (or possibly even just import all the numbers on how things are supposed to behave and twiddle the controls to interpret that data accurately). I know there are legal issues with this and I'm not suggesting that it be done for any commercial purposes, but I'm surprised I haven't seen this done yet.
Re: A few quick questions...
Posted: Fri Jul 23, 2010 12:28 pm
by Deqlyn
Second, how were the flying body parts dealt with? I remember being very impressed and even playing with this for a little while when I first played the demo on my imac way back when, but now I want to know how it's done. To be clear, I'm not just talking about heads and gizzards and such flying about when a character dies, but also about being able to affect the position of those organs after they have landed somewhere (say, by throwing a grenade at the ground next to them).
When a Monster is destroyed killed etc... It has a certain death sequence and depending on how it was killed determines how the parts fall. These parts are then all seperate projectiles within a projectile group. For example a lightning strike death is different then a melee death by being scattered further charred etc... What determines the distance is the velocity and area of affect of the attack. Gravity therefore comes into play.
Third, how was health dealt with? the health bar always seemed very smooth to me, and looking at it now it looks like it might even have been a floating point value, but this seems illogical- floats were too processor intensive back then, weren't they? I'm less curious about this (although I still want to know).
Health bar is calculated by what you set it at. example. A warrior with 100 hp can take 20 hits from an attack that does 5 dmg(assuming no blocking occurs). It is all simple math with set values. You set the amount of HP you want a unit to have and you set how powerful an attack should be. The Health bar im, guessing, Slowly transitions its color the less health it has possibly by percentage values.
And finally, a fourth (unrelated, non-technical) question: why hasn't Myth been re-implemented,
Myth is owned by Take 2 it is their IP. Therefore if they do nothing with it, it is their choice. Due to copyright rules anyone cannot just take a game and remake it elsewhere.
I would suggest opening up Fear and looking at units to get a feel for how all this works. It is a simple tag collection system. As far as the scorching of ground and ripple effect they are all settings within myth that you can choose. Im sure Pyro can elaborate on this mystery of the keebler elves
Re: A few quick questions...
Posted: Fri Jul 23, 2010 3:51 pm
by Pyro
I can only explain the mapmaking technical side as I am not a programmer. In case you were looking for the programming techinical side of all this.
The map uses a bitmap that is 8bit (therefore 256 total colors). Some color slots must remain open so a mapmaker creates a colormap that uses 240 (maybe up to 245) colors total. The engine uses the rest of the color slots for blood and explosion stains. Each projectile that creates an explosion has a set image for the stain. Which is why an explosion stain from a dwarf bottle is different from a fetch lightning strike. These explosion stains are just grayscale images saved in the collection of sprites that make up the unit. I can only imagine the remaining colors are various browns and blacks as well as a red for blood.
If a projectile is meant to be bloody, there is a flag that can be checked that will let the map stain with blood when this projectile hits the ground. So when you see units bleed. You are seeing them drop projectiles that are suppose to look like blood. They die off when they hit the ground leaving a blood stain.
As for mesh effects like ripples in the ground due to explosions. No images are used for this, there are some settings that will alter the actual ground and make it ripple out like that. You could even make mesh effects for stuff that are not explosions so that arrows create ripples in the ground and other non-default behavior.
As for flying projectiles, when a unit dies it creates a projectile group which is just a tag lists multiple projectiles (or just one). Depending on the attack that killed the unit, there are a few choices. If a unit suffers a "soft death", it uses the proj group set for that. A soft death can be achieved from things like melee or kinetic type attacks (swords and arrows). A "hard death" can be achieved from explosions and lightning type attacks. There are other types of attacks, but you get the idea. In a soft death, most units use a projectile group that drops a dead body. In a hard death, instead of a dead body it drops several body parts. The mapmaker can set where they appear. For legs you would use a low value like 0 or even 0.1. For the head you would use a higher value like 1 or even 0.9. These values will dictate the height they are created relative to the unit they are being created from.
Each projectile has its own health, inertia, gravity, etc. So you can make a head projectile easily movable for an explosion to move it from its resting place. If the explosion is too strong it can kill the projectile and cause it to detonate to a projectile group of the mapmaker's choosing. (like a bunch of blood projectiles)
As for why Myth hasn't been reimplemented, there are different reasons. Legal issues, motivation, and lack of need for it. Why re-implement it when you can update the game to have little more than it used to? Less work and no worries about legal issues.
Re: A few quick questions...
Posted: Fri Jul 23, 2010 4:57 pm
by Melekor
Choscura wrote: how the blood/scorching effects were achieved. I haven't looked at myth in probably a few years but I do remember that the colors for the map were determined by a large bitmap image (right?)- so I want to know how the blood effects and scorches were overlaid this, and (to a lesser degree) how terrain effects like the 'ripple' on the ground when a wight explodes. Are these textures that are overlaid? are they painted onto a temporary copy of the bitmap that the map's ground colors are derived from? are they their own textures?
There is one large texture that covers the whole map. This texture has two "component layers": color and shadow (8-bit paletted, 8-bit greyscale respectively). Stains and blood are done by drawing right onto the texture. Stains can have color or shadow components, or both. There is no need for a temporary copy, because the operation doesn't need to be undone - once the mesh is stained it never gets unstained. (except when restarting the level, then the original will be re-read from disk.)
Moving shadows and lights are a different story, as they are not permanent. For this, a temporary copy of the shadow layer is made whenever the scene changes (roughly speaking), and all the non-permanent shadows (unit shadows, animated models etc) and lights (flickering torches, dwarf bottles etc) are drawn onto that temporary copy.
Finally, the temporary shadow component and color component are combined into an RGB texture suitable for 3D hardware to use while drawing the mesh.
The mesh effects like the wight explosion are just 2D functions applied to the mesh (additively). mesh'(x,y,t) = mesh(x,y) + effect1(x,y,t) + effect2(x,y,t) + ...
Second, how were the flying body parts dealt with? I remember being very impressed and even playing with this for a little while when I first played the demo on my imac way back when, but now I want to know how it's done. To be clear, I'm not just talking about heads and gizzards and such flying about when a character dies, but also about being able to affect the position of those organs after they have landed somewhere (say, by throwing a grenade at the ground next to them).
I'm not familiar with this part of the code so all I can say is: basically, it's a physics engine.
Third, how was health dealt with? the health bar always seemed very smooth to me, and looking at it now it looks like it might even have been a floating point value, but this seems illogical- floats were too processor intensive back then, weren't they? I'm less curious about this (although I still want to know).
This question is equally applicable to all of the other aspects of the game that would appear to use floating point numbers. The answer is that Myth makes good use of fixed-point arithmetic (16 bit or 32 bit depending on the situation) for all of these purposes.
Re: A few quick questions...
Posted: Sat Jul 24, 2010 4:59 am
by Choscura
Thanks for all your replies, this has answered my questions very well.