The online racing simulator
Event Control v0.42
(23 posts, started )
Event Control v0.42
Quote :Changelog:

v0.42
  • Now uses CInSim v0.6 (more stable and efficient).
v0.41
  • Director commands for penalties.
  • Director commands for RCM messages.
  • Chat commands (!ecmd) now is a button screen instead of chat lines.
v0.4
  • directors.cfg merged into config.cfg for easier config.
  • Added new commands for race directors for some basic server configuration (!elaps, !equal, !etrack, !ecars, etc.)
  • !eon and !eoff for turning Event Control completely on or off (for admins only).
  • Uses new CInSim v0.4 library.

EVENT CONTROL v0.42

This is another application/tutorial I've written in basic C/C++ using my "CInsim" library. You can find the C++ CInsim library and my previous basic applications here: http://www.lfsforum.net/showthread.php?t=47717

All the source code is provided, of course, as well as a code::blocks project file

This application is an event manager (server oriented) developed for the Fun Racing League (http://www.funracingleague.com/). It was originally designed (as Qual Control) to enforce HARDCORE qualify sessions, in which the use of Shift+P and Shift+S is forbidden, so people can only do realistic pitstops by driving into the pitlane and stopping on the yellow spots.

The current version allows further control over race directing, and introduces the figure of the RACE DIRECTOR, which is a driver appointed as such who can execute all Event Control's commands except for the ones to quit the application, and turn it ON or OFF. These race directors don't need the admin password of the server and are just added by editing a simple text file. Race Directors can configure the server for a race (track, cars, laps, weather, restart, end, etc.), but can't kick or ban users, change slots, and use advanced host configuration commands.

It is an ideal tool if you manage a league and you want to have non-admin drivers handling things like race director chat messages, restarting/ending sessions, reversing top grid drivers for consecutive rounds of a race, sending drivers to spectators, etc.



QUICK START

You have to edit the config.cfg file with a text editor and fill the three required fields: IP, insim_port and admin_password. Then run the executable (The PThreads dll must be in the same directory).

Optionally, you can edit the config.cfg file to add up to 50 lfs license names who will have access to all race director's commands.

All players who join the server using the admin password have automatic access to all commands.

When the executable is launched the application will connect to the server and a welcome message should appear. There can be drivers in the server when the application starts, but be warned that the first thing it does is send everybody to spectators.

Start running!


USAGE AND FEATURES

Basic user commands:
  • !ehelp or !erules : Shows the intro screen.
  • !ecommands or !ecmd : Shows the available commands in the chat, depending on the level of the user.
Race Director commands:
  • !em [message] : Sends a preformatted (auto-color, auto upper case) Race Director message through the host chat.
  • !eopen or !eop : Opens the track for free driving. People can use shift+p and shift+s and rejoin again whenever they want.
  • !eclose or !ecl : Closes the track. Everybody is sent to spectators and nobody can join the track (they are automatically sent to spectators again if they try).
  • !ehardq or !ehq : Restarts a hardcore qualify session. In this no rejoin after shift+p or shift+s is allowed. Succesive restarts of /qualify are on hardcore mode until !eopen or !esoftq is used.
  • !esoftq or !esq : Restarts a soft qualify session. In this spectating and telepitting are allowed at all times.
  • !erace or !erc : Restarts the race.
  • !eend : Ends race and goes to lobby screen.
  • !erev [opt] : In lobby screen, reverses the grid order of the top [opt] number of drivers. If no number is used, by default it's 8.
  • !ecars, !etrack, !eweather, !ewind, !equal, !elaps, !ehours, !emustpit, !ecanreset (all like original LFS host commands).
  • !espec, !ecars, !etrack, !eweather, !ewind, !equal, !elaps, !ehours, !emustpit, !ecanreset, !efcv, !emidrace, !eclear, !ep_dt, !ep_sg, !ep_30, !ep_45, !ep_clear, !ercm, !ercm_ply, !ercm_all, !ercc_ply, !ercc_all (all these commands work exactly like the originals).
Admin commands:
  • !eon : Turns Event Control ON. This is efectively like restarting it.
  • !eoff : Turns Event Control OFF. Event control stays completely hidden and silent until an admin uses !eexit to quit it, or !eon to turn it on again.
  • !eexit or !eex : Closes Event Control (must be launched again externally).
Messages are sent to drivers to notice about several conditions and rules are shown at beginning, trying to make what's happening as easy to understand as possible.


I have posted it on the programmers forum (it's highly focused to be a tutorial on insim). The zip file is attached there, but I post this announcement here for non-programmers that might be interested in it:
Link to the thread: http://www.lfsforum.net/showthread.php?p=1403034
Nice idea! But what if I want to change my gear ratio?

Maybe you should make something like, only if you drive into your pitbox, you can go to the pits?
Quote from dutchshogun :Nice idea! But what if I want to change my gear ratio?

Maybe you should make something like, only if you drive into your pitbox, you can go to the pits?

HEy , i think you miss understand the meaning .

Hard-core qualify is used in leagues like Master of Endurance , IGTC , LFS (Light) Cart and more.

if you are driving this league you allready made a setup before the qualification.


( hope it makes sence).

@ the original post:
i think there is allready a program out there that can do it. ( im not sure what the name is)
I'm sure there must be other insims that do this, but I don't know if they are available for the free public.

Anyway, this was designed in a very simple way with a very simple programming library. I have posted it on the programmers forum for people to take a look at it and understand the basics of insim. I just posted it here because I thought that some people might want something like this so they have it done in an easy way.
Quote from hotmail :HEy , i think you miss understand the meaning .

Hard-core qualify is used in leagues like Master of Endurance , IGTC , LFS (Light) Cart and more.

if you are driving this league you allready made a setup before the qualification.

Ahh ok, are there also practice sessions in those leagues? Then it would indeed make sense.
Quote from dutchshogun :Ahh ok, are there also practice sessions in those leagues? Then it would indeed make sense.

MoE and IGTC etc don't have official practice sessions, it's just qualifying and race that are officialy sanctioned

Sometimes the NDR leagues like LFSCART and LFSCART light will have an "official" free practice, but we don't really enforce that.

And actually, MoE qualifying is not hardcore, you can spectate / telepit freely.
I have updated Qual Control v0.2 to Event Control v0.31. Now you don't need to be an admin to manage stuff and there's more things that can be done. Now there's race directors who can do all the important stuff, and I have added automatic grid-reversing for top[x] drivers (you can specify the number), director chat messages, better restarting and ending sessions...

Check the updated first post for detailed info, and follow the link in the end of that post to the official thread in the programmers forum for the zip file which includes an executable ready to use.
New update! Event Control v0.4:

- More commands available for race directors (so they can tackle several situations concerning basic race configuration).
- Event Control can be turned on or off using admin commands.
- Configuration files merged into just one.
- It uses the safer CInSim library v0.4
exc

i try it, and works exc


just one thing

it is possible that the race directors can put the penalizations via any command? like drive trought, stop and go? 30segs? 40 segs?

regards !!!
It is possible without it. /p_sg, /p_dt commands
Quote from Neto_r :exc

i try it, and works exc


just one thing

it is possible that the race directors can put the penalizations via any command? like drive trought, stop and go? 30segs? 40 segs?

regards !!!

DONE! Check for the newest update. I have added penalties commands and RCM commands.

Quote from misiek08 :It is possible without it. /p_sg, /p_dt commands

You're not getting the point of this tool. It's meant for race directors, who are drivers that access the server with the normal password, not the admin password. These race directors are granted permission to use some commands to restart a race/quali, change track, cars, weather, wind... etc.

The race director is usually a driver appointed by the league admins who has enough experience and credibility to use these commands in a right way to direct the course of the race. This is useful when you are running a multi-pool league and in some pools there aren't any admins present to control when the race should start/end, etc. That's the work of the appointed race director.

For more info, read the first post, specially the USAGE AND FEATURES part, where you can find all available commands for the different levels of users.
IS_MTC - only for multiplayer hosts
IS_MTC - only for multiplayer hosts
IS_MTC - only for multiplayer hosts

I am getting this when i type !ecmd, but everything works fine... dunno if it's a bug or something


EDIT: Almost forgot to thank you for releasing this to the public, especially because you published the sources so we can adapt this tool to our needs.
awesome work friend


other thing!

it is possible to make 3 qualy? like in the F1? Q1, Q2, Q3, without restarting the qualy 3 times?


where is the diff between Soft and Hard qualy?

regards
Quote from RenvoN :IS_MTC - only for multiplayer hosts
IS_MTC - only for multiplayer hosts
IS_MTC - only for multiplayer hosts

I am getting this when i type !ecmd, but everything works fine... dunno if it's a bug or something

That is because you are connecting it to your local LFS instance, instead of connecting directly to the server. The application is server oriented, so the correct way is to connect it to the LFS dedicated server using its IP and insim port (which must be open, of course). It's intended to be kept running in the server all the time, and you can turn it on or off whenever you like.

If you connect to a local instance of LFS some things may not work. For example, IS_MTC is a "message to connection" packet, and can only be used if you are directly connected to the host. I've looked and currently I only use it in one place, to send a welcome message when a player connects ("^3Welcome! ^6Event Control v0.41 ^3is active"), so that's not going to be a problem at all, it won't make the application crash or cause any trouble. You can look for that in the code and put it into comments tags "/* */" (and recompile, of course). Even there's a bigger screen sent to all players when they connect, so that message isn't very useful at all.

Anyway, I'm not sure if that's the only "problem" you are going to find.


Quote from RenvoN : EDIT: Almost forgot to thank you for releasing this to the public, especially because you published the sources so we can adapt this tool to our needs.

That's the idea
Quote from Neto_r :awesome work friend


other thing!

it is possible to make 3 qualy? like in the F1? Q1, Q2, Q3, without restarting the qualy 3 times?


where is the diff between Soft and Hard qualy?

regards

It is possible to do almost anything, but at the moment I'm not going to do a F1 based qualifying system, maybe in the future. Anyway, if it's done, the correct way would be to restart quali 3 times.

Soft quali is the standard way: people are free to join or leave the track at all times. Hard quali is the realistic way: once you exit the pitlane you can't enter boxes (shift+p) or spectators (shift+s), you can only drive into the pits and stop on the yellow spots so you can change tyres, refuel and do setup modifications allowed by the F12 menu.
hi makakazo, just one little thing

it is possible to change the Race Directors name

for example:

Director 1
Director 2
Director 3

beacuse in the chat appears all the msg with the same name: *Director

and i had 3 admins, so its s little confuse

regards !
Why do you need to know which director is writing the message? I did it like this on purpose so racers don't know who is writing the messages. All messages come from "DIRECTOR" so it looks like there's only one official director.

Right now I don't like the idea of changing it.

If your admins are non racers just make them change their names to capitals in red and use the regular chat.
Hey dude,

What should I change to let someone use commands on remote?
I mean, the "host" is dedicated, so it does not have a license name...
I tried to use an empty strcopy on the code but as you might know, it did not work.

Thanks!


EDIT: I found the way to do it, after spending some more time looking into the code!

if anyone needs it, you need to comment (no point on deleting, you might need it later) the following lines:

Quote : // The chat message is sent by the host, don't do anything
if (pack_mso->UCID == 0)
{
//cout << "(Chat message by host: " << pack_mso->Msg + ((unsigned char)pack_mso->TextStart) << ")" << endl;
return 1;
}

(you could just comment "return 1;", and it would work the same way, but oh well, let's do the right thing. )

then look for:

Quote :if ((ginfo->players[i].Director) || (ginfo->players[i].Admin))

and replace with:

Quote :if ((ginfo->players[i].Director) || (ginfo->players[i].Admin) || (pack_mso->UCID == 0))

Quote from RenvoN :Hey dude,

What should I change to let someone use commands on remote?
I mean, the "host" is dedicated, so it does not have a license name...
I tried to use an empty strcopy on the code but as you might know, it did not work.

Thanks!

I'm not sure I get what you are trying to say. Are you trying to use EC commands on lfs remote, the flash application? In that case I'm quite sure that can't be done (only if you have admin password and I'm not sure what commands are available in that case). You can only use EC commands if you are directly connected to the server.

If you want drivers connected to the server to use commands, you have to edit the config.cfg file and add their license names using "/director=license_name". You can add up to 50 directors.
Yea, well, when you send a message through remote, it appears as "host: whatever message"... so I wanted to control the race through remote also, 'cause the race director might be somewhere where there is no lfs installed or something, then he could still control the race through remote.

anyway, i edited my original post with the solution for this if anyone else needs it
Quote from RenvoN :Yea, well, when you send a message through remote, it appears as "host: whatever message"... so I wanted to control the race through remote also, 'cause the race director might be somewhere where there is no lfs installed or something, then he could still control the race through remote.

anyway, i edited my original post with the solution for this if anyone else needs it

Ha! I didn't know the messages sent via remote were host chat messages

Well, you found the solution and I'm glad you took the time to read the code. You're lucky I wrote a case for host messages to be ignored, as that is easily recognizable. I think there's no particular reason to ignore host chat commands in this application in particular, as none of them take info from the player who uses the command.

I'll make the changes you propose, but consider that you also have to change the following line (1348):

// These commands can be executed only by admins
if (ginfo->players[i].Admin)

Change to:
// These commands can be executed only by admins
if ((ginfo->players[i].Admin) || (pack_mso->UCID == 0))

You have to change this too to be able to use the commands !eon, !eoff and !eexit, which are only available to host admins and not to race directors. I consider that an admin connecting via lfs remote has enough rights to use these commands.
Oh yea, forgot that one.
New update!

Quote :Changelog:

v0.42
  • Now uses CInSim v0.6 (more stable and efficient).


Event Control v0.42
(23 posts, started )
FGED GREDG RDFGDR GSFDG