Inside3D!
     

CSQC ReadEntity

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



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Mar 10, 2008 2:53 pm    Post subject: CSQC ReadEntity Reply with quote

There's a WriteEntity builtin in ssqc, but no ReadEntity in csqc. Does anyone know how I'm supposed to read WriteEntity calls in CSQC_Ent_Update, or is that perhaps just not possible?
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Mar 10, 2008 4:26 pm    Post subject: Reply with quote

ssqc doesn't expose entity numbers to the ssqc, thus it requires a writeentity.
csqc doesn't have access to the ssqc entities, thus a readentity will not always work (if its not known, you would get world, and you would not be able to re-read it).

Entities are sent as shorts, thus to read an entity, call ReadShort. it will return the entity number on the server. This can be matched to the entnum field from entities read from the server.
The ommision is intentional. Any logical behaviour would likely be too unreliable (a ReadEntityNumber builtin would make sense at least, but it would be identical to ReadShort).
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Mar 10, 2008 7:40 pm    Post subject: Reply with quote

Ah, well that works for me!
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Mar 17, 2008 12:24 pm    Post subject: Reply with quote

I haven't been able to test my code for quite some time, as it's going through quite an overhaul with making everything work in csqc and all, so I'm trying to Do Things Right(tm) from the beginning... One thing that struck me, would this method ever fail? I'm currently having a separate entity with a think function, which assigns entities to the assigned fields on the targeted entity based on edict numbers, as it might not have turned up in csqc yet (packetloss or whatever). That's all fine, but could it possibly ever assign the wrong entity? Could it for some reason get the wrong edict number? Like perhaps, if entities are added/removed?
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Mon Mar 17, 2008 5:49 pm    Post subject: Reply with quote

if an entity is removed()ed, there is a 2-second grace period where that entity will not be re-spawn()ed as something else.
So yes, its possible that your entity will come out as something else in extreeme cases, so yes, you should ensure that its the sort of entity that you meant for it to be.
The entity number itself will always be correct, but you may get the wrong instance of that entity number. :P
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Mar 18, 2008 2:16 pm    Post subject: Reply with quote

/me curses the grace period

Why does it exist?
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Tue Mar 18, 2008 11:04 pm    Post subject: Reply with quote

From what I remember to avoid problems with interpolation I guess.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
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