Inside3D!
     

DarkPlaces Engine Dev?

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



Joined: 11 Apr 2008
Posts: 4

PostPosted: Sat Apr 12, 2008 1:22 am    Post subject: DarkPlaces Engine Dev? Reply with quote

Hi. Are there any forums dedicated to engine development, DarkPlaces specifically? I'm working on learning the DP code to try out some ideas I have.

Right now I'm stuck on filtering model names of entities to find out exactly who is a player, and whether that player is on my team- where can I find what model name characterizes a player, and how would I filter for this in C?


Having found these entities, it would then be possible to do a traceline check to see if they are behind any objects?
traceline(cl.entities[cl.playerentity].state_current.origin, e.origin, FALSE, world);
if (trace_ent == target);
// this ought to do it?


VectorSubtract(cl.entities[cl.playerentity].state_current, e->state_current.origin, vekt);
sqrt(DotProduct(vekt, vekt));
//this should give me the distances between the two entities?

Now how would I find and pick the shortest distance, and make this all into a useable code (how would I write it out) for finding the nearest entity that is a player? Register a new variable, define it in a config or/and default parameters? Sorry I'm very new to coding, and a bit lost. (Seems like the documentation on DarkPlaces is quite scarce!)

Thanks for any help :)
Back to top
View user's profile Send private message
Baker



Joined: 14 Mar 2006
Posts: 1538

PostPosted: Sat Apr 12, 2008 3:58 am    Post subject: Reply with quote

On the player/team part of your question:

There may be a better way and/or different ways in DarkPlaces, but in the standard Quake engine:

1) any entity number less than the maxscoreboard count is a player.

2) To check if a player is on the same team, extract the pants color from the player color value.
Back to top
View user's profile Send private message
Lardarse



Joined: 05 Nov 2005
Posts: 243
Location: Bristol, UK

PostPosted: Sat Apr 12, 2008 6:38 am    Post subject: Reply with quote

There isn't really a forum as such, but if LordHavoc notices this (and I think that there's a good chacne that he might), then he will be able to respond. The main place to discuss DarkPlaces development is #darkplaces on irc.anynet.org

Regarding your question, is it not easier to find players by looking for entity.classname == "player" ?

As for finding the nearest teammate... if all you're doing is comparing distances, then the square root is unnecessary. There was a thread around here a while ago that discussed nearest entities. I'll edit it into this post if I find it.
Back to top
View user's profile Send private message
LordHavoc



Joined: 05 Nov 2004
Posts: 243
Location: western Oregon, USA

PostPosted: Sat Apr 12, 2008 7:44 am    Post subject: Re: DarkPlaces Engine Dev? Reply with quote

marie wrote:
Hi. Are there any forums dedicated to engine development, DarkPlaces specifically? I'm working on learning the DP code to try out some ideas I have.

Right now I'm stuck on filtering model names of entities to find out exactly who is a player, and whether that player is on my team- where can I find what model name characterizes a player, and how would I filter for this in C?


First I'd like to ask what you're doing with this? Not much reason for engine code to care about who is and is not a player and what team they are on, at least that I can think of (there are two uses I can think of, both of which with cheating implications).

The only way to find out the team of a player is to look at cl.scores[entnumber - 1] (assuming entnumber is >= 1 && < cl.maxclients), that struct is the scoreboard entry for the player for that entity.

You won't find hardly any code in DarkPlaces that makes assumptions regarding player entities, and what exists is QW specific (for example in gl_rmain.c the r_qwskincache code checks for this case).

The traceline function you're looking for is CL_Move.

Let me know what you have in mind and I can give much more direct tips.
Back to top
View user's profile Send private message Visit poster's website
LordHavoc



Joined: 05 Nov 2004
Posts: 243
Location: western Oregon, USA

PostPosted: Sat Apr 12, 2008 7:45 am    Post subject: Reply with quote

Lardarse wrote:
There isn't really a forum as such, but if LordHavoc notices this (and I think that there's a good chacne that he might), then he will be able to respond. The main place to discuss DarkPlaces development is #darkplaces on irc.anynet.org

Regarding your question, is it not easier to find players by looking for entity.classname == "player" ?

As for finding the nearest teammate... if all you're doing is comparing distances, then the square root is unnecessary. There was a thread around here a while ago that discussed nearest entities. I'll edit it into this post if I find it.


