The online racing simulator
LFS Server Utility
(10 posts, started )
LFS Server Utility
I've written a Perl utility that uses InSim to perform several functions that I think are interesting.

It can:

* Send a MOTD to the user on connect
* Limit races to certain lfs accounts
* Prevent users who have never driven a car/track combo online from entering a race
* Check personal bests and only allow racers to join who have a time within an admin configurable percentage of the world record

Those pb features are also configurable to only be active at certain times of the day, certain days of the week, or any other combination of times you might dream up. At some point, I plan to make the user list time based as well, so that one might have a server wide open except during league events.

Before releasing, I'm planning to at the very least implement a track/car rotator that will prevent users from joining the race with the wrong car, in the event they have one that is now disallowed still selected.

I'm also working on a function to enforce a pit window, with the admin's option as to what the penalty should be for failing to pit within the window.

I'm hoping to have it cleaned up and released in the next day or two.

What I would like from you, gentle reader, is to help me come up with a reasonable name and a list of features for the future. I intend for it to be a kitchen sink of sorts for add-on features to make your LFS serving experience more interesting.

If you want to see the MOTD (and perhaps other features as I continue to test) in action, you can connect to "Bob's U Drive It" and play around. Try not to be too annoyed by it showing you the MOTD.

Any thoughts or suggestions are welcome.
You've been reading my wishlist

Any chance of implementing this?
any screen shots of the app?
#4 - X-Ter
Sounds like a great tool. I expect it to work with both a dedicated as well as with a non dedicated server, yes?

How about a feature that logs the users stats? Let me explain...
I run the server for 24 hours, UFR and Blackwood GP selected. The next 24 hours I switch to the XFR and only want those who made at least 5 podiums from the previous day to be allowed in. Possible? Please say yes
this is cool

you need a message like

"I'm Sorry, you suck to bad to join this server."

No screenies, as there's no GUI. All config is done by file. It's just a daemon that runs quietly.

OldBloke, I could do that, since it's easy enough to check if a user is an admin, but your commands would have to be echoed to everyone on the server, since the /mso command doesn't have the originating username as part of the packet, and /mso always sends an MSO packet, rather than an MSS, which does, even when you ask for MSS messages.

Basically, that leaves your options as follows: a) do a command that gets echoed to everybody, like saying "kick <user> <reason>" in a standard talk window, which everyone would see or b) use the /mso command with a password, like "/mso <pass> kick <user> <reason>".

The user could easily be notified via race control message or private message the reason for the kick/ban/whatever, if you don't mind them spectating for a few seconds while they're given time to read what the server is telling them before it actually disconnects them.

Tell me how you want it to work, and your wish is my command.

The pit window enforcement still doesn't work right, but I got the rotator working today, except for the time-based rotation, but you can have it rotate tracks after any number of races you like.

Eh, what the hell, here's the current state of things..see if you can make sense of it.

Get it in tar.gz or ZIP (not that it needs compression :shrug

The README:

LFS Server Utility
------------------
Copyright 2007, Nathan Mills <[email protected]>

This program uses InSim to (optionally) do the following things:

* Send a MOTD to the user on connect
* Limit races to certain users (to allow league races without passwords)
* Allow only racers who have driven the track in their chosen car before
* Allow only racers with a pb within a admin-configurable amount of the
world record at certain times of day
* Limits lfsworld queries to avoid tarpitting

It will shortly also:

* Enforce a pit window with time penalties, forced spectate, kicks, or bans


Prerequisites
-------------
An LFS server

A working Perl installation. ActivePerl may work for Windows users, but I
haven't tested it. If you decide to try it work Windows, let me know what
you find! :)

An lfsworld IdentKey, if you want to use the pb check

Perl Modules:
* POE
* POE::Component::Client::HTTP
* HTTP::Request
* Time::Period


Installation
------------
- Install the required Perl modules using RPM, CPAN, or however you do it on
your operating system. POE RPMs are available for FC5 from:

http://dries.ulyssis.org/rpm/

- I installed all of the perl-POE packages, but I have plenty of disk space.

- Obtain an IdentKey for lfsworld.

- Unpack the distribution archive.

- Edit the lfsutils.cfg file to your liking. Hopefully the comments are
enough to get you started.

