Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Position of Other Players/Bots Client-Side

#1
So I'm adding support for haptic feedback in Xonotic using a wearable device I'm developing. I successfully did this previously for AssaultCube, but I've been having trouble with Xonotic since I'm not familiar with the darkplaces engine.

To get started, I simply need to be able to get the positions of the other players/bots in the game from the client-side...I imagine this should be pretty straightforward but I've been having trouble figuring out how to do it. Is there an elegant solution out there?
Reply

#2
Im curious how the haptic feedback would work? Will you get electro shocks from the right side when getting hit by the vortex or so?
My Xonstats Profile
Latest track on soundcloud: Farewell - to a better Place (piano improvisation)
New to Xonotic? Check out the Newbie Corner!

Reply

#3
I'm not sure if the engine can know the player locations as easily as the game code, as that's where we handle them mostly.
If the majority of your functions are done in the engine, a game code hook could be added which allows telling the engine where players are and everything (although, I'm not sure if this is the best way).
I suppose one example of a game code hook that handles player related stuff is runstandardplayerphysics.
[Image: 230.jpg]
Reply

#4
(05-05-2015, 01:24 AM)Halogene Wrote: Im curious how the haptic feedback would work? Will you get electro shocks from the right side when getting hit by the vortex or so?

The initial mode I'm implementing is basically tactile radar - you *feel* where the other players are in the game. I encode range and bearing (and can do friend/foe) in the pulse frequency and intensity of the haptic feedback. This works pretty well for AssaultCube, but I'd love to implement it for Xonotic. The haptic actuators in this case are little vibrating motors a la the ones you have in your mobile phone.

(05-05-2015, 06:15 AM)Mario Wrote: I'm not sure if the engine can know the player locations as easily as the game code, as that's where we handle them mostly.
If the majority of your functions are done in the engine, a game code hook could be added which allows telling the engine where players are and everything (although, I'm not sure if this is the best way).
I suppose one example of a game code hook that handles player related stuff is runstandardplayerphysics.

Yeah, that's precisely the impression I got. It would be comparatively easy to implement server-side I think.

My thinking was pretty simple - as only a few players will actually have the haptic feedback peripheral, I didn't want to burden the server with having to manage it and would prefer to just keep this all client-side. It seems like a game code hook might be a good solution (or at least *a* solution) - I guess I would implement as follows:
1. If the client detects the player has the haptic feedback device, it asks the server to send the player positions every couple of frames.
2. The server does so when requested.
3. The client then calculates the relevant ranges and bearings, and then communicates this to the haptic driver.

That was a bit more involved than I was hoping, but I suppose should work unless someone can think of another way that doesn't involve the server at all...

Thanks for your suggestions,
E
Reply

#5
I should note that the client doesn't know where every single player is (especially ones behind walls). It only networks entities in the same room/area, to save bandwidth and prevent cheats.
Player locations are already networked when visible, identifying them from the client may be a bit difficult though (maybe searching every entity number below the maxclients variable could be easiest, as these are always players).
[Image: 230.jpg]
Reply

#6
(05-05-2015, 11:50 AM)Mario Wrote: I should note that the client doesn't know where every single player is (especially ones behind walls). It only networks entities in the same room/area, to save bandwidth and prevent cheats.
Player locations are already networked when visible, identifying them from the client may be a bit difficult though (maybe searching every entity number below the maxclients variable could be easiest, as these are always players).

You know - a good starting point would be to look at how the map is implemented in team deathmatch. In that case, you can see the locations of your teammates on the map in the upper left corner of the screen, so couldn't you essentially just tweak this feature to accomplish what I was going for?
Reply

#7
That uses a special entity linked with CSQC. If all you really need is the player's rough locations, it may be enough.
[Image: 230.jpg]
Reply

#8
(05-06-2015, 12:14 PM)Mario Wrote: That uses a special entity linked with CSQC. If all you really need is the player's rough locations, it may be enough.

Well - works like a charm! I now have haptic radar to detect my teammates in CTF. It works by reading the radar updates sent by the server and re-purposing by converting the spacial location into haptic feedback.

I'm wondering what to implement next...maybe haptic detection of power-ups, flag-carriers, and waypoints? Anything you see on the team radar I should be able to grab solely on the client side... The beauty of this from the player's perspective is that you don't need to look at the team radar while playing Wink

Thanks again for your suggestions,
E
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I analyze demo file or CLIENT TO SERVER packets? vighill9 0 3,631 06-19-2024, 09:48 PM
Last Post: vighill9
  Help with Client for Machine Learning QuakingInFearOfQuakeC 1 2,866 04-17-2019, 05:51 PM
Last Post: BuddyFriendGuy
  [NEED HELP] Gametype Invasion, Playermodel Bots Dan Hover 9 6,963 01-26-2019, 02:04 PM
Last Post: Dan Hover
  Privacy information for players (ingame) [GDPR] Kaesebrot 11 6,739 11-07-2018, 06:15 AM
Last Post: Halogene
  Prevent respawn of players like in CA Lyberta 1 2,726 03-04-2017, 07:16 AM
Last Post: Mario
  [SOLVED] Bots get stuck Lyberta 2 3,597 02-27-2017, 06:10 PM
Last Post: martin-t
  Rcon client Sl@va 1 3,329 05-26-2015, 04:25 PM
Last Post: -z-
  A question of getting started with Quakec timetopat 5 7,977 07-02-2012, 07:55 AM
Last Post: timetopat
  More bots perredition 9 9,527 08-16-2011, 03:12 PM
Last Post: perredition
  IRC client in the game (working prototype) Akari 4 10,241 04-09-2011, 02:52 PM
Last Post: atomic1fire

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-