Quake3World.com Forums
     Programming Discussion
        is increasing MAX_WEAPONS safe?


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: is increasing MAX_WEAPONS safe?

Warrior
Warrior
Joined: 16 Jun 2005
Posts: 76
PostPosted: 09-07-2005 04:43 PM           Profile Send private message  E-mail  Edit post Reply with quote


I'm debugging a mod created by someone else. It has MAX_WEAPONS set to 21 instead of the standard 16. This is the size of ps.ammo[]. And this seems to work. It seems that the elements with index > 15 are only used by the server, not by the bg_* stuff. Does this mean that only the first 16 elements are transmitted from the server to the client? Otherwise the playerstate would have been screwed up, as far as I can tell.

EDIT: seems that cgame uses index > 15 too, which is sort of confusing.



_________________
Smokin' Guns
Monster Browser


Top
                 

Warrior
Warrior
Joined: 24 Jul 2005
Posts: 93
PostPosted: 09-07-2005 05:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


no the stats can over 16 bits and you will most likely need a new playerState_t item. and send that through msg.c (need the engine source) i havent exactly figured this one out yet... as you need to send a different bit count, i guess u could use 32 but 64 is more efficent.

with a mod, you cannot increase MAX_WEAPONS to more than 16 because its shared with the engine. (q_shared files shouldnt be modified, only added too if absolutely need be)




Top
                 

Warrior
Warrior
Joined: 16 Jun 2005
Posts: 76
PostPosted: 09-07-2005 08:21 PM           Profile Send private message  E-mail  Edit post Reply with quote


Now I know why it works. He has changed the sizes of the arrays, and removed and added a few fields. But it all adds up to the same size as in vanilla q3.

In q_shared.h:
Quote:
// bit field limits
#define MAX_STATS 16
#define MAX_PERSISTANT 10
#define MAX_POWERUPS 13
#define MAX_WEAPONS 21

// 4 ints have been used for other variables, so total ints of 60 instead of 64 here



_________________
Smokin' Guns
Monster Browser


Top
                 

Warrior
Warrior
Joined: 24 Jul 2005
Posts: 93
PostPosted: 09-08-2005 02:32 PM           Profile Send private message  E-mail  Edit post Reply with quote


so this is a engine mod not a regular mod?




Top
                 

Warrior
Warrior
Joined: 16 Jun 2005
Posts: 76
PostPosted: 09-08-2005 04:20 PM           Profile Send private message  E-mail  Edit post Reply with quote


It's a regular mod, vanilla quake3.exe. The web site is in my sig.



_________________
Smokin' Guns
Monster Browser


Top
                 

Warrior
Warrior
Joined: 24 Jul 2005
Posts: 93
PostPosted: 09-08-2005 04:32 PM           Profile Send private message  E-mail  Edit post Reply with quote


you cannot modify those values for a regular mod, trust me, you do it you crash.

powerups and weapons are sent as 16 bit arrays in the engine.




Top
                 

Warrior
Warrior
Joined: 16 Jun 2005
Posts: 76
PostPosted: 09-08-2005 04:49 PM           Profile Send private message  E-mail  Edit post Reply with quote


Download the mod and try for yourself. I can promise you it works. And it's one of the coolest q3 mods ever. :icon31:

Maybe later I'll have a look in the engine code to see what's really going on with playerstate.



_________________
Smokin' Guns
Monster Browser


Top
                 

Timbo
Timbo
Joined: 09 Jun 2000
Posts: 1099
PostPosted: 09-08-2005 06:08 PM           Profile Send private message  E-mail  Edit post Reply with quote


ensiform wrote:
you cannot modify those values for a regular mod, trust me, you do it you crash.

powerups and weapons are sent as 16 bit arrays in the engine.


It's certainly possible, but I for one wouldn't recommend it. A better solution would have been to implement a marshalling/demarshalling scheme for the existing data structures such that you can define what you want in the playerstate on a higher level. You could even get clever and have it time multiplex to inflate the data limit a little.

It's all water under the bridge now though I guess, given that if you use the Q3 source you can just-damn-change-it(tm).




Top
                 

Recruit
Recruit
Joined: 09 Sep 2005
Posts: 9
PostPosted: 09-09-2005 01:36 AM           Profile Send private message  E-mail  Edit post Reply with quote


Will modifying the values and builidng a new engine destroy mod compatibility though?

Hmmm ... the mod code doesn't do the transmitting and receiving directly, so maybe it won't destroy it?

The engine source is great, compiles right out of the box on Mac :)




Top
                 

Warrior
Warrior
Joined: 24 Jul 2005
Posts: 93
PostPosted: 09-12-2005 04:45 PM           Profile Send private message  E-mail  Edit post Reply with quote


just make the mod a standalone game :icon26:




Top
                 

Recruit
Recruit
Joined: 09 Sep 2005
Posts: 9
PostPosted: 09-13-2005 10:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


Riiiiight. But keeping mod compatability == instant standalone-ness.




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.