Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - QwazyWabbit

Pages: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 ... 75
76
0x1337c0de / Toward a better DoRespawn
« on: March 22, 2020, 04:20:47 AM »
Every time I had to look at DoRespawn it always annoyed me to see these lines in it:

Code: [Select]
for (count = 0, ent = master; ent; ent = ent->chain, count++)
;

and

Code: [Select]
for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
;

The crazy comma operators and the dangling semicolon always pressed my WFT button.

Since my age and health conditions make it dangerous for me to venture forth into the dirty world of Coronavirus infestations and since zombie-making infection carriers are indistinguishable from normal humans unless you have infrared vision to spot the fevers, I am confined to my home for the weekend, doing my part to flatten the curve and save the world. I was "essential personnel" Friday and I will be again Monday but once I solve one problem Monday I will be back to saving the world by not participating in it.

So I decided to focus on this one function in Q2 mods called DoRespawn. This is the "Think" function that gets triggered when it's time to respawn items like armor shards, armor jackets, weapons, health boxes and pills, megas, etc. Anything that gets picked up and needs to be respawned after a scheduled time period.

Modern C has different rules than it did back in the days of the creation of Q2 and Microsoft Visual C++ of 1997. Some idioms remain but the particular idiom used by Zoid just makes a code maintainer stop and say "Oh? Hmmmm." Modern C compilers are also better at optimizing code so it's not necessary to resort to idioms in an attempt to make the code faster. Succinct C is not necessarily efficient C.

So here's a fix for the most basic version of DoRespawn with the idiomatic syntax removed and some error checking and reporting in place and some coverage for cases of null pointer dereference. Some versions have more code in place to take various actions on respawn but my primary goal was to refactor the for loops into something more easily understood at a glance and to maintain.


Code: [Select]
void DoRespawn(edict_t* ent)
{
if (ent == NULL)
{
gi.dprintf("NULL ent passed to %s\n", __func__);
return;
}

if (ent->team)
{
edict_t* master;
unsigned count;
unsigned choice;

master = ent->teammaster;
if (master == NULL)
return;

count = 0;
for (ent = master; ent; ent = ent->chain)
count++;

assert(count != 0);
choice = rand() % count;

count = 0;
for (ent = master; count < choice; ent = ent->chain)
count++;
}

if (ent)
{
ent->svflags &= ~SVF_NOCLIENT;
ent->solid = SOLID_TRIGGER;
gi.linkentity(ent);

// send an effect
ent->s.event = EV_ITEM_RESPAWN;
}
}

QW

77
/dev/random / Re: The Strange and Interesting Thread
« on: February 23, 2020, 02:59:50 PM »
Yep. He’s a flat earther.

78
dm / Re: User Abuse Towards Others
« on: February 22, 2020, 04:02:29 PM »
It's a script or bot of some kind. It shoots intermittently, repeats taunts, runs backwards, doesn't seem to work to acquire weapons and when it drives itself into a corner or water it doesn't work to escape and often drowns. I watched it walk backward off a spawn point and into lava.

79
/dev/random / Re: The Strange and Interesting Thread
« on: January 29, 2020, 01:47:25 PM »
 I was surprised to find this story is already a week old. He was arrested in San Diego.

https://timesofsandiego.com/crime/2020/01/20/police-arrest-la-mesa-store-owner-after-videos-show-attacks-on-tv-news-crews/

80
/dev/random / Re: The Strange and Interesting Thread
« on: January 28, 2020, 04:13:25 PM »
I guess he’s having a hard time coping with the attention.


https://twitter.com/tonygidlund/status/1219490641886859264?s=20

81
I'm sipping my coffee waiting for the brain to kick in. :)

All good info here. Let's discuss.
I'm currently using Quake 2 Pro as the client and Quake 2 DOS as the dedicated server that running on the Maraakate's coop server mod with newly added maps. i don't believe that could be the problem due to changing the maps because of three occurrences the happen as to when this error appears.

I don't think the client matters. Mostly, the client can only ask the server to do something, it's up to the server game code to decide whether it will do it and how it will do it.

The first occurrence is when a player exits the map.
Exits as in taking an exit door, I presume. When that happens the next map opened is the one defined in the current map. All the original single-player maps had a next map, the SP game depended on this. Many DM maps don't. Failing to have a next map defined is supposed to cause the server to choose one, usually from a map list. The map list file (assuming there is one) is defined by the mod code. Some mods didn't always change maps gracefully when this happened. I don't know if this is one of those.

The second occurrence is when the player votes for a different map.
If the mod uses the "map" command to change maps on a vote then the engine will unload and reload the game DLL. This is why you use the "gamemap" command instead. R1q2 will refuse to use "map" in rcon and I assume it will also do so for a voted map but I have not tested this. (IIRC, mods are supposed to use the "gamemap" command in what amounts to a sending of a command string to the engine via the gi.AddCommandString function but I suppose one could put a new map name into the level.changemap string and call ExitLevel.)
From this source: https://bitbucket.org/neozeed/q2dos.git
… and looking at the coop code, I can see many different map votes:
restartmap causes a map command.
gamemode causes a map command.
coop difficulty causes a map command.
warp causes a gamemap command.
playerexit causes a gamemode command which causes a map command.
Lots of ways to force a DLL reload. Most of them would be necessary since they need to force GameInit. :)
If you are restricting your server to coop only mode I recommend disabling all but the vote warp commands or testing your server to see which are safe to use.

And the third occurrence is when changing the map to a different map though the Q2DOS console. Now, when you mentioned running the gamemap command, I will be sure to use that for running such commands in the Q2DOS console.

I used to use the rcon map command until I was enlightened by r1q2. :)

I wanted to also mention that when I run the Maraakate's coop server on the alternative game servers listed: r1q2 dedicated, quake2 dedicated, yamagi dedicated, q2pro dedicated they also produce the wrong Game library is version 4 expected 3 and vice versa. I mention this because I presume there might be a possibility that I wouldn't get that FreeLibrary error message for those alternative game servers if they were to work without crashing and without producing the improper Game library version error.

Wrong game library version is a very bad no no. All bets are off and the engine has every right to not run a game DLL of the wrong type.

The game version is a number that specifies the interface between the engine and the game. The interface is the imports and exports to/from the engine and the game DLL. They specify the contract between them and it affects what functions they can use between them. The version number is the first thing the engine checks when it loads the DLL. EVERY engine should reject a wrong version DLL unless it's going to go to some extreme measures to figure out how to accommodate a different version DLL. There is NO WAY to tell, from the version number alone, what the interface looks like.

The coop code in the neozeed repo I cited above is version 4. It will not work with any other engine but Q2dos which, it would appear, expects version 4 DLLs.
Looking at the coop code I see they added a function to the engine called cvar_setdescription in the game that is called numerous times in the game startup.
An engine that doesn't export this function will fail when the game calls it.

When an engine rejects a DLL for wrong API version number it must never call anything in that DLL and it must immediately unload that DLL and stop game service.

If you want a version 3 DLL of coop I suggest: https://github.com/basecq/q2dos.git but I don't know if it has the same features. There are a lot of differences in the code that I am not prepared to analyze.

All this is TMI and more than you wanted to know but that's what happens when my coffee kicks in and I have a day to spare.
I hope it guides you in your troubleshooting.

QW

82
It sounds like your mod is using the “map” command on the vote or console command. This is an old and common error. You should be using “gamemap” instead. The map command should only be used in your startup script.

Which mod are you running?

83
coop / Re: Tastyspleen Coop server crash
« on: October 01, 2019, 09:11:29 PM »
I don't think you can crash a server by spamming just one model but you might be able to do it by spamming different new models. The model indexes are assigned as models are needed up to the limit of the game and if a model already exists in the array it isn't added to the indexes. (You can't fill the array by spamming the same model name.)

Coop mode has always been a little unstable in my experience. The original game was all about a single player with monsters and items in the maps and as long as the maps didn't go over the model limit minus one for the player everything was hunky-dory. The player and map entities are reserved during initialization and the map model indexes are assigned as models are spawned during map load. Load a server with multiple players and monster models and you've got a big load.

The error recovery in Q2 was always a bit thin. It'll crash and report a hard error rather than try to discard and replace items and spend time managing memory or entities. It just wasn't designed for that at the inception. Speed and size on a i386/i486 was the design limitation of the time.

It sounds to me more like you had a larger map and lots of entities in that map and the spawning of a hyperblaster was enough to take it over the limit. I don't remember the bsp name for the Upper Palace (edit: it's city3) but I know that one was a heavyweight map even for DM.

Additionally, when they added VWEP to the game they used index 255 for it and depleted the pool by one.

To diagnose this error the "configstrings.txt" file is dumped by the server into it's root when it happens and might be helpful.

QW

84
Quake / Re: r1q2 how to compile - linux?
« on: August 02, 2019, 09:54:18 AM »
Yep. You need the development libs for libjpeg and libpng.

The first error was because you don't have the header for png file format and its stuctures.
The second error was because you don't have the info for jpeg files.

sudo apt-get update
sudo apt-get upgrade

Then use your package manager to install the development libraries for libjpeg and libpng. These are not just the application libs but they are the libs and headers just like you installed for the OpenGL.

Note: you can generally ignore warnings in the compiler output during make, the r1q2 code is getting a bit old and the compilers complain about usages that used to pass without warning but ERRORS are what you want to watch for and fix their causes.

Once you have updates, I recommend you 'make clean' and 'make'. You don't want old *.o files laying around.



85
Quake / Re: r1q2 how to compile - linux? R1CH 'ard?
« on: August 01, 2019, 09:21:17 PM »
Quote
Did you check the OpenGL installation by copy-pasting their sample code in that Wiki? If it works then cd into the r1q2 binaries and did make ref_gl complete without errors?
Quote
I checked and it worked like in tutorial.

Good. It means the GL package installation worked.

No, its landing at same place:
Code: [Select]
make[1]: *** [<builtin>: gl_image.o] Error 1
make[1]: Leaving directory '/home/lsd/r1q2-archive/binaries/ref_gl'
make: *** [Makefile:17: ref_gl] Error 2

Again, you omitted the critical point of error from your "landing at same place".
Yes, make lands at the same place but not necessarily for the same cause.


Quote
anyway  ref_gl its r1ch R1GL or just opengl?

Please read the documentation r1ch provided.
It looks like there is no install and you didn't read the documentation on what to do once you get a successful build.
If there were an install recipe, it will fail if any part of the build failed previously so it's pointless to do it.
I haven't built r1ch's code on Linux for several years, I don't remember all the steps.

The ref_gl code becomes ref_r1gl.dll on Windows, I can only presume that it is ref_gl.so on Linux and it's "r1gl" as stated.

It depends on zlib, libjpeg, libpng so you will need the development libraries for them also.

Missing ANY pieces of the packages on which it depends will "land at same place": make[1] Error 1 or Error 2
you must scroll up to see the actual point of error in order to diagnose the failure. Omitting that error information
from your posts makes it impossible to help you.


86
Quake / Re: r1q2 how to compile - linux? R1CH 'ard?
« on: August 01, 2019, 09:05:01 AM »
Keep to step by step.

Did you check the OpenGL installation by copy-pasting their sample code in that Wiki? If it works then cd into the r1q2 binaries and did make ref_gl complete without errors?

From your post it looks like it worked but your r1q2 client isn’t opening the ref_gl but is opening ref_softx, the software renderer. This is not part of r1q2 but comes with quake2 for Linux. You have me a little confused now.

Did you do ‘make install’ after building r1q2 successfully? I believe this was the next step but check the instructions for r1q2 as I don’t have access right now. R1q2 does assume you have the original Quake2 for Linux previously installed.




87
Quake / Re: r1q2 how to compile - linux? R1CH 'ard?
« on: July 31, 2019, 11:35:10 PM »
The fatal line is actually a little bit above where your post quotes:

In file included from ../../ref_gl/gl_draw.c:23:0:
../../ref_gl/gl_local.h:27:19: fatal error: GL/gl.h: No such file or directory
 #include <GL/gl.h>

The #include <GL/gl.h> means the build expects a module (the OpenGL module libraries and their headers) to be installed on your Linux and the path to that library to be available to the compiler.

You'll have to search for how to install the OpenGL development libraries for your version of Linux.

QwazyWabbit

P.S. If you are not intending to build the full client and the ref_gl but only want to build the r1q2ded server then all you need to do is 'make r1q2ded' and you are done. The dedicated server binary will be in the r1q2ded directory.

88
coop / Re: Custom coop sourcode/dll/so. file from coop v.0.01b
« on: July 22, 2019, 12:20:32 PM »
Since my name was kinda-sorta-almost mentioned I will respond.

The dll code you want is in the coop folder of the repository quadz directed you to.

You can build just that dll from the sources using the tools mentioned.
VS2005 is deprecated and I don't believe Microsoft has it available for download anymore so you'll have to search for a legitimate copy of it.
I would not recommend doing that. I recommend using VS2019 Community Edition, the current toolset, and download it directly from Microsoft for free.

Since you don't exactly specify if your running a Windows or Linux server I assume you want the Windows DLL.
I have attached it here. This is the 32-bit DLL.

QwazyWabbit (not the mama)

89
Quake / Re: Looking for assistance with R1Q2 anticheat on server
« on: July 17, 2019, 10:50:35 PM »
Good. I'm glad you found some documentation. When you get done configuring AC for your server you can explain it to me. :) I've never fully configured one myself. I believe the hashes are md5 hashes. That by itself might be a problem for AC these days since MD5 is vulnerable to hash collisions (non-identical files generating the same hash). I don't know if it's possible to design a spiked skin that would pass AC validation and still be usable in the game as a valid skin. SHA256 is preferred for code signing and SSL certificates now. The key to AC is the anticheat.dll and that source has never been public. The server requests a hash of a file on the client and the client computes the hash and reports it, they must match your whitelist or it's a bad skin. I do believe anticheat.dll has references to SHA256 so you might look into that.

90
Quake / Re: Looking for assistance with R1Q2 anticheat on server
« on: July 16, 2019, 10:14:51 PM »
When setting anticheat there are different modes it can be in.
You, as server admin are responsible for setting the AC policy.

set sv_anticheat_required "1"
// Require use of the r1ch.net anticheat module by players. Default 0.
// 0: Don't require any anticheat module.
// 1: Optionally use the anticheat module. Other clients can still play.
// 2: Enforce the anticheat module. Only valid R1Q2, EGL, Q2PRO or AprQ2 users can play.

If setting AC, mode 1 is recommended for the widest number of users. If there is a question whether a player is cheating, you can force anticheat on players individually.

The files
anticheat-hashes.txt
anticheat-cvars.txt
anticheat-tokens.txt
are required when anticheat is enabled.

The hashes file contains the hashes and filenames of permitted or disallowed models and players and weapons. It's the server admins job of creating them.
The purpose is to prevent players from using spiked models or weapon models. You can specify both allowed and disallowed models.

The cvar file specifies limits on client cvars like cl_maxfps, cl_nodelta, rate, timescale, and whether to enforce download options.

I'm not sure what the tokens file was for.

Access to the admins forum where these files were maintained was restricted. R1ch has since abandoned the r1q2 project and the r1ch.net forums.
I don't know where you can find more documentation on the files and their formats or where a valid hash file can be obtained.

QW


Pages: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15 16 ... 75