Forum

Page 1 of 1

existential crisis in csqc

PostPosted: Tue Jun 05, 2018 7:09 am
by Nahuel
Since the stats are limited in darkplaces I decided to use entities to replace that information I need in csqc.
so
1-i spawn a temp entity in ssqc with some data and i send it to csqc
2- I use that data to display images in player GUI
2- the entity is deleted in csqc and ssqc

this works very well, but as you will immediately notice the problem: that data is used by all players!! Then I felt like an idiot when I saw that in multiplayer all the players were shown messages on the screen.

In csqc_updateview i have

Code: Select all
entity e;
        e = self;
   for(self = world; (self = nextent(self)); )
   if(self.draw2d)
      self.draw2d();
   self = e;


And the "draw2d" is what does the work (the work of display images in screen). I thought about assigning an owner to that entity, but this is possible? i mean
1-the entity spawns in ssqc with a player as "owner" and is sent to csqc
2- ONLY the player-owner of the entity can use that data

It is possible?


What I want to do, basically it is to use entities in csqc but that only affect one player, the original owner in ssqc of those entities.


thank you very much

Re: existential crisis in csqc

PostPosted: Tue Jun 05, 2018 8:48 am
by Spike
if you don't care about splitscreen (which dp doesn't support anyway) then you can just use drawonlytoclient and only that player will receive a copy of the ent. alternatively you can tweak the return value of your .SendEntity function, which does similar but with more control.
or you can network the .colormap field and compare that to player_localentnum in your csqc (which is one way to deal with splitscreen properly).

alternatively use writebytes. DP has no proper svc so you'll need to either hack tempentities to parse it, or to send it via stuffcmds. both of which can be sent using reliables without needing to depend on SendEntity callbacks at some vaguely defined later time.

and do you really have 256 player-specific stats? :o
why can you not compress them a little?