With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: sparcdr, torhu, Tequila

persistant stats problem

Postby Pardner » Fri Dec 03, 2010 9:57 pm

I have been playing round with the code a little. I have been bringing back a few of the classic Q3 style medals/awards (e.g. "Excellent"). I have been adding the award counters to the persistant[] typedef in bg_public.h:
Code: Select all
typedef enum {
   PERS_SCORE,                  // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!!
   PERS_HITS,                  // total points damage inflicted so damage beeps can sound on change
   PERS_RANK,                  // player rank or team rank
   PERS_TEAM,                  // player team
   PERS_SPAWN_COUNT,            // incremented every respawn
   PERS_PLAYEREVENTS,            // 16 bits that can be flipped for events
   PERS_ATTACKER,               // clientnum of last damage inflicter
   PERS_ATTACKEE_ARMOR,         // health/armor of last person we attacked
   PERS_KILLED,               // count of the number of times you died
   // player awards tracking
   PERS_EXCELLENT_COUNT,         // two successive kills in a short amount of time
#ifndef SMOKINGUNS
   PERS_IMPRESSIVE_COUNT,         // two railgun hits in a row
   PERS_DEFEND_COUNT,            // defend awards
   PERS_ASSIST_COUNT,            // assist awards
   PERS_GAUNTLET_FRAG_COUNT,      // kills with the guantlet
   PERS_CAPTURES               // captures
#else
   //bank robbery
   PERS_ROBBER
#endif
} persEnum_t;



I simply followed the Q3 style code to give an Excellent award, and it seemed to work fine (two kills in a short time and I got an award). But I had a problem: whenever I bought a scope I got an award! Oopss! I don't think it was due to the way the I awarded the Excellent medal, so I looked further.

I realized that I did not increase the MAX_PERSISTANT in q_shared.h. I increased MAX_PERSISTANT by 1 to account for the added Excellent award.
Code: Select all
#define   MAX_PERSISTANT         11

No more award when I get a scope, but now the game crashes when I try to play a game. None of the map entities spawn. After while I get the following error:
Code: Select all
Error: Unknown event 236


Any ideas? I am using the included batch files to build qvm and loading them as a separate mod. I was hoping to get this done before I let the cat out of the bag, but I guess I'm stuck.

Image
Image
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby /dev/random » Fri Dec 03, 2010 10:52 pm

Iirc the sizes are also part of the netcode, i.e. you'd have to re-compile the engine(s) as well.
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Postby Pardner » Sat Dec 04, 2010 9:12 pm

I was afraid of that, that's something I have not been able to do. I tried following Suca's tutorial on my old computer and my new one and I keep getting the same error.
Code: Select all
Error   1   fatal error C1189: #error :  "Operating system not supported"   c:\game files\smokin' guns\source\1.1\code\qcommon\q_platform.h   308   ui

I never really pursued it because I never had a reason :|
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Re: persistant stats problem

Postby Tequila » Tue Dec 07, 2010 11:20 am

Pardner wrote:I have been playing round with the code a little. I have been bringing back a few of the classic Q3 style medals/awards (e.g. "Excellent"). I have been adding the award counters to the persistant[] typedef in bg_public.h:
...

I realized that I did not increase the MAX_PERSISTANT in q_shared.h. I increased MAX_PERSISTANT by 1 to account for the added Excellent award.
Code: Select all
#define   MAX_PERSISTANT         11

No more award when I get a scope, but now the game crashes when I try to play a game. None of the map entities spawn. After while I get the following error:
Code: Select all
Error: Unknown event 236


Any ideas? I am using the included batch files to build qvm and loading them as a separate mod. I was hoping to get this done before I let the cat out of the bag, but I guess I'm stuck.


