I've been working on my own personal build of ProQuake (I don't know if I'm going to distribute it yet - my code is kind of messy and I would have to release it as well due to the GPL). It's probably not very interesting to anybody. It fixes only a few things and it adds MP3 playing support (it only emulates the CD Audio engine so it plays the soundtracks for Quake and the two official Mission Packs). I'm even further less likely to release the source (and therefore the client) because I used FMOD to save time.
While working on the code, I ran into the problem of Quake opening a bunch of random UDP port/socket combos when players connect. We couldn't get it working because we assumed the listen port we defined (default 26000) was the only port used, ala DarkPlaces.
So that got me thinking about compromises. I didn't want to give up compatibility with normal NetQuake engines as either a client or a server. My solution is as follows:
There are a lot of merits to doing this. It maintains compatibility with all other NetQuake engines, it's server-side, and it's a completely optional parameter. It fixes the issue of having to forward all UDP ports to host a Quake server. This way, you can actually have several separate machines behind a NAT running Quake servers by dedicating a different range of ports or each server. Best of all, it's easy as hell to implement. I doubt Baker would need more than the description I wrote above (though I would provide source to him if he asked).
I'm sure something so simple has already been written by someone. I'm just wondering why it isn't widespread. So... there you go. Hell of a first post, right?
P.S. Baker: Fix the options menu code for D3DProQuake. If you wrap from top to bottom, it goes to an empty slot (video options) that will cause a crash.
While working on the code, I ran into the problem of Quake opening a bunch of random UDP port/socket combos when players connect. We couldn't get it working because we assumed the listen port we defined (default 26000) was the only port used, ala DarkPlaces.
So that got me thinking about compromises. I didn't want to give up compatibility with normal NetQuake engines as either a client or a server. My solution is as follows:
- I added a command-line parameter: -startport <port number>. If you don't provide this parameter, nothing is different in the engine.
- qsocket now has an extra member: int defined_port
- Whenever the net_freesockets pool is being populated, it sets the defined_port of each socket to be the <port number> from -startport plus i (the number of the socket from the for loop).
- Now whenever the sockets are distributed from the pool, the same socket won't be used twice, but they will all be within a predictable range, maxed out at 16 players. Instead of NET_OpenSocket(0), just get the defined_port from the sock pulled from the net_freesockets pool: NET_OpenSocket(sock->defined_port).
There are a lot of merits to doing this. It maintains compatibility with all other NetQuake engines, it's server-side, and it's a completely optional parameter. It fixes the issue of having to forward all UDP ports to host a Quake server. This way, you can actually have several separate machines behind a NAT running Quake servers by dedicating a different range of ports or each server. Best of all, it's easy as hell to implement. I doubt Baker would need more than the description I wrote above (though I would provide source to him if he asked).
I'm sure something so simple has already been written by someone. I'm just wondering why it isn't widespread. So... there you go. Hell of a first post, right?
P.S. Baker: Fix the options menu code for D3DProQuake. If you wrap from top to bottom, it goes to an empty slot (video options) that will cause a crash.
Comment