Reproducing Source engine realistic fire effects on model
2 Attachment(s)
Have the following code for testing. Idea is to generate random origin within a player's AbsBox and then trace towards the player origin horizontally until a hitbox is detected then send a sprite message there.
The problem is you I can't find a proper message to use with a transparent(additive) sprite and that would also have velocity parameters.
Currently tried TE_SMOKE and TE_PROJECTILE but both of them use IndexAlpha sprites which have only greyscale color support.
Also tried TE_EXPLOSION but 8 units per second vertical velocity is just too low to look anywhere close to realistic.
if (get_distance_f(fVecTemp, fVecOriginSprite) >= 72)
{
ftD7Log(_, _, "[client_PreThink] iID: %d. Trace distance is bigger than 72(missed the player).", iID)
goto LabelTraceStart;
}
if (fVecTemp[0] == fVecOriginSprite[0] && fVecTemp[1] == fVecOriginSprite[1] && fVecTemp[2] == fVecOriginSprite[2])
{
ftD7Log(_, _, "[client_PreThink] iID: %d. Trace start and end origins are the same(inside the player model).", iID)
goto LabelTraceStart;
}
//free_tr2(iIDTrace);
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, fVecOrigin, 0)
//engfunc(EngFunc_MessageBegin, MSG_BROADCAST, SVC_TEMPENTITY, fVecOrigin, 0)
write_byte(TE_BEAMPOINTS);
engfunc(EngFunc_WriteCoord, fVecTemp[0]) // x
engfunc(EngFunc_WriteCoord, fVecTemp[1]) // y
engfunc(EngFunc_WriteCoord, fVecTemp[2]) // z
engfunc(EngFunc_WriteCoord, fVecOriginSprite[0]) // x
engfunc(EngFunc_WriteCoord, fVecOriginSprite[1]) // y
engfunc(EngFunc_WriteCoord, fVecOriginSprite[2]) // z
write_short(g_iIDSpriteDot);
write_byte(1); // framestart
write_byte(1); // framerate
write_byte(1); // life in 0.1's
write_byte(2); // width
write_byte(0); // noise
write_byte(255); // r, g, b
write_byte(128); // r, g, b
write_byte(0); // r, g, b
write_byte(200); // brightness
write_byte(0); // speed
message_end();
iIDTrace = random_num(0, sizeof g_szSprites - 1);
// if Z origin is lower than X, subsctract some more.
// Smoke sprite
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, fVecOrigin, 0)
write_byte(TE_SMOKE) // TE id
engfunc(EngFunc_WriteCoord, fVecOriginSprite[0]) // x
engfunc(EngFunc_WriteCoord, fVecOriginSprite[1]) // y
engfunc(EngFunc_WriteCoord, fVecOriginSprite[2]) // z
write_short(g_iIDsSprites[iIDTrace]) // sprite
write_byte(random_num(1, 3)) // scale
write_byte(random_num(g_iCountSpritesFrames[iIDTrace] * 2, floatround(g_iCountSpritesFrames[iIDTrace] * 1.5, floatround_floor))) // framerate
message_end()
/*
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, fVecOrigin, 0)
write_byte(TE_PROJECTILE)
engfunc(EngFunc_WriteCoord, fVecOriginSprite[0]) // x
engfunc(EngFunc_WriteCoord, fVecOriginSprite[1]) // y
engfunc(EngFunc_WriteCoord, fVecOriginSprite[2]) // z
engfunc(EngFunc_WriteCoord, 0.0) // x
engfunc(EngFunc_WriteCoord, 0.0) // y
engfunc(EngFunc_WriteCoord, 30.0) // z
write_short(g_iIDsSprites[iIDTrace])
write_byte(g_iCountSpritesFrames[iIDTrace] / 10)
write_byte(iID) //projectile won't collide with owner (if owner == 0, projectile will hit any client).
message_end()*/
#define TE_EXPLOSION 3 // Additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// write_byte(TE_EXPLOSION)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_short(sprite index)
// write_byte(scale in 0.1's)
// write_byte(framerate)
// write_byte(flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // All flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // Sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // Do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // Do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // Do not draw particles
#define TE_PROJECTILE 119 // Makes a projectile (like a nail) (this is a high-priority tent)
// write_byte(TE_PROJECTILE)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(velocity.x)
// write_coord(velocity.y)
// write_coord(velocity.z)
// write_short(modelindex)
// write_byte(life)
// write_byte(owner) projectile won't collide with owner (if owner == 0, projectile will hit any client).
*/
georgik57
02-18-2020 03:47
Re: Reproducing Source engine realistic fire effects on model
up
DJEarthQuake
02-18-2020 23:54
Re: Reproducing Source engine realistic fire effects on model
TE_SPRITE
georgik57
02-19-2020 08:38
Re: Reproducing Source engine realistic fire effects on model
Doesn't have velocity
DJEarthQuake
02-19-2020 11:29
Re: Reproducing Source engine realistic fire effects on model
The old saying where there is smoke there must be fire.
That video only has the smoke. It takes blending of many particles or a Source grade animated sprite to take the work off the engine and programmer.
Take a look at the flame thrower mods. Smoke is just one of the many particles. It is not orange.