Inside3D!
     

surfaces for different sound effect/sprites?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Mexicouger



Joined: 01 May 2010
Posts: 129

PostPosted: Mon May 10, 2010 1:30 pm    Post subject: surfaces for different sound effect/sprites? Reply with quote

Last night I got the idea to add in distinct surfaces. In other words, a surface that changes the set of sound effects/sprites being used while on it. So my test platform was sand. I took a func_wall and made it func_sand. I gav eit the classname sandy and defined GROUNDTYPE_SANDY and added the float groundtype. I applied those to the func_sand. My main goal wa sto make different footstep sounds depending on which surface you were on. As time passed, I started thinking about using a trigger instead. I`m not too familiar with coding triggers, so I gave up on that pretty quick. The only way I can think of is adding new pointcontents. Like the game knows that slime is different from normal ground etc. Tha bad thing is, that is most likely all engine side and I cannot setup a compiler to save my own life. Also, I may post my code later, but for now, I`m on a cellphone. So if there is any bad spelling, I will make sure to clean it up on my next pc visit. And sorry if I`m not using the correct coding terms.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Spirit



Joined: 20 Nov 2004
Posts: 476

PostPosted: Mon May 10, 2010 1:41 pm    Post subject: Reply with quote

I am not in a position to know about these things but to me it sounds more sane to use either the texture name or a shader to determine/set what sounds to use.
_________________
Quake Maps
Back to top
View user's profile Send private message Visit poster's website
mh



Joined: 12 Jan 2008
Posts: 909

PostPosted: Mon May 10, 2010 2:14 pm    Post subject: Reply with quote

Spirit wrote:
to me it sounds more sane to use either the texture name or a shader to determine/set what sounds to use.

Agreed. Using entities sounds neat and easy initially, until you realise that you'll bloat the number of entities in your game, have light shining through them, run into visibility problems, and choke the renderer in the majority of engines (loss of F2B ordering, no texture chains, etc).
_________________
DirectQ Engine - New release 1.8.666a, 9th August 2010
MHQuake Blog (General)
Direct3D 8 Quake Engines
Back to top
View user's profile Send private message Visit poster's website
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 10, 2010 4:36 pm    Post subject: Reply with quote

Yes, that is the only sane choice. The extension DP_QC_GETSURFACE, specifically the function getsurfacetexture, is what you want (DarkPlaces only, probably). Either have big lists of textures in the gamecode for each sound (like a huge if/elseif block!), or have the textures named with a consistent naming convention and simply parse them (for example "dirt_ground1" and "dirt_grass4" do dirt effects...).
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon May 10, 2010 6:57 pm    Post subject: Reply with quote

its easier to use surface flags+q3bsp
there's some trace global that contains the mask.
then you can just do (trace_surface_flags & SURF_SAND) and you know you're on a sandy surface.

DP_QC_GETSURFACE is... awkward, to say the least.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 10, 2010 7:11 pm    Post subject: Reply with quote

Oh, okay. I admit my only experience with DP_QC_GETSURFACE was in 2003 when it didn't even work Razz. So listen to Spike here, he is less than 7 years out of date.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Mexicouger



Joined: 01 May 2010
Posts: 129

PostPosted: Mon May 10, 2010 7:24 pm    Post subject: Reply with quote

Well, If I have to do this in the engine, then I'm planned to fail. However, If I can do this in qc, then possibly. I really need help setting up a compiler. I tried getting microsoft visual basic and cygwin. I haven't any clue what to do... And also, I'm working with the psp. So it is GL Quake 1. Thanks for the help so far, But I can't do any of it..... Unless it's in qc or I setup a compiler.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Mon May 10, 2010 7:40 pm    Post subject: Reply with quote

I would say forget about this feature completely then. It can't be that important. If you have a lot of C/C++ coding experience and familiarity with the Quake engine (which I doubt since you don't even have a compiler set up) you might try to tackle it. But otherwise, the only QuakeC-only methods available are not very good at all.

Putting a trigger on top of every ground surface is ridiculous. The only viable trigger method is to include "enter" and "exit" triggers for every area containing a different surface type, but that would also be a huge headache for the mapper.

I would definitely recommend finishing all the actually important things in your mod, then coming back to this and reconsidering if it's really worth it.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon May 10, 2010 9:26 pm    Post subject: Reply with quote

as its q1, you NEED a modified engine.
I don't know of any PSP engines that support such a feature already.
if its q1bsp (which it presumably must be) then there is no surface information for any of the hulls other than perhaps hull 0.
which means that your test will never be 100% accurate.
If you do want to implement it, or if someone else does, you could splice apart the code in gl_rlight.c, the bit that samples the lighting level of the surface under a model. you can reuse that code, change the direction of the trace so its not always straight down, although in this case that's all thats required, and strcmp the surface->texinfo->texture->name against certain known settings, or just checking the first few chars for some special 'sand' prefix or whatever.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Mexicouger



Joined: 01 May 2010
Posts: 129

PostPosted: Thu May 13, 2010 1:52 pm    Post subject: Reply with quote

I figured that this wass the only solution. Using surfaces with special characters. I will later try to get a comper. It`s more of a chore to do at this point. For now, I`m just going to get my qc all finished. By the way. I ordered a c programming book; will I be able to use that to learn qc better? I mean, to my understanding, qc is c(subtract a few nifty features). I know the engine is c so it will be useful 1 way or another.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Thu May 13, 2010 2:49 pm    Post subject: Reply with quote

qc is c-like.
but then so is java.

the language itself is just its syntax. and the syntax is a fraction of the whole.
the concept of pointers in c is akin to the entities in qc.
The bulk of things that can be learned with any language comes from its standard library, its builtins, its apis, and its interfaces. Learning C and applying that to QC will not help in this case.
But hey, the buitins are all programmed in C, so reading the engine will help with reading QC :)
Learning C purely to learn QC is mostly a wasted effort, qc is not so complicated.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Swift



Joined: 26 Jan 2010
Posts: 44

PostPosted: Fri May 14, 2010 9:37 am    Post subject: Reply with quote

QuakeC's handling of objects is a lot like Java's. Decent first language to learn.
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
Page 1 of 1

 
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