Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: urraka on October 05, 2007, 03:00:48 am

Title: PerroRACE 2.0 - very cool Racing script
Post by: urraka on October 05, 2007, 03:00:48 am
Script Name: PerroRACE
Script Description: Makes a racing gamemode.
Original Author(s): PerroAZUL
Core Version: 2.6.3

Do you like running in soldat? I do.

So here you got something cool. I still want to add a few things, but I think it works. I haven't tested it with more than one player because my connection has been really feckty lately, so some bug may appear.

I won't post the code because it's long, but I'll explain a bit of what it does. Basically, you have a bunch of checkpoints (which are saved in race.ini), and you have to run to the next checkpoint. It will measure your time and tell you if you improved your time (relative to your best). In order to begin the race, all players must be alive and with no movement, if not it won't start.

I tweaked some default maps to test this. I guess I'll add more maps later.

You have some commands:
Quote
/startrace: force a race to start
/endrace: force a race to end
/autostart: change autostart mode (on by default)
/laps #: set number of laps
/loadmap: load map from ini (it's done automatically, use it if you modified the ini)
/savemap: will save the checkpoints and lap to a ini file (not race.ini cuz WriteFile not working good)
/showpoints: lists the checkpoints in the console (for debugging)
/setnumpoints: sets the number of checkpoints in the map (use before /pos)
/pos: takes your player position and saves it in the 'current checkpoint', then it increases current checkpoint by 1
/setpoint #: sets the current checkpoint

If you want to add a map, do this (in-game):
0- /autostart (disable it cause it can get annoying)
1- stand on the first checkpoint (which should be in the spawn position)
2- /setnumpoints # (set it to the number of checkpoints in the map)
3- /setpoint 1 (to make sure)
4- /pos
5- go to next checkpoint
6- if there are more checkpoints go to step 4
7- /laps # (set it to whatever you want to be the default lap count for the map)
8- /savemap
9- raplace race.ini with the new created race#.ini

So i got tired of writing already. I'll post some screenshots.

(http://img47.imageshack.us/img47/3479/startal7.th.png) (http://img47.imageshack.us/img47/3479/startal7.png) (http://img405.imageshack.us/img405/6445/checkpointkq1.th.png) (http://img405.imageshack.us/img405/6445/checkpointkq1.png)

(http://img49.imageshack.us/img49/4342/lapny9.th.png) (http://img49.imageshack.us/img49/4342/lapny9.png) (http://img186.imageshack.us/img186/3581/finishednh4.th.png) (http://img186.imageshack.us/img186/3581/finishednh4.png)


So, here the thing is attached. Download it and test it! It can be a lot of fun! Do it! Do it!

Suggestions for the server configuration:
 * No weapons.
 * No respawn time (0)
 * Deathmatch gamemode.



Updated to 1.1 (13-11-07): <- Removed because it was more buggy
 * Implemented a bug recovering method (for the ThreadFunc bugs).
 * Changed Sleep(1) to Sleep(20) to improve performance.
 * May have changed something else and I don't remember.
 * The ZIP now contains all the maps added so far.

Updated to 2.0 (23-11-07):
 * Completely re-writen script.
 * Uses AppOnIdle instead of ThreadFunc.
 * race.ini moved to ./scripts/perrorace/race.ini

Updated to 2.1 (14-03-08):
 * Should work on CTF or any game mode.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: SirJamesaford on October 05, 2007, 03:18:45 am
Dude...Id love to try this...it looks pretty fun.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Kagesha on October 05, 2007, 04:31:10 am
Hahahah this looks kinda fun FOOTRACING TIME!!!!!
Can't wait till it actually comes out on a server!
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: sai`ke on October 05, 2007, 07:37:19 am
hahaha cool
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: bulgaria on October 05, 2007, 08:04:08 am
thanks race hehe
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 05, 2007, 12:11:54 pm
I'm running it on my PC now. Feel free to enter and try, but keep in mind it may be laggy as hell beause it's a home connection and my brother has been using a lot of the bandwidth ¬¬

ip: perroazul.dyndns.org
port: 23074

I suggest you download the maps before joining because my upload speed sucks.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Toumaz on October 05, 2007, 12:36:12 pm
I tried setting up a server of this just now (on Linux), and I couldn't get it working properly; probably due to the general instability known as ThreadFunc.

Code: [Select]
Waiting for everyone to be alive and with no movement.
Starting in 3...
Starting in 2...
Starting in 1...
Race Started!
 [*] [Error] PerroRACE -> (AppOnIdle): Out of Global Vars range
 [*] [Error] PerroRACE -> (RaceLoop): Access violation at address 0809DA07, accessing address 00000109
 [*] [Error] PerroRACE -> (AppOnIdle): Access violation at address 0809DA90, accessing address 00000109
 [*] [Error] PerroRACE -> (AppOnIdle): Access violation at address 0809DA90, accessing address 0000011C
 [*] [Error] PerroRACE -> (AppOnIdle): Access violation at address 0809DA90, accessing address 0000012C
(etc)

Would you think there's any way for you to rewrite it into only using AppOnIdle instead of threading it? I know it's quite a bit to ask for, and I know it isn't your fault that ThreadFunc is flipping out all the time - but it'd most likely increase the stability of the script by heaps. I might give it a look myself if I get enough free time.

Great work anyhow, and good luck with any future endeavours. :)
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 05, 2007, 01:04:42 pm
It's impossible to write it on AppOnIdle the way I did it because it has accuracy of milliseconds, and also some checkpoints might not be detected with AppOnIdle because you can run through them in less than a second. I don't know if there is a way to fix that. Maybe passing all the variables by reference to the ThreadFunc could work, I don't know. I don't really understand the deal with ThreadFunc. It works great for windows.
If I can think of any workaround I'll do it.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Aquarius on October 05, 2007, 01:37:00 pm
You can do something like this in AppOnIdle: the checkpoints should be made of 2 points - the points will create a line segment. 2 player positions, from previous AppOnIdle and current AppOnIdle, will create the second line segment. Check if the line segments intersect, if true, the player passed the checkpoint. Though I dunno if it won't be to slow.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 05, 2007, 01:42:14 pm
The way it's done it detects a square of 120x120. I guess I could make it bigger, but i don't like the inaccuracy. Also, I use milliseconds to measure the time you get to each checkpoint, and you can tell if you went faster or not reading a message like "Checkpoint 2 - 02.12 (-00.50)". That means you took 2.12 seconds to get to the checkpoint 2 from the starting position, and you got there 0.5 seconds faster than your best time.

The server I posted didn't have map downloading activated. Sorry, i fixed it now.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: DorkeyDear on October 05, 2007, 02:48:53 pm
Nice nice! Sounds great!
I hope somebody hosts this soon on a non-home computer on some dedicated server so I can play this soon :P
*wants to play* so if u do, wanna post the ip/port here pretty please?
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 05, 2007, 08:29:08 pm
Well today I played it on my server with some people. It's really fun :D. (Ok, i have to say it, that face is really gay)

I'll explain some more details about the script here.

When you join the game and there are some players racing (meaning the race has started already), you have to wait until the curent race ends. In the meanwhile you can run around.

When you complete all the laps, you have to wait for the other players to complete the laps too. When everyone completes all the laps the race has officially ended and a message with the positions will appear.

After the race ends, it will automatically start again in a matter of seconds (if /autostart is activated). A message will appear "Waiting for all players to be alive and with no movement". That means that the script waits for all the players to be ready before starting the race. You don't have to go to the start position. After everyone is still the game will be paused and you will see a countdown in the top. (starting in 3... 2... 1... GO). When the game gets unpaused all the players will appear in the starting position. I will try to make it take the players to the starting position before the game gets paused later.

When you reach a checkpoint (you have to run nearby the checkpoint sign, if you run far from it, it won't be detected), a message Checkpoint # will appear. On the top you will see a message "Checkpoint # - <number1> (+/-<number2>)". The first number is the time it took you get to that checkpoint, relative to the starting position. The seconds number is the difference between that time and the best you've done to that checkpoint. If it's negative you improved, if it's positive you went slower.

If you die in the middle of a race, you should appear in the last checkpoint you crossed. I think there is a bug with this, which happens when you go out of the map bounds.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on October 27, 2007, 11:27:41 pm
sounds great, ill download it if I can run it and play on one computer
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Norbo on October 28, 2007, 12:14:54 pm
NiCe WoRk mate. This is cool. But can you turn off this script in game whenever u want? I only got my clan server so i don't want to test it there so i want to make sure that i don't need to delete it when i don't want to race... Do u get me or i made it complicated :P ?

EDIT: Ehh i wold really like to play this but my server is braking when i run it...
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 28, 2007, 02:00:43 pm
If your server is running on Linux I'm afraid you won't be able to use it, because of the ThreadFunc thing. On windows it seems to work fine, with some random bugs sometimes but not very frequent.
You can use the command /autostart to disable the race starting automatically. If the race doesn't start it won't interfiere with the game.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on October 29, 2007, 09:59:24 pm
Ive just been on a server called Perro race and a few people also joined but there was no races and none of us knew how to start one?

So how do you start a race?
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on October 30, 2007, 10:04:19 pm
Heh, the race is supposed to autostart, but currently this script is unstable because of 2 reasons:
1. The ThreadFunc thing, which causes errors but I think i can manage to handle them and make it restart the race.
2. The "Couldn't load map lalal" bug, which happens all the time, and when this happens the script doesn't work anymore at all.

Anyway, if anyone finds and joins my race server, write !admin, if i'm here (which is highly probable) i'll see the message and probably join to race :p
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 01, 2007, 10:16:11 pm
How do I install this script on my home computer for me to play by my self?

I saw on one of avarax's script threads that i need to put it in a folder calles 'Soldat server' but I don't have one. Is there a program I need to install?

I thought I might be able to run scripts by running a dedicated server then starting up soldat and finding it in 'Join game' and it worked, but I don't know how to install scripts. Help.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 02, 2007, 12:28:28 am
First of all you must download the dedicated server, which you can downlaod >here (http://static.soldat.pl/downloads/soldatserver263.zip)< (it's not the one that comes with soldat)

Then, you unzip that somewhere and unzip PerroRACE.zip in the same somewhere.

You can edit the file soldat.ini to set the server options, but it's not really necessary.

If the race won't start use the command "/recompile race". That will reload the script. Other than that use the commands I posted in the first post. Remember that you have to use some of the maps I included (rc_Airpirates, rc_Bigfalls, rc_Arena) or set the checkpoints on your own if you want to play in another map.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 03, 2007, 04:14:33 pm
Oh ok.

I thought the dedicated server that came with soldat was the right one.

Now there will be even more new ways to play soldat, and right now i'm trying to learn scripting :)

Date Posted: November 02, 2007, 02:34:48 pm
I got another question and something to say:

Firstly: When I try play your race by mysef on my computer, Autostart doesn't start races automatically and when I force a race it pauses and counts down, But when it says 'go' Immediatly it says 'Race ended!' and 'Positions:' , I can run into  the checkpoints and nothing happens :P

Secondly:
When I was playing on your server in the Bigfalls map I noticed that the first checkpoint is actuall near the first one you see when you start running, not the very left uppermost one.
This is making it like a double checkpoint and the arrows don't poit to it.
Is it supposedto be like this, or is it a checkpoint error?
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 04, 2007, 02:08:36 pm
About the second, yeah, I messed up with the arrows, it's a double checkpoint. Not a problem once you know the circuit.

About the first, were you playing in the server when you attemped to start the race? If there are no players the race will automatically end. Also, the autostart won't start any race if the server is empty.

So, you have to do this:
1. Join the server.
2. Wait for the message "Waiting for all players to be alive and with no movement.".
3. Stay still for a little while (this is to avoid the initial speed after moving all players to the initial position).
4. Wait for th countdown and start running.

If it doesn't work that way it's because of the inestability of ThreadFunc, so try restarting with "/recompile race" until it works.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 06, 2007, 02:23:21 am
Hmm it seems to be working now, but i don't know why, maybe because I changed the gamestyle to '1', or possibly that i set max grenades to 4000 :)

Anywho its a great script and I might just make some maps for it :D
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 06, 2007, 02:24:07 pm
Cool, if you make more maps post them here :P (remember to include the checkpoints stored in race.ini)
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 08, 2007, 09:55:04 pm
Heres my first map, rc_Blox, I'll make more over weekend.

Checkpoints:


[rc_Blox]
Laps=5
Num=8
checkpoint1=28.87,-745.29
checkpoint2=359.89,-234.46
checkpoint3=83.64,54.95
checkpoint4=-285.95,282.88
checkpoint5=95.62,449.97
checkpoint6=426.46,5.85
checkpoint7=-184.27,-247.64
checkpoint8=-483.7,-235.16


\/ Map \/
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 09, 2007, 01:59:32 pm
Nice man, already added it to my server :P

I'll post tow more maps a friend made.

[rc_HH]
Laps=3
Num=9
checkpoint1=-947.79,-644.57
checkpoint2=-991.79,-457.95
checkpoint3=-921.07,0.23
checkpoint4=-715.9,-260.39
checkpoint5=186.2,227.04
checkpoint6=1049.67,625.89
checkpoint7=1330.51,311.44
checkpoint8=1056.9,18.55
checkpoint9=-40.66,-134.94

[rc_cambodia]
Laps=3
Num=10
checkpoint1=-505.7,-668.35
checkpoint2=-802.82,-179.74
checkpoint3=-233.23,540.54
checkpoint4=-356.85,640.57
checkpoint5=96.2,528.22
checkpoint6=481.43,579.57
checkpoint7=393.61,161.32
checkpoint8=88.97,-4.1
checkpoint9=441.9,-386.66
checkpoint10=268.42,-747.82
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 11, 2007, 02:06:39 am
three more maps, i don't know wat happened to the checkpoints for conquest, but i can't be bothered making another zip file. Or do the checkpoints right now :P

Checkpoints:


[rc_Ash]
Laps=3
Num=11
checkpoint1=-1068.13,177.26
checkpoint2=-421.63,-105.29
checkpoint3=181.66,159.15
checkpoint4=241.36,-105.61
checkpoint5=-181.71,158.24
checkpoint6=-557.91,82.12
checkpoint7=-174.96,367.99
checkpoint8=553.27,82.63
checkpoint9=172.27,-226.36
checkpoint10=-363,-299.94
checkpoint11=-661.17,339.55

[rc_Cobra]
Laps=3
Num=9
checkpoint1=-18.87,420.57
checkpoint2=-811.33,-59.88
checkpoint3=-216.57,204.99
checkpoint4=-576.68,-60.92
checkpoint5=-392.31,-257.41
checkpoint6=375.21,-245.38
checkpoint7=582.77,-60.9
checkpoint8=196.56,203.88
checkpoint9=813.72,-60.9
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 11, 2007, 07:15:17 pm
I made the checkpoints for rc_Conquest

[rc_Conquest]
Laps=3
Num=12
checkpoint1=-2019.18,155.06
checkpoint2=-1375.49,536.11
checkpoint3=-17.39,521
checkpoint4=20.32,-91.89
checkpoint5=444.28,199.34
checkpoint6=1058.35,369.19
checkpoint7=2159.59,284.29
checkpoint8=767.23,531.06
checkpoint9=456.3,-28.91
checkpoint10=20.32,-91.89
checkpoint11=-451.71,-30.42
checkpoint12=-1904.73,384.15

By the way, I really liked how you made those 3 maps :)
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Leo on November 12, 2007, 08:20:33 am
Nice script but when I tested it at my linux server it was jumping to 54% of CPU usage with 2 players. Any idea why ?
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 12, 2007, 11:31:54 pm
Hmm I never took a look at the CPU usage, but I used Sleep(1) in the thread loop. Should I use Sleep(x) with x > 1? Anyway, I'll update the script soon, I have a couple of ideas to handle the threadfunc bugs. But keep in mind that it's not a stable script.

Date Posted: 12/11/2007 - 11:07:08
Well I updated the script.

I changed the Sleep(1) in the loops to Sleep(20), that might help with the performance. Please test it and tell me how it goes.

I also implemented a way to handle the bugs but I'm not so sure if it works because I couldn't test it since the ThreadFunc didn't want to crash this time ¬¬. Maybe having Sleep(20) reduced the probability of crashing. (I've just made that up :P)
So the thread should be recovered every second if it crashed, in theory.

Let me know if something goes wrong, I'll test it more carefully later.

The new package contains all the maps posted here so far.

Download (http://forums.soldat.pl/index.php?action=dlattach;topic=20940.0;id=11383)

edit: tested it for a while and nothing worked as expected ¬¬... working on it...
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: sai`ke on November 13, 2007, 01:45:14 pm
You can do something like this in AppOnIdle: the checkpoints should be made of 2 points - the points will create a line segment. 2 player positions, from previous AppOnIdle and current AppOnIdle, will create the second line segment. Check if the line segments intersect, if true, the player passed the checkpoint. Though I dunno if it won't be to slow.
I'm afraid that is not a solution to the time resolution problem as shown in this picture:
(http://i3.photobucket.com/albums/y100/metaal/problem.png)

Let's assume the player moves from position one to two between two consecutive calls of AppOnIdle. Due to the large timestep it would miss the checkpoint in that case. Let me know if I misunderstood your idea.

PerroAZUL, you can increase the time resolution if you don't need weapons! If you drop a weapon at each checkpoint, you can do the distance checking and whatnot in onWeaponChange. Also, immediately Forceweapon fists again in the routine to make sure it gets called again the next checkpoint. Of course, you also need to drop a new weapon, but this shouldn't be much of a problem. To be on the safe side you could drop multiple weapons just in case players arrive at a checkpoint at the same time. If I'm right about this, this would eliminate the need for threadfunc and get rid of your problems. :)

Another (less elegant) option would be to have a bot on an offscreen section of the map on hurtpoly's and doing the distance checking in onplayerkill. You can then set your desired time resolution by changing the amount of damage done by the hurt poly's. Of course, respawntime should be zero then and I'm not sure if that is possible. I reckon this option could induce quite some lag on your server though, so I'd try the former first.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 13, 2007, 02:42:53 pm
Well right now I'm rewriting the code, making it clean cause it was a mess. I'll try how it works doing the loop in AppOnIdle without considering the time resolution. Maybe it's not so bad, the problem comes when 2 or more players go together, the one with lower ID will win I guess. And also I made this script having in mind making it save the best lap times, and 1 second resolution would suck for that.

The weapons idea would screw up the race because sometimes you have to stop in order to take the weapon, and also there are some checkpoints in the air.

Thinking about that line thing, another idea came to my mind. I make a line from the player position to the next checkpoint in one call to AppOnIdle, in the next I do the same. Then I calculate the angle between those 2 lines, if it's greater than 90° it means you crossed the checkpoint. I still have to think about it, I'm not so sure about this :P

PD: Is there even a way to calculate the angle... sh*t!
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: sai`ke on November 13, 2007, 03:05:36 pm
Quote
Well right now I'm rewriting the code, making it clean cause it was a mess. I'll try how it works doing the loop in AppOnIdle without considering the time resolution.
Looping in appOnIdle will pause your server and probably cause a truckload of other problems. I'll assume you mean just checking in apponidle. Furthermore, a time resolution of a second is pretty bad for racing.

Quote
Maybe it's not so bad, the problem comes when 2 or more players go together, the one with lower ID will win I guess.
Why would this be a problem? You just loop through all players and check whether they are close enough.

Quote
And also I made this script having in mind making it save the best lap times, and 1 second resolution would suck for that.
Yeah.

Quote
The weapons idea would screw up the race because sometimes you have to stop in order to take the weapon, and also there are some checkpoints in the air.
I don't think you need to stop to pick up a weapon if you currently have no weapons. It wouldn't solve the in air checkpoint problem though but can't you move these, or change the maps a little so that there is a plateau for the weapons to fall on?

Quote
Then I calculate the angle between those 2 lines, if it's greater than 90° it means you crossed the checkpoint. I still have to think about it, I'm not so sure about this
Nope. That won't hold. It's not very hard to come up with a counterexample.

There is no substitute for time resolution when it comes to racing I'm afraid.

Also, ok, if the weapons thing isn't an option, consider putting a bot somewhere, spawn bullets above him at different heights and doing the distance checking in OnPlayerDamage. I'm not sure if there's a built-in time routine that gives you the current time with a resolution of less than a second but if it's a big problem you could always set up a secondary program that continuously writes the current time including milliseconds to a file and read it on passing a checkpoint. Even without that, you'd still know who is first tho'.

P.S. If you still need angles, you can calculate the angle between two vectors by means of the dot product.
Consider two vectors v1 and v2 then
v1x * v2x + v1y * v2y = cos( angle between them ) * length( v1 ) * length( v2 )
with length I mean geometric length and not number of elements.


Date Posted: November 13, 2007, 02:55:54 pm
Here you go:
Code: [Select]
function angle( v1x, v1y, v2x, v2y: single ): single;
var
cosangle: single;
dist: single;
begin
dist := ( distance( 0, 0, v1x, v1y ) * distance( 0, 0, v2x, v2y ) );
cosangle := ( v1x * v2x + v1y * v2y ) / dist;
if dist = 0 then
begin
result := -1;
exit;
end
result := 90 - 720 * ( arctan( cosangle / ( 1 + sqrt( 1 - cosangle * cosangle ) ) ) ) / (2 * pi);
end;

PS. Note that this will always give you the smallest angle between two vectors!
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 13, 2007, 03:31:16 pm
1. Yes I meant just checking in AppOnIdle :P

2. I meant that considering using the time resolution of 1 second. If both player are too close and reach the final checkpoint, the server will think they reached it at the same time. So as that's checked looping through all players, the one looped first will be the winner.

3. Yep.

4. I don't say you need to stop every time, but many times I've have the problem that I want to pick up a weapon and it takes a little while to pick it up. Usually with the knife, maybe because it's small (?). Anyway, making all the checkpoints in ground limits the map layouts and that sucks too :P

5. So far I couldn't think of a counter example. The only problem I found is for example if you are going straight down to a checkpoint in the ground and then need to turn 90°, if the point is too close to the ground and the player never gets to cross it the angle won't be greater than 90°. But that can be solved not placing the point too close to the ground. And also the same checking the script does right now would be done apart from this. In the worst case you'll have to stay 1 second in the checkpoint. I know it sucks, but I'd like to make a stable script and see how bad it is. I will also make the threaded version, which works perfectly for me, with some exceptions :P

6. About the angle calculating, yeah I knew there was some formula for that, what I was thinking was whether I would have the needed functions, in this case arctan. I just don't know if it exists in the engine, it doesn't appear in EnEsCe manual.

He should really implement those timers :P

PD: :P
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: sai`ke on November 13, 2007, 03:35:16 pm
note I made a typo in the previous version of that angle thing, so you might wanna c/p it again ;)
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 13, 2007, 03:37:44 pm
No problem, I'm not coding that part yet :P
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: sai`ke on November 14, 2007, 07:02:04 am
The problem with a small checking range is that if people need to wait they need to wait unequal amounts of time, which makes it unfair.  The problem with a large checking range is that people can short circuit the 'race track'.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: D!m000n on November 16, 2007, 08:19:19 am
How do i start the race in my own server?
after i open some of race maps ;o
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: urraka on November 16, 2007, 12:23:46 pm
First of all you must download the dedicated server, which you can downlaod >here (http://static.soldat.pl/downloads/soldatserver263.zip)< (it's not the one that comes with soldat)

Then, you unzip that somewhere and unzip PerroRACE.zip in the same somewhere.

You can edit the file soldat.ini to set the server options, but it's not really necessary.

If the race won't start use the command "/recompile race". That will reload the script. Other than that use the commands I posted in the first post. Remember that you have to use some of the maps I included (rc_Airpirates, rc_Bigfalls, rc_Arena) or set the checkpoints on your own if you want to play in another map.
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: chutem on November 16, 2007, 06:50:24 pm
in the server.ini, mke sure the gamemode is 0 or 1 and there is no bots, double click dedicated server.

then open up normal soldat > join game and request the local servers, yours should appear join al voila
Title: Re: PerroRACE - very cool Racing script (beta?)
Post by: Eclipse on November 17, 2007, 02:58:53 am
I went in, Its okay. Maps are awesome
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on November 22, 2007, 11:15:48 pm
Script updated. Doesn't use ThreadFunc anymore (got tired of bugs), so now it has a time resolution of 1 second. It's still fun. If someday something like timers are added to the engine I'll make the script better. The race.ini now is located in ./scripts/perrorace/race.ini. Saving the map doesn't make extra ini's since WriteFile is working fine (I must have done something wrong before). And that's it.
Also, the code is MUCH cleaner than the previous version.

PerroRACE 2.0.zip (http://forums.soldat.pl/index.php?action=dlattach;topic=20940.0;id=11604)
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Londonbrig0 on December 15, 2007, 12:22:53 am
wow, very cool, starting to make soldat like all those insane starcraft mods
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Norbo on December 15, 2007, 11:07:40 am
First of all you must download the dedicated server, which you can downlaod >here (http://static.soldat.pl/downloads/soldatserver263.zip)< (it's not the one that comes with soldat)

Then, you unzip that somewhere and unzip PerroRACE.zip in the same somewhere.

You can edit the file soldat.ini to set the server options, but it's not really necessary.

If the race won't start use the command "/recompile race". That will reload the script. Other than that use the commands I posted in the first post. Remember that you have to use some of the maps I included (rc_Airpirates, rc_Bigfalls, rc_Arena) or set the checkpoints on your own if you want to play in another map.

Done... But how can i join it? Whats the IP etc...
EDIT: Problem solved :) Just playing it! Cool!

Date Posted: December 15, 2007, 09:19:20 am
I dont get how to add maps....
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 15, 2007, 11:08:50 am
To add your own maps or to add maps to the mapslist?
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Norbo on December 15, 2007, 12:23:35 pm
.... create a map with chekpoints.... does the scenery adds itself or u need to make a map in polyworks? i mean that Checkpoint scenery and the arrorws
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 15, 2007, 02:01:28 pm
The scenery must be added by a map editor. I can't add scnecery from the script. So use polyworks for that.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 28, 2007, 05:34:52 am
How do you actually set it up? Do you run it as a deathmatch mode?
And where do you put the race file?
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 28, 2007, 12:31:16 pm
First read this if you haven't: http://forums.soldat.pl/index.php?topic=20940.msg252844#msg252844

And use deathmatch yeah. I also disable all weapons. And set respawn time to zero.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 28, 2007, 10:05:34 pm
Ok Ive set it up all correctly I believe but when I run the server I get this error:

RACE : Can't find map checkpoints.

Anyone know how to solve it :(

Date Posted: December 28, 2007, 09:55:46 pm
I think its because I have the race.ini file in the wrong area. Where do you actually put it. I tried it in the map area. In the scripts and in soldatserver263 directory. This gets abit confusing
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 29, 2007, 01:27:47 am
You don't need to move the race.ini file. Try renaming Perrorance to perrorace maybe.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 29, 2007, 02:17:06 am
So where is the race.ini file ment to be located?
I tried renaming perrorance to perrorace but I get the same error.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 29, 2007, 07:01:29 am
It should be right here: ./scripts/perrorace/race.ini
It may also happen because of a problem with some linux distributions, what OS are you using? If that's the case I'll try to fix the error. I also don't know much about this, but it also could be because of the file not having the proper access rights. It should be readable and writable by the soldatserver. Maybe somebody else with more experience on this can help a bit.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: spkka on December 29, 2007, 07:06:06 am
File exist does not seem to work on Debian if im right. Check my Nick Registration script aswell..
It works on CentOS - SUSE and windows but failed by 1 person that´s using Debian.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 29, 2007, 07:08:47 am
Yes, I'm aware of that, but I think my script isn't using FileExists. I'm checking.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: spkka on December 29, 2007, 07:14:03 am
check if it uses things like readfile <> '' or anything, it gave me this error before I/O Error 103..
Try to use File Exist instead then. Let me know if you found a fix please. Would be nice to have the scripts working on all Distros


Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 29, 2007, 07:21:35 am
I've just checked and this scripts doesn't check for file existence at all, so it must something with access rights.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 29, 2007, 08:39:30 am
Ok now Im just getting this error

RACE: Cant find map checkpoints.

And thats pretty much it no 103 error etc. Its all set up like its ment too..
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 29, 2007, 12:16:57 pm
Well, that means you are playing on a map that doesn't have checkpoints. You should play in the maps attached in the first post.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 29, 2007, 09:41:23 pm
Yes thanks so much its all working now.
Now I need to try fix my ports up etc so I can actually host it for Australians :D
It seems like you've done a great job!
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Szewczuq on December 30, 2007, 01:16:11 pm
haha nice job  PerroAZUL :P can i have ip to sevrer with this script? :D

Date Posted: December 30, 2007, 01:14:16 pm
Perro? maybe u can change this script to Team run (ctf) ect. 2v2 run or 3v3? ;D
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 30, 2007, 02:43:55 pm
Well, i don't know how a race would work with teams. Not like I'm going to program something like Formula 1.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Szewczuq on December 30, 2007, 03:18:00 pm
hehe i can make map to team run :)

Date Posted: December 30, 2007, 03:16:59 pm
CTF 2v2 or 3v3
when 1 player with team finished run another is starting run :)
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on December 31, 2007, 09:59:26 am
I think you should do what you can possibly do here. It would be very very fun and exciting what this racing mod would do. Could possibly be just as good as the volleyball mod.
As I have that said have a happy new year from happytodd
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on December 31, 2007, 02:00:06 pm
Well, I might consider adding that "team-racing" when i get some time.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Szewczuq on December 31, 2007, 02:20:40 pm
hehe good luck perro :)
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: happytodd on January 01, 2008, 03:21:29 am
Yep goodluck. I would help but I never studied this type of thing :P
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: miketh2005 on January 11, 2008, 02:19:20 pm
Can I run this with Gamemode=3 ? For CTF because thats where all the people are and some people filter their games for CTF ONLY, so can I run this with CTF with no flags?
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: urraka on January 11, 2008, 07:24:48 pm
I have no idea, but you could try... I think it should work.
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: frosty on September 09, 2010, 05:06:04 am
keep getting apponidle out of range errors during game, any chance you might fix that?

using version 2.1
Title: Re: PerroRACE 2.0 - very cool Racing script
Post by: Swompie on September 11, 2010, 04:52:09 am
Try fixing it yourself?
If you don't know what Out Of Range is:
Code: (pascal) [Select]
var
  SomeArray: Array [1 .. 2] of byte;

procedure AppOnIdle(Ticks: integer);
begin
  SomeArray[3] := 1;
end;
Throws the Out Of Range error each second.
It comes when you try to access a index which doesn't exist in an array.