Inside3D!
     

Wanted: Smokescreen Grenade
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Sat Feb 28, 2009 6:26 pm    Post subject: Wanted: Smokescreen Grenade Reply with quote

Hi Quake Gurus,

Hello there!! (My first post here!) Smile

I'm not a programmer. I know basic C, but am a total newbie when it comes to Quake C. I run an event called the Weekly AGR Session, which uses variation of a Quake1 CustomTF called AGR. We're currently doing a little 'code housekeeping', and I would LOVE to introduce a new type of grenade - the 'smokescreen grenade'.

I don't know if any Guru has programmed such a thing, or even if it's possible, but here's the idea: A gren that throws a cloud of smoke which is opaque (non-see through). The purpose of this gren is to be thrown in open areas to give players cover from sniperfire. Throw, after 3 seconds it explodes , 1 sec as cloud forms, 5 secs total cover, 3 secs till it clears. You can't see inside the cloud from the outside, maybe it's slightly (10%?) transparant. Can this be done? Is this possible? The closest thing I can think of is the gas grenade used by spies in TF, just need the cloud bigger, and opaque.

Someone on irc mentioned that it could use the same method as the pyro 'fire' to create a non-see through 'ball of gas' effect.

I know inevitably it will be thrown indoors as well, and I'm not sure what to do about that. It needs to be big enough to give *some* cover from snipers in open areas (eg the bridge in 2fort5), but somehow not turn the inside of the base into a big mess. Solutuions include making it so people can only carry one, making them really expensive, or even make it so they won't work unless theres a 'sky' directly above ...(?)

Anyway, these issues can be solved later, the main thing now is the actual effect.

Can it be done?


OneManClan
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Sat Feb 28, 2009 6:33 pm    Post subject: Reply with quote

It all depends on which engine is being used. In stock quakeworld it's pretty difficult to get a realistic smoke grenade effect, but with custom engines it's a much easier task.
_________________
Apathy Now!
Back to top
View user's profile Send private message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Sat Feb 28, 2009 6:45 pm    Post subject: Reply with quote

Hey there,

MauveBib wrote:
It all depends on which engine is being used.


It's Quakeworld, CustomTF, using cpqwsv.exe as server.

MauveBib wrote:
In stock quakeworld it's pretty difficult to get a realistic smoke grenade effect, but with custom engines it's a much easier task.


Yes. As I said, the closest thing is the spy grenade. Thing is, I dont even recall opaque smoke even in Half Life. It was misty looking, but you could always clearly see through it.

I suppose it doesnt have to be 'realistic', as long as it does the job without being distractingly lame.


thanks for the response


OneManClan
ps The Weekly AGR Sessions are held every Sunday at 22:00 GMT at tastyspleen.net:26666. All Killer, No filler old skool TF action! Smile
Back to top
View user's profile Send private message
leileilol



Joined: 15 Oct 2004
Posts: 1321

PostPosted: Sat Feb 28, 2009 8:53 pm    Post subject: Reply with quote

your best bet is to spam sprites, CS-low-detail style (which is opaque smoke)
Back to top
View user's profile Send private message
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Sat Feb 28, 2009 8:56 pm    Post subject: Reply with quote

Or a series of concentric spheres. Either will look awful, but will do the trick.
_________________
Apathy Now!
Back to top
View user's profile Send private message
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Sun Mar 01, 2009 6:10 am    Post subject: Reply with quote

leileilol wrote:
your best bet is to spam sprites, CS-low-detail style (which is opaque smoke)


Ah. Is there an example of this I can see somewhere?

MauveBib wrote:
Or a series of concentric spheres. Either will look awful, but will do the trick.


How awful?

Thanks for the responses guys. The thing is, I only run the server, and am only a humble newbie programmer. I looked at the tutorials section, hoping someone has already coded such a thing, but couldn't see anything.

I'm hoping there might be some Guru ( or aspiring Guru) here lookin for a challenge. I can promise you an audience of quake gurus using (and appreciating) your work every Sunday!


OneManClan
AGR Session FAQ
Back to top
View user's profile Send private message
scar3crow
Inside3D Staff


Joined: 18 Jan 2005
Posts: 837
Location: Las Vegas, NV

PostPosted: Wed Mar 11, 2009 4:49 am    Post subject: Reply with quote