entity.classname is not known in the client engine, I think you're thinking of CSQC modding, or ordinary quake modding on the server.
Back to top
View user's profile Send private message Visit poster's website
marie



Joined: 11 Apr 2008
Posts: 4

PostPosted: Sun Apr 13, 2008 8:56 pm    Post subject: Reply with quote

I often babysit three little boys (ages 11, 9, and 6) who are absolutely terrible at aiming, so I was hoping to make a handicap much like in Goldeneye 007 that helps with finding targets. They tend to aim at the sky, or their feet unwittingly, though they do love the idea of firstpersonshooters and blowing stuff up. They have an N64 and a Gamecube at their dad's, but I sit for their mom who has nothing but laptops. I owe much of my video game interest/prowess to playing with them :)

Ideally, I'd be able to set their aim somewhere in the general vicinity of opponent bots. (This handicapping is for our LAN parties and not for use on public servers of any sort).

I have tried a few other things such as limiting the bounds of the vertical pitch, but this doesn't seem to help much, they really have a hard time finding opponents and proper targets.

I was doing the same thing Lardarse was, mistakenly mixing QuakeC and C.

Again, any help would be greatly appreciated!
Back to top
View user's profile Send private message
LordHavoc



Joined: 05 Nov 2004
Posts: 243
Location: western Oregon, USA

PostPosted: Sun Apr 13, 2008 9:12 pm    Post subject: Reply with quote

marie wrote:
Ideally, I'd be able to set their aim somewhere in the general vicinity of opponent bots. (This handicapping is for our LAN parties and not for use on public servers of any sort).


There is the sv_aim cvar on servers, which if set to a value like 0.9 will do fairly significant autoaim on pitch only - it shouldn't be hard to add yaw changes to this, please look at VM_SV_aim in svvm_cmds.c - you should be able to just add this line above VectorNormalize (end);
Code:
VectorCopy(dir, end);


Then experiment with sv_aim until a satisfactory value is found, it normally is in the range of 0.9 to 1.0 (1.0 being no autoaim, and smaller values being progressively more).

This won't make their view track someone or anything, it just makes shots 'snap' to the target, and makes use of existing Quake features.
Back to top
View user's profile Send private message Visit poster's website
marie



Joined: 11 Apr 2008
Posts: 4

PostPosted: Sun Apr 13, 2008 9:35 pm    Post subject: Reply with quote

Hrm, that doesn't seem to work. If the server sets sv_aim .1, a player should then be able to aim and shoot directly over an opponent's head and still hit them? This doesn't seem to be the case at all.

And their view won't be changed by this anyway? I mean, if they are aiming at the floor it won't move their crosshair towards an opponent? That's really what I'm trying to achieve.
Back to top
View user's profile Send private message
LordHavoc



Joined: 05 Nov 2004
Posts: 243
Location: western Oregon, USA

PostPosted: Sun Apr 13, 2008 10:11 pm    Post subject: Reply with quote

marie wrote:
Hrm, that doesn't seem to work. If the server sets sv_aim .1, a player should then be able to aim and shoot directly over an opponent's head and still hit them? This doesn't seem to be the case at all.


This does depend on whether the mod supports the aim function, most do, but dpmod for example does not.

marie wrote:
And their view won't be changed by this anyway? I mean, if they are aiming at the floor it won't move their crosshair towards an opponent? That's really what I'm trying to achieve.


That definitely has to be done in the client, I've seen that when I played Halo 3 at a lan party.

You seem to be on the right track for that, so just resume the questions Smile
Back to top
View user's profile Send private message Visit poster's website
marie



Joined: 11 Apr 2008
Posts: 4

PostPosted: Mon Apr 14, 2008 10:24 am    Post subject: Reply with quote

I'm still having trouble filtering for player entities.
I initially considered doing find(world, classname, "player"), which won't work, and I suppose fl_client won't help either.
Would a mere IF statement work here? if( ... ) What exactly would this be incorporating cl.scores?

Edit: I confused myself.

Also, what are the necessary parameters and output for CL_Move(); ?

I think I know where to go as soon as I've found & selected the nearest player entity. I'd use AnglesFromVectors with the entity's vector and set the cl.viewangles[PITCH] & cl.viewangles[YAW] with that?

Thanks again! :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> Engine 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