Hi Pardner, nice to see you start playing with the code ;)
/dev/random is right, the MAX_PERSISTANT is also used in the net code and this is the reason you got crashes.
A way to keep your work for the current engine is maybe to simply replace an unused tag from the persEnum_t with the PERS_EXCELLENT_COUNT one. I checked a little the code and I think you can replace the PERS_HITS one. So try to set again MAX_PERSISTANT to 10 and use the following code for the enum:
Code: Select all
typedef enum {
   PERS_SCORE,                  // !!! MUST NOT CHANGE, SERVER AND GAME BOTH REFERENCE !!!
#ifndef SMOKINGUNS
   PERS_HITS,                  // total points damage inflicted so damage beeps can sound on change
#else
   PERS_EXCELLENT_COUNT,         // two successive kills in a short amount of time
#endif
   PERS_RANK,                  // player rank or team rank
   PERS_TEAM,                  // player team
   PERS_SPAWN_COUNT,            // incremented every respawn
   PERS_PLAYEREVENTS,            // 16 bits that can be flipped for events
   PERS_ATTACKER,               // clientnum of last damage inflicter
   PERS_ATTACKEE_ARMOR,         // health/armor of last person we attacked
   PERS_KILLED,               // count of the number of times you died
   // player awards tracking
#ifndef SMOKINGUNS
   PERS_IMPRESSIVE_COUNT,         // two railgun hits in a row
   PERS_EXCELLENT_COUNT,         // two successive kills in a short amount of time
   PERS_DEFEND_COUNT,            // defend awards
   PERS_ASSIST_COUNT,            // assist awards
   PERS_GAUNTLET_FRAG_COUNT,      // kills with the guantlet
   PERS_CAPTURES               // captures
#else
   //bank robbery
   PERS_ROBBER
#endif
} persEnum_t;

Now PERS_HITS won't be available and you may have to comment out some code in game/ai_dmq3.c and game/ai_dmnet.c where PERS_HITS is referenced but useless. You may just insert few "#ifndef SMOKINGUNS" directive to be clean.

I just hope this will help you ;)
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby Pardner » Tue Dec 07, 2010 2:56 pm

Thanks for the help, unfortunately it is only a quick workaround and I currently have a total of 6 awards implemented. This will help test them individually, but in the end I will need to change MAX_PERSISTENT.

Would it be possible for someone to change MAX_PERSISTENT to 16 in the current 1.1 branch, compile, and send it to me? I hate asking like that because the ideal solution would be for me to compile my own :roll: I'll try to make sometime next week.
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby Pardner » Tue Dec 07, 2010 11:17 pm

Pardner wrote:
Code: Select all
Error   1   fatal error C1189: #error :  "Operating system not supported"   c:\game files\smokin' guns\source\1.1\code\qcommon\q_platform.h   308   ui


Had a little time today go I search for this error. I found two helpful sites:
http://www.ioquake.org/forums/viewtopic.php?f=12&t=1572
http://code.google.com/p/cleanquake3/issues/detail?id=1
I replaced "_WIN32_" with" WIN32" and it compiled fine.

But now I am back to the first problem. I compiled r539 1.1 branch and it ran fine.

But if I increased MAX_PERSISTENT to 11 and added PERS_EXCELLENT_COUNT to persEnum_t. I still get the same problem: no entities spawn and eventually crashes with "Unknown event #" . Note: I only changed MAX_PERSISTENT and persEnum_t, I did not use my implemented awards.

This was supposed to be a nice simple project to become familiar with the SG source! :roll: I'll keep trying and let you know. If you have any pointers please let me know.
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby /dev/random » Wed Dec 08, 2010 1:25 am

Could you provide the full .diff?
User avatar
/dev/random
Smokin' Amigo!
 
Posts: 410
Joined: Thu Jan 22, 2009 1:58 pm



Postby Pardner » Wed Dec 08, 2010 5:53 am

pardon my ignorance, but how can I get you a full .diff? I have my code under sparate version control, but I couldn't find where I could generate a full diff for all my modified files. Here is the unified diffs for all my individual modified files:
  • game/bg_public.h
    Code: Select all
    ===================================================================
    --- C:/Users/Brett/Desktop/code/game/bg_public.h   (revision 1)
    +++ C:/Users/Brett/Desktop/code/game/bg_public.h   (working copy)
    @@ -442,6 +442,7 @@
        PERS_ATTACKEE_ARMOR,         // health/armor of last person we attacked
        PERS_KILLED,               // count of the number of times you died
        // player awards tracking
    +   PERS_EXCELLENT_COUNT,         // two successive kills in a short amount of time
     #ifndef SMOKINGUNS
        PERS_IMPRESSIVE_COUNT,         // two railgun hits in a row
        PERS_EXCELLENT_COUNT,         // two successive kills in a short amount of time
  • qcommon/q_platform.h
    Code: Select all
    ===================================================================
    --- C:/Users/Brett/Desktop/code/qcommon/q_platform.h   (revision 1)
    +++ C:/Users/Brett/Desktop/code/qcommon/q_platform.h   (working copy)
    @@ -98,7 +98,7 @@
     
     #define DLL_EXT ".dll"
     
    -#elif __WIN32__
    +#elif WIN32
     
     #undef QDECL
     #define QDECL __cdecl
  • qcommon/q_shared.h
    Code: Select all
    ===================================================================
    --- C:/Users/Brett/Desktop/code/qcommon/q_shared.h   (revision 1)
    +++ C:/Users/Brett/Desktop/code/qcommon/q_shared.h   (working copy)
    @@ -1089,7 +1089,7 @@
     #define   MAX_WEAPONS            16
     #else
     // Must be changed for Smokin' Guns MOD
    -#define   MAX_PERSISTANT         10
    +#define   MAX_PERSISTANT         11
     #define   MAX_POWERUPS         13
     #define   MAX_WEAPONS            21
     #endif

These are the only modifications I have made. I can compile a new smokinguns.exe and new qvms. I use the new smokinguns.exe to launch my mod with the qvms. When I launch a map, none of the entities spawn. The odd thing is if I use my new exe but do not load my mod and use the 1.1b4 qvms, the map entities are fine.
*shrug*
I looked up the revision log of MAX_PERSISTENT on the SF SVN and it has always been set to 10 since the first checkin.
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby Tequila » Wed Dec 08, 2010 12:05 pm

Pardner wrote:pardon my ignorance, but how can I get you a full .diff? I have my code under sparate version control, but I couldn't find where I could generate a full diff for all my modified files. Here is the unified diffs for all my individual modified files:
...

These are the only modifications I have made. I can compile a new smokinguns.exe and new qvms. I use the new smokinguns.exe to launch my mod with the qvms. When I launch a map, none of the entities spawn. The odd thing is if I use my new exe but do not load my mod and use the 1.1b4 qvms, the map entities are fine.
*shrug*
I looked up the revision log of MAX_PERSISTENT on the SF SVN and it has always been set to 10 since the first checkin.

Hi Pardner,

I guess you're using TortoiseSVN. If you right-click other your C:/Users/Brett/Desktop/code folder you should have an entry in the Subversion sub-menu to produce a full diff for the code folder. I would have suggested you to put all your SVN checkout in a dedicated folder so a right-click on that folder would be better to produce a full project diff.

About the QVM loading you should be able to see some version and building time during game initialization so you should be sure your QVM is really loaded. In doubt, catch your game console output and show it to us after put it on a pastebin site.

And yes, MAX_PERSISTENT is there since the beginning as this is a trick from the original Q3 Mod. Without this trick, the original Q3 mod wouldn't have working other the original Q3 engine.

If we change it today, this will mean new QVMs won't be usable with older game engine and also older demo won't run cleanly with the new engine.

I would also prefer to change this MAX_* constraints with little higher values but this will mean we will have to change also the protocol version and we won't be anymore natively supported by ioQuake3 engine. I'm still not sure what is best.
8)
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby Pardner » Wed Dec 08, 2010 4:32 pm

Tequila wrote:I guess you're using TortoiseSVN. If you right-click other your C:/Users/Brett/Desktop/code folder you should have an entry in the Subversion sub-menu to produce a full diff for the code folder. I would have suggested you to put all your SVN checkout in a dedicated folder so a right-click on that folder would be better to produce a full project diff.

Hmm.... the only place that I can find a full unified diff is in the revision log which basically shows what I posted above. I do have all my checkout in a dedicated folder. For testing purposes I checked out my r1 and made the above changes. Unified diff

Tequila wrote:About the QVM loading you should be able to see some version and building time during game initialization so you should be sure your QVM is really loaded. In doubt, catch your game console output and show it to us after put it on a pastebin site.

Here is the condump after I launch smokinguns.exe and here is the condump after I launch a map. Note: I do not have my qvms packed in a pk3 rather I am launching smokinguns with sv_pure 0.

Tequila wrote:And yes, MAX_PERSISTENT is there since the beginning as this is a trick from the original Q3 Mod. Without this trick, the original Q3 mod wouldn't have working other the original Q3 engine.

The VQ3 engine has MAX_PERSISTENT set to 16 though. It must have been changed at some point.

Tequila wrote:If we change it today, this will mean new QVMs won't be usable with older game engine and also older demo won't run cleanly with the new engine.
I would also prefer to change this MAX_* constraints with little higher values but this will mean we will have to change also the protocol version and we won't be anymore natively supported by ioQuake3 engine. I'm still not sure what is best.

Nough said. Well I think I will keep this project on the back burner. I will keep trying to get things working and then I might package it up as a modification if people want to try it out. Maybe in the future we could make a the big change.
User avatar
Pardner
SG Team
 
Posts: 1786
Joined: Fri Nov 18, 2005 5:48 am
Location: MD, USA



Postby Tequila » Wed Dec 08, 2010 5:06 pm

Pardner wrote:Hmm.... the only place that I can find a full unified diff is in the revision log which basically shows what I posted above. I do have all my checkout in a dedicated folder. For testing purposes I checked out my r1 and made the above changes. Unified diff

Well I just remember I had a tortoise svn in a windows vm... You can also use the "Create patch..." menu entry under the TortoiseSVN menu.

Pardner wrote:Here is the condump after I launch smokinguns.exe and here is the condump after I launch a map. Note: I do not have my qvms packed in a pk3 rather I am launching smokinguns with sv_pure 0.

Well this way is okay, your QVMs are well loaded as we can see "Smokin' Guns 1.1, 20100812, 09:21:17" lines showing you just built that QVMs.

Pardner wrote:The VQ3 engine has MAX_PERSISTENT set to 16 though. It must have been changed at some point.

Nough said. Well I think I will keep this project on the back burner. I will keep trying to get things working and then I might package it up as a modification if people want to try it out. Maybe in the future we could make a the big change.

Well "#define MAX_PERSISTANT 16" is the legacy value.
Maybe a refactoring work will be necessary at the time. But this is not our current goal.

If I can suggest something you can play with in the code which can be interesting is the possibility to choose the headModel. If I remember well, that base code is the ioQ3 base one. I didn't merged it as that wasn't mandatory for the ioQ3 backport, but this can be a simple and interesting stuff to tune player models.

8)
User avatar
Tequila
SG Team
 
Posts: 1100
Joined: Thu Nov 15, 2007 11:33 pm
Location: Montpellier, France



Postby Joe Kari » Wed Dec 08, 2010 8:27 pm

... or something simplier, if you have some math knowledge, add a new func entity: a train that can rotate too ;)
Should be easy to do, if you have some time...

It could use the path_corner entity to get the angle, then, using the func_train as a template, just add progressive rotation from one point to another...

Imagine a map in a gold mine, with a wagon... could be very funny ! :D
User avatar
Joe Kari
SG Team
 
Posts: 879
Joined: Sun Sep 16, 2007 8:44 pm
Location: France




Return to Code

Show Sidebar
Show Sidebar

User Control Panel