Since you're thinking only from the server perspective, there is no telling what your clients would be using, so you will have to assume a baseline of stock Quake, so nothing fancy like .alpha or using a nice higher res tga (which rules out keeping it from being ugly, honestly). I can't think of any spr files that come with stock Quake which would be suitable for this, so it will require a new file for your clients.

Regarding making sure people use it outside... before it begins the smoke emission, you could have it trace upward so many units to see if the contents it hits are sky... if not, have it print that it fizzled out, and either return the grenade to their inventory, or be a hardass and just have them lose the grenade. Granted, this is kind of silly, unless it was some photon powered by smoke grenade... ...which is even more silly really.

So what you want is a +gren3 I'm thinking, and if I understand correctly, you want 5 seconds of "full coverage" with staggered evaporation so all of the smoke doesn't just immediately go away.

What we see in many games is an entity which spawns particles with a sprite attached, these are usually made to look much nicer by having the sprite animate, and also having it rotate slowly, scale slowly, and fade out over time - if this was for a mod exclusive to something like DarkPlaces or FTE, this would be quite feasible, but since we have to assume stock Quake, the best you're going to get here without getting really hacky is the animation part.

So we need a grenade entity, which 3 seconds after spawning, will begin to emit particles. These particles should probably use MOVETYPE_BOUNCE so if used indoors, it will cluster better, and not just line the walls. It is up to you if you want the smoke to flow in one direction (as it would in any mildly windy circumstance), if so, make the variation on the angle of spawning the particles very narrow, otherwise, feel free to make it quite random - or pattern based if you wish (I assume you want the smoke to radiate out from the grenade, using the grenade as a central point). On the spawning of the particle, you should keep the velocity low, but add in a little use of random to make it look more natural, and less uniform - at this point if you are using a spr with animations, you would begin the animation counter.

I would recommend having the grenade think 6 times, twice a second, so after 3 seconds past the initial explosion, it is no longer emitting particles. Give the particles a lifespan of 5 seconds, this way 8 seconds after the grenade has gone off, the space should now be clear, and it is a compromise between the grenade streaming the smoke, and spurting the smoke.

So, grenade, 3 seconds after existing, it begins the SmokeCloud function, SmokeCloud has a think of spawning a group of particles, with smoke art attached, for each spawning, tweak the angles mildly and the speed mildly. SmokeCloud thinks this with a nextthink of time + 0.5, and an iteration of emitcount + 1, where when emit count > 6, the process ends. The particles that SmokeCloud emits have a counter on spawn every second which when it hits 5, they remove themselves. The particles are MOVETYPE_BOUNCE, and if the art has frames, increments these frames. If you're willing to exclude stock Quake players, this is the part where you would be decrementing the alpha on the sprite for it to fade out, rotating it, and increasing the scale, which would improve the look of it greatly.

Hope this helped more than it confused!
_________________
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
Back to top
View user's profile Send private message AIM Address
OneManClan



Joined: 28 Feb 2009
Posts: 62

PostPosted: Wed Mar 11, 2009 11:14 am    Post subject: Reply with quote

hey scar3crow,

Thanks for your post. I've read it a few times and it does stretch my brain to its' newbie limit. I'll respond as best I can. Note I refer below to the 'current gas grenade' used in AGR CustomTF which can be checked out at the (quakeworld) tastyspleen.net:26666, though if people haven't downloaded CustomTF, they had best get it here.
scar3crow wrote:
Since you're thinking only from the server perspective, there is no telling what your clients would be using, so you will have to assume a baseline of stock Quake, so nothing fancy like .alpha or using a nice higher res tga (which rules out keeping it from being ugly, honestly). I can't think of any spr files that come with stock Quake which would be suitable for this, so it will require a new file for your clients.

Most use either Ezquake, or Fuhquake. I know they can download new models, and sounds, so I assume this would also apply to new graphics files. If not, most players are on my mailing list and I can send them the relevant info.
scar3crow wrote:
Regarding making sure people use it outside... before it begins the smoke emission, you could have it trace upward so many units to see if the contents it hits are sky... if not, have it print that it fizzled out, and either return the grenade to their inventory, or be a hardass and just have them lose the grenade. Granted, this is kind of silly, unless it was some photon powered by smoke grenade... ...which is even more silly really.

