The Write functions?
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
The Write functions?
I have been wondering for the longest time how to correctly use the WriteByte and other Write functions. Can someone be kind enough to give me a brief overview of each of the functions, and an example for use?
That would be most helpful!
That would be most helpful!
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
WriteByte and friends are an ugly hack. You don't use them unless you know what you're doing, unless there's no other choice to achieve the effect you want.
They permit you to write 'custom' messages from the server to the client, except that those messages *must* be in a form that the client understands.
This means if something is documented as a coord, use writecoord. Don't use writeshort and imagine that its all the same. Because it varies from engine to engine what a coord actually is.
messages start with some SVC_FOO byte, and then its svc-specific what should be written after. Look in the sourcecode of your target quake client to see the exact details on an svc-by-svc basis.
you can achieve some things that are not otherwise possible, prydon gate's centerprint string concatination is one example, but for the most part, existing extensions are simply much easier to use.
If you use DP or FTE, you should never need to do writebytes. There is a proper builtin to do it for you, somewhere. At least that's the theory. No new standard extensions expect you to use writebyte.
'illegible server message' means you broke it.
I confess that I'm somewhat anti-writebyte as it makes translation between nq and qw mods harder, which is something my engine does a lot of... :)
So yeah, my point is, look at the svcs, if you see a nice looking one, look for a builtin instead first, as its more reliable to do so.
They permit you to write 'custom' messages from the server to the client, except that those messages *must* be in a form that the client understands.
This means if something is documented as a coord, use writecoord. Don't use writeshort and imagine that its all the same. Because it varies from engine to engine what a coord actually is.
messages start with some SVC_FOO byte, and then its svc-specific what should be written after. Look in the sourcecode of your target quake client to see the exact details on an svc-by-svc basis.
you can achieve some things that are not otherwise possible, prydon gate's centerprint string concatination is one example, but for the most part, existing extensions are simply much easier to use.
If you use DP or FTE, you should never need to do writebytes. There is a proper builtin to do it for you, somewhere. At least that's the theory. No new standard extensions expect you to use writebyte.
'illegible server message' means you broke it.
I confess that I'm somewhat anti-writebyte as it makes translation between nq and qw mods harder, which is something my engine does a lot of... :)
So yeah, my point is, look at the svcs, if you see a nice looking one, look for a builtin instead first, as its more reliable to do so.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
I love writebytes. They're the easiest to implement as features in engines.
the pf builtins are more slicker, though, but are tougher...
btw is there any necessary room for proposing a "pf_sound2"? This is one pf_ I feel that's needed for altered pitch and loop options... combine it with "pf_soundparm" to ramp volume and pitch with a duration on a channel
the pf builtins are more slicker, though, but are tougher...
btw is there any necessary room for proposing a "pf_sound2"? This is one pf_ I feel that's needed for altered pitch and loop options... combine it with "pf_soundparm" to ramp volume and pitch with a duration on a channel
i should not be here
- leileilol
- Posts: 2783
- Joined: Fri Oct 15, 2004 3:23 am
Re: The Write functions?
Mexicouger wrote:...Can someone be kind enough to give me a brief overview of each of the functions, and an example for use?
That would be most helpful!
Here's an example of a problem solved by the use of WriteByte, along w my newbie questions, and answers by Spike.
- OneManClan
- Posts: 243
- Joined: Sat Feb 28, 2009 2:38 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest