|
Posted by metlslime on 2007/08/08 04:57:56 |
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer. |
|
|
#1936 posted by ericw on 2016/01/11 10:24:17
Yeah, it's convoluted because they're not stored, you have to compute the lightmap sizes.
For each vertex on the face, you get the X and Y texture coordinates like this:
texcoord_x = (vert_x, very_y, vert_z, 1) dot (tex->vecs[0])
texcoord_y = (vert_x, very_y, vert_z, 1) dot (tex->vecs[1])
tex->vecs[0] and tex->vecs[1] are both vectors of 4 floats, tex is the texinfo_t* that has that's face texture alignment info.
Then, to get how many bytes wide/tall the lightmap is:
lightmap_width = ceil(max(texcoord_x) / 16.0) - floor(min(texcoord_x) / 16.0) + 1
lightmap_height = ceil(max(texcoord_y) / 16.0) - floor(min(texcoord_y) / 16.0) + 1
max(texcoord_x) is the maximum texcoord_x across all verts on the face. Hopefully I didn't mess anything up and the notation makes sense.
For reference this is the light tool code:
https://github.com/ericwa/tyrutils-ericw/blob/master/light/ltface.c#L355
#1937 posted by metlslime on 2016/01/11 10:28:28
the engine source is probably the best documentation since it has code that reads, converts, and renders the lightmaps.
#1938 posted by Spirit on 2016/01/11 11:21:46
Once you know, https://quakewiki.org/ would be a great host for that kind of information.
#1939 posted by anonymous user on 2016/01/12 01:53:22
I assume the notation above is dealing directly in the x/y coords of worldspace? I've already tamed the textures and mapping, if what I'm understanding is right, I should be able to use my existing code for decoding the texture UVs to do the lightmaps as well, with a little tweaking.
It was confusing because a lot of scraps I was finding were saying that lightmapping information/decoding was totally unrelated to texture UVs/composition, but it looks like that's not entirely true.
I'll give it a shot when I get off work.
Glad to see this place is still active. It was a huge help last time I worked on this project. It's the reason I've made it this far.
#1940 posted by ericw on 2016/01/12 08:08:44
I assume the notation above is dealing directly in the x/y coords of worldspace?
Yeah, the vert_x, very_y, vert_z are worldspace.
texcoord_x/y are in texture space, and dividing these by the texture width/height gives the texture U/V coordinates normalized to [0,1] (except they go outside that range for repeating.) So yeah you should be able to reuse some of the texturing code for this :-)
btw as a sanity check, the lightmap_width/height values you get should be between 1 and 18.
Hipnotic's Bullet Hole Sprite
#1941 posted by aDaya on 2016/01/12 11:30:54
Going further into properly integrating Scourge of Armagon's code into my mod, this time its sprites can't be properly compiled.
FTEqcc says "line9 - Unknown frame macro $spritename"
Here's the hipspr.qc file: http://pastebin.com/t0VypXAU
And yes, I made sure I also copy pasted the sprite files in the progs directory.
#1942 posted by metlslime on 2016/01/12 18:08:47
that reminds me, i love that Jim Dose called it "QuickC"
#1943 posted by Spike on 2016/01/12 18:41:52
Daya, skip that file (delete it or something), its not qc code.
(note how its not included in hipnotic's progs.src either)
That Was The Solution, Yup
#1944 posted by aDaya on 2016/01/12 19:40:23
Gotta thank CZG for that
Actually,
#1945 posted by aDaya on 2016/01/13 08:18:54
When the compilation went with no errors this time, bullet hole sprites still don't appear on brushes.
Even though I made sure to place the bullethole code in weapons.qc as well, so I really don't know what's wrong here.
In the end I can overlook that while developping the mod, but it's still annoying.
Issues With Fteqcc
#1946 posted by kalango on 2016/01/14 16:12:50
Ok so i'm trying to compile a hexen 2 and csqc project with fteqcc.
So, i can compile a standard hexen2 code normally, but if i try to put some csqc in it and link it with
#pragma sourcefile csprogs.src
in 'global.hc' the compiler complains with the following error:
": werror Q208: progs CRC not recognised from quake nor clones"
The thing is that if i compile the CSQC separately its all good, but i really dont wanna to have to do two compiles each time i want to compile the whole project.
Btw i'm using the command line fteqcc (same happens with GUI)
my compilation command:
>.fteqcc -src hc -Thexen2
And also, i'm using Hammer of Thyrion's HCode since i couldn't find anything better or updated...
#1947 posted by Spike on 2016/01/14 21:02:07
put this in your hexen2 code (before any functions are processed):
#pragma target h2 //or fteh2, if you're going fteqw-only.
#pragma keyword enable thinktime
#pragma keyword enable loop
#pragma keyword enable until
and then remove -Thexen2 from your commandline.
alternatively, you can use
#pragma target id //or fte, because you might as well
in your csprogs.src, again before any statements are execed (keep the -Th2 bit if you're leaving the progs.dat code alone).
Alternatively, as you're not using fteqccgui anyway, you might as well just run fteqcc twice, with a batchfile or whatever.
fteqccgui is good for debugging though (which pragma sourcefile was implemented to simplify).
Great!
#1948 posted by kalango on 2016/01/15 13:56:59
I appended
#pragma target id
to the beginning of csdefs and it all went fine.
Thanks man!
Darkplaces Water Twist/Movement
#1949 posted by Qmaster on 2016/01/20 06:54:50
I can't for the life of me figure out how to enable the correct software quake style of rendering water with all its twisting and writhing in the Darkplaces engine. All the water does is scroll back and forth. I'm trying to dig through the engine code to find it. Its got to be somewhere...just disabled or commented out, right?
Anyone know where it is?
#1950 posted by Lunaran on 2016/01/20 07:03:46
gl_subdividesize to 16 maybe?
Something I'll Do In The Near Future
#1951 posted by aDaya on 2016/01/20 18:53:54
...cause right now I'm working on that BFG, but:
I'm planning on doing a Berserk power-up where attack speed is increased by 3 (weapon animation would speed up to reflect that) and ammo consumption divided by 2.
The question is, would such a thing be possible with something similar to SuperDamage? Especially with guns who are tied with their model animations (nailgun, super nailgun, thunderbolt)?
Combining Shotgun Blasts?
Was just reviewing the old Qc src here: http://www.gamers.org/dEngine/quake/Qc/combat.htm
the part where it mentions combining shotgun blasts (in T_damage ()), seems to be related to the dmg_take field I was working on earlier. I know there is a multidamage work around on another forum.....but what was the original intent of multidamage? Its spawning an ent that basicly collects the damage and distributes it?
#1953 posted by necros on 2016/01/23 21:47:27
the whole code is designed to reduce the amount of data being sent from clients and servers. instead of sending 50~ damage messages for small amounts, it sends 1 damage message with a large amount. if a shotgun blast hits multiple entities, then multiple damage messages are needed, but they still wanted to collect everything up as much as possible.
as a side effect, it basically lets shotguns gib monsters.
#1954 posted by necros on 2016/01/23 21:49:48
edit: sorry, should have actually looked at the code you were quoting.
this is to make sure the screen tint looks the right brightness.
imagine you took damage from 2 sources in the same frame, A was 50 damage and B was 5 damage.
if you just set .dmg_take to whatever the damage was, and B was processed after A, then you'd take 55 damage but have a very faint red screen effect.
Necros, Are You Implying Shotguns Gibbing Enemies Is A Bad Thing?
#1955 posted by aDaya on 2016/01/23 22:29:11
Going back to my last request, I know one way would be to have a (if BERSERK is active) check for each self.attack_finished, self.nextthink and ammo_counts for each weapons, but isn't there a more flexible option where potential added weapons could just benefit of just a function call, like what vanilla weapons do with the Quad Damage with SuperDamage(); ?
@Necros
Yes, I was wondering more about the multidamage function moreso, but you answered both questions, thanks.
I'm futzing a bit with some QC that checks each bullets impact point on the client, and determines a rough "hitlocation" guesstimate based on some code that Muavebib made and posted a long while back. Its counting up the correct number of impacts to each body part ok, however I am also wanting to separate out the possibility its contacting multiple targets.
Basicly Im floating 2 local ents - a,b and c and put this code in the loop if we hit a .FL_CLIENT ent:
if (a == world)
a = trace_ent;
else
{
if (trace_ent != a && b == world)
b = trace_ent;
else if (c != a && c != b && c == world)
c = trace_ent;
}
...it sorta crudely works and isolates the correct trace_ent near the end of the function where I count up location impacts, but I suspect this wont work well on more than 2 clients. Its hard to hit a group of more than 2 usually , but just in case Id like to cover that possibility somehow.
Is it easier to modify the multi_ent in multidamage to do this?
BFG Help
#1957 posted by aDaya on 2016/01/25 14:40:32
So I'm in the final stretch on doing that BFG, and that's its coding.
The idea here for the attack is for the sphere itself to drill through enemies who gib through its direct impact, and to explode against a non-gibbed dying enemy on impact.
During its travel, the sphere would spawn lightning attacks to nearby enemies (let's say 200/250 map units max).
And the explosion impact, instead of generating an explosion radius, would spawn a different lightning attack, one that would last an instant and generate more damage and an impact sprite at the end of the traceline, and its radius would be as long as vanilla thunderbolt.
Thing is, even though I have all the assets in place (models, sounds, sprites for the bfg sphere, big impact, and blast impact) I don't know how to properly code all of that.
I'm following these: http://www.insideqc.com/qctut/lesson-22.shtml http://www.insideqc.com/qctut/lesson-51.shtml
But I don't think I see anything related to "while bfgshot is in world" as a check to launch the nearby-lightning code.
Think Fast
#1958 posted by Preach on 2016/01/25 21:36:34
The trick is similar to the problem of the looping animation you had previously. You need to create a think function like
void() bfg_ball_think =
{
//insert lightning bolt code here
self.nextthink = time + 0.3; //how often lightning strikes
self.think = bfg_ball_think; //keep repeating
}
Then when you create the ball you need to add
missile.think = bfg_ball_think;
missile.nextthink = time + 0.2;
This gets you lightning shooting out as it flies, which is a good start.
BFG Help Part2
#1959 posted by aDaya on 2016/01/27 00:28:10
Thanks again for Preach's help.
Now, for the lightning blast coming from the impact, the idea is to generate an impact sprite at the end of the lightning line generated. I know trace_endline has a role to this, and this is where the blast sprite function will be called, but I doubt "trace_endline = BFGBlast();" would work, as trace_endpos seems to be more attached to particle work.
Just for reference, here's what I wrote for the entire BFG (not including weapon animation, which aren't made yet): http://pastebin.com/E82MgGTy
You'll Want To...
#1960 posted by Qmaster on 2016/01/27 18:42:11
First remove the local variable org from within BFGBlast(), then add an argument so: BFGBlast(vector org) = {...
Then in your code where you do your head finding and t_damage, you can add just after that t_damage() a call BFGBlast(head.origin); to pass the location on to that spawn function for the explosion. In BFGBlast() you'll want to change it from self to be a newent so:
local entity newent;
newent = spawn(); //create new entity to become the blast
newent.origin = org; //set location to the ending of the lightning
newent.movetype = MOVETYPE_NONE;
newent.velocity = '0 0 0';
newent.touch = SUB_Null;
setmodel (newent, "progs/bfgblast.spr");
newent.solid = SOLID_NOT;
bfgexpl1 ();
sound (newent, CHAN_WEAPON, "weapons/bfgblast.wav", 1, ATTN_NORM);
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2024 John Fitzgibbons. All posts are copyright their respective authors.
|
|