'Sky test' is brilliant, and the 'fizzle out' sounds good!
scar3crow wrote:
So what you want is a +gren3 I'm thinking, and if I understand correctly, you want 5 seconds of "full coverage" with staggered evaporation so all of the smoke doesn't just immediately go away.

Yes, this is exactly what the current gas gren does. Its' particles seem to fade away. Note: I don't know what a +gren3 is. Players in CustomTF can carry two grenade types, so by buying a Smokescreen gren, it would take up the +gren1 or +gren2 slots.
scar3crow wrote:
What we see in many games is an entity which spawns particles with a sprite attached, these are usually made to look much nicer by having the sprite animate, and also having it rotate slowly, scale slowly, and fade out over time - if this was for a mod exclusive to something like DarkPlaces or FTE, this would be quite feasible, but since we have to assume stock Quake, the best you're going to get here without getting really hacky is the animation part.

I don't know if quakeworld = 'stock quake', or has any extra features..
scar3crow wrote:
So we need a grenade entity, which 3 seconds after spawning, will begin to emit particles. These particles should probably use MOVETYPE_BOUNCE so if used indoors, it will cluster better, and not just line the walls.

The current gas grenade hangs in the air the way I picture the smokescreen doing. Of course I'm open to any feedback, and especially from the Guru who ends up coding this.
scar3crow wrote:
It is up to you if you want the smoke to flow in one direction (as it would in any mildly windy circumstance), if so, make the variation on the angle of spawning the particles very narrow, otherwise, feel free to make it quite random - or pattern based if you wish (I assume you want the smoke to radiate out from the grenade, using the grenade as a central point).

Yes exactly
scar3crow wrote:
On the spawning of the particle, you should keep the velocity low, but add in a little use of random to make it look more natural, and less uniform - at this point if you are using a spr with animations, you would begin the animation counter.

This bit goes beyond my knowledge. I'm assuming spr = sprite.
scar3crow wrote:
I would recommend having the grenade think 6 times, twice a second, so after 3 seconds past the initial explosion, it is no longer emitting particles. Give the particles a lifespan of 5 seconds, this way 8 seconds after the grenade has gone off, the space should now be clear, and it is a compromise between the grenade streaming the smoke, and spurting the smoke.

Wow, You make it sound relatively easy to build a new gren from scratch. I've been assuming that the easiest way would be to copy the existing code for the Gas grenade, and replace the graphic 'elements' of the cloud with bigger darker ones, make the cloud bigger, and opaque, and add the 'sky check' mentioned above.
scar3crow wrote:
So, grenade, 3 seconds after existing, it begins the SmokeCloud function, SmokeCloud has a think of spawning a group of particles, with smoke art attached, for each spawning, tweak the angles mildly and the speed mildly. SmokeCloud thinks this with a nextthink of time + 0.5, and an iteration of emitcount + 1, where when emit count > 6, the process ends. The particles that SmokeCloud emits have a counter on spawn every second which when it hits 5, they remove themselves. The particles are MOVETYPE_BOUNCE, and if the art has frames, increments these frames. If you're willing to exclude stock Quake players, this is the part where you would be decrementing the alpha on the sprite for it to fade out, rotating it, and increasing the scale, which would improve the look of it greatly.

Hope this helped more than it confused!


Well, the good news is that you've given me a real inside look at how the process would work, and the knowledge that it IS possible - for someone who knew what they were doing.

The bad news is that 'that someone' is not me..

If only there was someone who knew exactly what's needed. Someone who had the skills, and had worked out how he would do it. Maybe someone on this very forum... reading these words right now...do you know anyone like that ... hint HINT? Wink

Seriously, how long would it take a competent programmer to code this?

Would it be possible to quickly program an 'ugly' version (an opaque bubble?) just to test the gameplay aspects? AGR is a very aggressive and competitive style of TF, and I'd rather test an ugly prototype, to prove that a smokescreen gren IS actually useful 'in-game', before someone goes to the trouble of doing the graphics. Though I have no idea whether would take one hour or one week for a Guru to do.

Thank heaps, and I'll be reading your VERY informative post over and over.



OneManClan


Last edited by OneManClan on Wed Mar 11, 2009 2:42 pm; edited 1 time in total
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Mar 11, 2009 2:06 pm    Post subject: Reply with quote

OneManClan wrote:

Would it be possible to quickly program an 'ugly' version (an opaque bubble?) just to test the gameplay aspects?


