Raised This Month: $ Target: $400
 0% 

Q2 railgun effect w/ TEs?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-20-2007 , 20:41   Q2 railgun effect w/ TEs?
Reply With Quote #1

I'm sure a lot of you have played the game Quake 2 and used the Railgun. When shooting the railgun it gives a cool spiral effect. I wanted to know if it was possible to create a similar effect with a bunch of temporary entities (or a better method).

or...

Would it be possible to make one sprite give that same effect?

If you have never saw the quake2 railgun effect before then you can checkout these screenshots.

[IMG]http://img505.**************/img505/9863/rail1vu5.th.jpg[/IMG] [IMG]http://img341.**************/img341/2170/rail2bu9.th.jpg[/IMG] [IMG]http://img514.**************/img514/6582/rail4dm5.th.jpg[/IMG]
hlstriker is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 06-21-2007 , 13:48   Re: Q2 railgun effect w/ TEs?
Reply With Quote #2

Take a closer look at half-life 1 Gluon Gun. It generates some kind of spiral effect when you fire it.
__________________
Impossible is Nothing
Sylwester is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-21-2007 , 13:53   Re: Q2 railgun effect w/ TEs?
Reply With Quote #3

Thanks, Sylwester

I forgot all about that gun
hlstriker is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 06-21-2007 , 14:36   Re: Q2 railgun effect w/ TEs?
Reply With Quote #4