- Edit the contents of the motd.txt and the admin_motd.txt file, or
create your own and change the filenames in lfsutils.cfg

- Start your LFS server's InSim function on the port you configured
in lfsutils.cfg

- Start the utils.pl program with 'perl utils.pl', double clicking
it on Windows, or however else you like.

Usage Notes
-----------

Currently, there is a bit of unexpected behavior with the track rotator,
specifically that if the cars you have configured to be active in the
utility are not available on the server when you first start the utility,
nobody will be able to race, since the utility will prevent racers from
joining the race with a car other than one you specified as allowed.

Secondly, if you typo the car names, the /cars command will fail on the
server, but the utility will think it went through, possibly causing
the aforementioned trouble where none of the cars you told the utility
to accept are active on the server.

If that happens, an admin can either configure the proper cars, or use
/cars all, although the utility will still limit the usable cars, at
least the ones that should be selectable will be.

Thirdly, be sure to use all caps for the car and track names.

Two other notes. Time based rotation isn't working yet, so don't
try it. It's mostly there, but nothing ever starts the timer
initially.

If the rotator is enabled, the utility will end the race immediately
after the last person has finished.

Lastly, watch for falling bugs! ;)


License
-------
Copyright (c) 2007 Nathan Mills <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Quote from X-Ter :Sounds like a great tool. I expect it to work with both a dedicated as well as with a non dedicated server, yes?

How about a feature that logs the users stats? Let me explain...
I run the server for 24 hours, UFR and Blackwood GP selected. The next 24 hours I switch to the XFR and only want those who made at least 5 podiums from the previous day to be allowed in. Possible? Please say yes

There's no reason why it shouldn't work with any LFS server, as long as it's running InSim and the two can communicate.

I'll add it to the todo list. My first thought on implementation is using SQLite to log the race and results information, and also allowing the admin to construct an arbitrary SQL query to decide who should be allowed to race.

Would that work for you?

Edited to add: Falcon140, those messages will soon be easily configurable. As it is, it's really easy to edit the Perl file and make it say whatever you want.
#8 - X-Ter
Quote from nathanm :Would that work for you?

I don't know since I don't know SQL
Actually, I know almost nothing about computers past the bit where you get them installed an connected to the Internet :ashamed: I actually amazed myslef when I managed to configure my own LAN and connect it to the Internet via router
Quote from X-Ter :I don't know since I don't know SQL
Actually, I know almost nothing about computers past the bit where you get them installed an connected to the Internet :ashamed: I actually amazed myslef when I managed to configure my own LAN and connect it to the Internet via router

It's pretty easy. Say you had a table called 'races' that looks like this:

racer | datetime | track | place
------+------------------+-------+------
foo | 02/21/2007 09:22 | BL1 | 2
bar | 02/21/2007 09:22 | BL1 | 8
baz | 02/21/2007 09:22 | BL1 | 1

You could run a query like 'SELECT racer FROM races WHERE place < 4' and it would return:

racer
-----
foo
baz

So the utility would in turn only allow foo and baz to race, since those were the only names returned by the configured query. To use your specific example, assume that the table I posted was much longer and had more results that happened to be exactly the same (imagine foo, bar, and baz are very consistent racers ) You could do a query like 'SELECT racer FROM (SELECT racer, COUNT(place) FROM races WHERE place < 4 GROUP by racer) AS racer_count WHERE count > 4' (There are really two queries, one to count the number of times they placed 3rd or higher, and one to test whether they did it at least 5 times)

Assuming they ran 5 races, that would return:

racer
-----
foo
baz

It is perhaps a bit complicated to do only what you're asking, but where it's really powerful is if you also had a table with the names of your teammates and wanted to allow both people who had done well yesterday and your teammates to race today, you could join that in with hardly any trouble at all. And you could easily have the qualification period span a week instead of a day, or any other time period you liked. The possibilities are essentially endless.

Maybe if I do go that route I should post some example queries to make the simple stuff easier.

One of my big problems is that I work in IT, so I'm not often in the mindset of a non-technical end user.
I'm sure that I could manage with just a tiny bit of help and some nudges in the right direction. Anyway... This server utility promises a lot of good options

LFS Server Utility
(10 posts, started )
FGED GREDG RDFGDR GSFDG