I remember a mod ages ago that slapped a big shub model over the player as they moved around.
If comic games are your thing, you could do the same for players within the smoke grenade area. :)

Alternatively, if stopping snipers is all you care about, you can do 'long-distance smoke' by messing with the player's v_cshift command based on angle and distance. If they're outside the smoke area looking into it, you can basically make their screen go grey/smokey.
Unfortunately if they're too far away, it'll affect their entire screen.
v_cshift R G B A

Alternatively, you could just randomize the aim of players shooting into a smoke cloud, keeping the graphics effects to a minimum (regular lavasplash or spam a load of teleport effects maybe).
Imho this is the best solution, purely because it wouldn't end up looking like an elephants backside, wouldn't intrude on the player when not looking at the smoke, would still allow you to see out of the smoke. Plus there's no way for hacked clients to block it.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
MeTcHsteekle



Joined: 15 May 2008
Posts: 397
Location: its a secret

PostPosted: Wed Mar 11, 2009 2:16 pm    Post subject: Reply with quote

Spike wrote:
OneManClan wrote:

Would it be possible to quickly program an 'ugly' version (an opaque bubble?) just to test the gameplay aspects?


I remember a mod ages ago that slapped a big shub model over the player as they moved around.


no thats like was that time u visited bigfoots runequake server and we turned the ruins on...and stuff..that was like 2 months ago u did that
_________________
bah
Back to top
View user's profile Send private message AIM Address
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Mar 11, 2009 4:57 pm    Post subject: Reply with quote

MeTcHsteekle wrote:
no thats like was that time u visited bigfoots runequake server and we turned the ruins on...and stuff..that was like 2 months ago u did that

That wasn't me.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
MeTcHsteekle



Joined: 15 May 2008
Posts: 397
Location: its a secret

PostPosted: Wed Mar 11, 2009 7:35 pm    Post subject: Reply with quote

Spike wrote:
MeTcHsteekle wrote:
no thats like was that time u visited bigfoots runequake server and we turned the ruins on...and stuff..that was like 2 months ago u did that

That wasn't me.
:O ive been deceived by spikes... :S yet he was testing something with FTE DConfused
DAMN the system
_________________
bah
Back to top
View user's profile Send private message AIM Address
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Wed Mar 11, 2009 8:17 pm    Post subject: Reply with quote

I did briefly join bigfoot's NQ server a while back when he moaned about not having a 'usable' NQ client, but tbh I spent most of it getting disconnected while hacking at my client to find the obscure bugs.
If it was me, then I wasn't actually online/reading chat when you spawned lots of shrubs, cos I didn't personally see anything of that sort.
But still, a shrub model around the player models, and you can still see out of it, but you can't see in so well.
Without alpha its a bit of a solid wall, and too small, so it would have to move with the players. Tbh that means you can guess whereabouts they are with practise, so after a bit, smoke grens will once again be useless.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
scar3crow
Inside3D Staff


Joined: 18 Jan 2005
Posts: 837
Location: Las Vegas, NV

PostPosted: Tue Mar 17, 2009 3:50 pm    Post subject: Reply with quote

OneManClan; Sadly I am not qualified to code such a grenade, I understand the logic, but never the idiosyncrasies of implementation. Believe me, I gave it a go, perhaps another community member can help you... *eyes the numerous very good coders who frequent the forums*

I am however very interested in AGR, I enjoy CustomTF and always loved TF and MegaTF as well. Though my skills have greatly declined, and I never joined the bunnying revolution, so I'm a more traditional slower Quake mover, would I have a place in an AGR match despite not bunnyhopping?
_________________
...and all around me was the chaos of battle and the reek of running blood.... and for the first time in my life I knew true happiness.
Back to top
View user's profile Send private message AIM Address
MauveBib



Joined: 04 Nov 2004
Posts: 602

PostPosted: Tue Mar 17, 2009 5:27 pm    Post subject: Reply with quote

OneManClan: You are obviously working off the assumption that it's possible to achieve something like the current gas grenade, and that's just not the case. The "gas grenade" effect is a built-in effect of Quake, the Cthon lavasplash, which is hardcoded into the engine. Coming up with something similar just can't be done in QC in standard quake, so any results will be far, far uglier than the current gas grenade effect.
_________________
Apathy Now!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group