Yeah, the gluon gun uses a sprite based effect. Which incase you don't have the HL SDK, here's the snippet when the effect is called:
Code:
void CEgon::CreateEffect( void ) { #ifndef CLIENT_DLL     DestroyEffect();     m_pBeam = CBeam::BeamCreate( EGON_BEAM_SPRITE, 40 );     m_pBeam->PointEntInit( pev->origin, m_pPlayer->entindex() );     m_pBeam->SetFlags( BEAM_FSINE );     m_pBeam->SetEndAttachment( 1 );     m_pBeam->pev->spawnflags |= SF_BEAM_TEMPORARY;  // Flag these to be destroyed on save/restore or level transition     m_pBeam->pev->flags |= FL_SKIPLOCALHOST;     m_pBeam->pev->owner = m_pPlayer->edict();     m_pNoise = CBeam::BeamCreate( EGON_BEAM_SPRITE, 55 );     m_pNoise->PointEntInit( pev->origin, m_pPlayer->entindex() );     m_pNoise->SetScrollRate( 25 );     m_pNoise->SetBrightness( 100 );     m_pNoise->SetEndAttachment( 1 );     m_pNoise->pev->spawnflags |= SF_BEAM_TEMPORARY;     m_pNoise->pev->flags |= FL_SKIPLOCALHOST;     m_pNoise->pev->owner = m_pPlayer->edict();     m_pSprite = CSprite::SpriteCreate( EGON_FLARE_SPRITE, pev->origin, FALSE );     m_pSprite->pev->scale = 1.0;     m_pSprite->SetTransparency( kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation );     m_pSprite->pev->spawnflags |= SF_SPRITE_TEMPORARY;     m_pSprite->pev->flags |= FL_SKIPLOCALHOST;     m_pSprite->pev->owner = m_pPlayer->edict();     if ( m_fireMode == FIRE_WIDE )     {         m_pBeam->SetScrollRate( 50 );         m_pBeam->SetNoise( 20 );         m_pNoise->SetColor( 50, 50, 255 );         m_pNoise->SetNoise( 8 );     }     else     {         m_pBeam->SetScrollRate( 110 );         m_pBeam->SetNoise( 5 );         m_pNoise->SetColor( 80, 120, 255 );         m_pNoise->SetNoise( 2 );     } #endif } CSprite *CSprite::SpriteCreate( const char *pSpriteName, const Vector &origin, BOOL animate ) {     CSprite *pSprite = GetClassPtr( (CSprite *)NULL );     pSprite->SpriteInit( pSpriteName, origin );     pSprite->pev->classname = MAKE_STRING("env_sprite");     pSprite->pev->solid = SOLID_NOT;     pSprite->pev->movetype = MOVETYPE_NOCLIP;     if ( animate )         pSprite->TurnOn();     return pSprite; } CBeam *CBeam::BeamCreate( const char *pSpriteName, int width ) {     // Create a new entity with CBeam private data     CBeam *pBeam = GetClassPtr( (CBeam *)NULL );     pBeam->pev->classname = MAKE_STRING("beam");     pBeam->BeamInit( pSpriteName, width );     return pBeam; }

Not sure if that will help you at all.
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-21-2007 , 17:08   Re: Q2 railgun effect w/ TEs?
Reply With Quote #5

Thanks for that info SixTwin, but I can't seem to figure out what would cause the spiral effect of it. I thought maybe it was the "SetScrollRate" but isn't that how fast the frames go on the sprite?
hlstriker is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-22-2007 , 14:41   Re: Q2 railgun effect w/ TEs?
Reply With Quote #6

I was looking through the TE list and came across these 3...

Quote:
#define TE_BEAMTORUS 19 // Screen aligned beam ring, expands to max radius over lifetime
// write_byte(TE_BEAMTORUS)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)

#define TE_BEAMDISK 20 // Disk that expands to max radius over lifetime
// write_byte(TE_BEAMDISK)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)

#define TE_BEAMCYLINDER 21 // Cylinder that expands to max radius over lifetime
// write_byte(TE_BEAMCYLINDER)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_coord(axis.x)
// write_coord(axis.y)
// write_coord(axis.z)
// write_short(sprite index)
// write_byte(starting frame)
// write_byte(frame rate in 0.1's)
// write_byte(life in 0.1's)
// write_byte(line width in 0.1's)
// write_byte(noise amplitude in 0.01's)
// write_byte(red)
// write_byte(green)
// write_byte(blue)
// write_byte(brightness)
// write_byte(scroll speed in 0.1's)
Would any of those create an effect like that? I would test it out myself but I don't understand the axis coords, what are they for?

I also came across this...
Quote:
#define TE_TELEPORT 11 // Quake1 teleport splash
// write_byte(TE_TELEPORT)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
I noticed that had a bunch of little pixel looking 'things' to make the effect. Is there a way I can make my own effect with those same pixel things?

--------- EDIT --------------
I looked through the quake2 source and it looks very similar to halflife source @_@!

It seems quake2 used temp ents to create the railgun effect. I found a list of all the quake2 temp ents but can't seem to find the code that actually creates it.

Quote:
// temp entity events
//
// Temp entity events are for things that happen
// at a location seperate from any existing entity.
// Temporary entity messages are explicitly constructed
// and broadcast.
typedef enum
{
TE_GUNSHOT,
TE_BLOOD,
TE_BLASTER,
TE_RAILTRAIL,
TE_SHOTGUN,
TE_EXPLOSION1,
TE_EXPLOSION2,
TE_ROCKET_EXPLOSION,
TE_GRENADE_EXPLOSION,
TE_SPARKS,
TE_SPLASH,
TE_BUBBLETRAIL,
TE_SCREEN_SPARKS,
TE_SHIELD_SPARKS,
TE_BULLET_SPARKS,
TE_LASER_SPARKS,
TE_PARASITE_ATTACK,
TE_ROCKET_EXPLOSION_WATER,
TE_GRENADE_EXPLOSION_WATER,
TE_MEDIC_CABLE_ATTACK,
TE_BFG_EXPLOSION,
TE_BFG_BIGEXPLOSION,
TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!!
TE_BFG_LASER,
TE_GRAPPLE_CABLE,
TE_WELDING_SPARKS,
TE_GREENBLOOD,
TE_BLUEHYPERBLASTER,
TE_PLASMA_EXPLOSION,
TE_TUNNEL_SPARKS,
} temp_event_t;

Last edited by hlstriker; 06-22-2007 at 16:16.
hlstriker is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode