Pages: [1]
Author Topic: Entity flags aren't being transmitted  (Read 19463 times)

Cakes 0
Posts: 3

« on: January 27, 2019, 06:44:51 PM »


I've been hard at work on an ambitious Quake 3 mod (which is quite compatible with OA too!) lately called Uber Arena ( Everything is mostly going smoothly - I've got a lot of the main features / mechanics working, added some visual aids, and fixed some annoying bugs. However, there is one issue that still poses a major roadblock to some visual / audio clarity changes I'd like to make. I ran into this problem a while back, stepped away from it hoping that maybe I missed something, and returned only to have the same issues.

What I want to do is very simple: use the EF_ bitflags defined in bg_public.h to transmit entity state information from the server to the client. Here is some test code to show my attempt at getting this to work:

#define   EF_TELEPORT_BIT      0x00000004      // toggled every time the origin abruptly changes
#define   EF_AWARD_EXCELLENT   0x00000008      // draw an excellent sprite
#define EF_PLAYER_EVENT      0x00000010
#define   EF_BOUNCE         0x00000010      // for missiles
#define   EF_BOUNCE_HALF      0x00000020      // for missiles
#define   EF_AWARD_GAUNTLET   0x00000040      // draw a gauntlet sprite
#define   EF_NODRAW         0x00000080      // may have an event, but no model (unspawned items)
#define   EF_FIRING         0x00000100      // for lightning gun
#define   EF_KAMIKAZE         0x00000200      // UBER ARENA: repurposed for the arc lightning gun
#define   EF_MOVER_STOP      0x00000400      // will push otherwise
#define EF_AWARD_CAP      0x00000800      // draw the capture sprite
#define   EF_TALK            0x00001000      // draw a talk balloon
#define   EF_CONNECTION      0x00002000      // draw a connection trouble sprite
#define   EF_VOTED         0x00004000      // already cast a vote
#define   EF_AWARD_IMPRESSIVE   0x00008000      // draw an impressive sprite
#define   EF_AWARD_DEFEND      0x00010000      // draw a defend sprite
#define   EF_AWARD_ASSIST      0x00020000      // draw a assist sprite
#define EF_AWARD_TYRANT      0x00040000      // UBER ARENA: replace unused denied medal; draw a tyrant sprite
#define EF_TEAMVOTED      0x00080000      // already cast a team vote
#define   EF_POISONED         0x00100000      // poisoned by toxic railgun
#define EF_TRANSMIT      0x00200000      // just for testing

The EF_TRANSMIT is the flag I want to communicate over the server to the client. As you can see it follows the hexadecimal bitflag numbering scheme.

Now I do a bitwise OR assignment / enable in the Upgrade_Weapon function:

void Upgrade_Weapon(int counter, gentity_t *other, int steps) {

   other->client->ps.eFlags |= EF_TRANSMIT; // just for testing


And finally a Bitwise AND / check in CG_Missile function:

if (cent->currentState.eFlags & EF_TRANSMIT) {
      CG_Printf("can you read this");

So the intended outcome of this test is:
1. Upgrade any weapon into an uberweapon (either with 3x pickup, tuning device, or the /uber cmd - all call the same function Upgrade_Weapon). EF_TRANSMIT is turned on.
2. Game should print "can you read this" continuously while a missile is in the air, if the person who fired it has an uberweapon, since EF_TRANSMIT should now be on.
(And I can easily revert this test code since I make regular commits to GitHub)

But, just like my last attempts, nothing happens - the game still refuses to send over the information from the server to the client. Would love to know if anyone has ran into similar struggles in the past, what their solutions were, and why the problem occurs in the first place. The ability for me to send information this way is necessary for me to implement things like homing rocket tracking sounds, recoloring ion plasma gun bolts (special effects dependent on the player having an uberweapon), or adding special weapon-specific indicators around players carrying an uberweapon

Here is the original thread for reference: First post contains some of my initial attempts at using EF_ flags to no avail, in different contexts / with different functions.
« Last Edit: January 27, 2019, 06:48:50 PM by EmeraldTiger » Logged
In the year 3000

Cakes 49
Posts: 3775

Trickster God.

« Reply #1 on: January 29, 2019, 07:28:19 AM »

How do you do the communication between the game and cgame modules?

"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.

Cakes 24
Posts: 584

« Reply #2 on: February 01, 2019, 06:58:13 AM »

According to qcommon/msg.c in the engine code, only 19 bits of eFlags are transmitted from server to client, which means anything over 0x80000 will be ignored.

You'll need to either repurpose an existing flag, or use a different mechanism.
Pages: [1]
Jump to: