Author Topic: PerroRACE 2.0 - very cool Racing script  (Read 13636 times)

0 Members and 1 Guest are viewing this topic.

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
PerroRACE 2.0 - very cool Racing script
« 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.






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.
« Last Edit: March 14, 2008, 06:32:42 pm by PerroAZUL »
urraka

Offline SirJamesaford

  • Flagrunner
  • ****
  • Posts: 763
  • SirJamesaford is still in the early Beta stage.
Re: PerroRACE - very cool Racing script (beta?)
« Reply #1 on: October 05, 2007, 03:18:45 am »
Dude...Id love to try this...it looks pretty fun.
And if the dam breaks open many years too soon
And if there is no room upon the hill
And if your head explodes with dark forebodings too
Ill see you on the dark side of the moon

Offline Kagesha

  • Flagrunner
  • ****
  • Posts: 702
  • cunts
Re: PerroRACE - very cool Racing script (beta?)
« Reply #2 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!

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: PerroRACE - very cool Racing script (beta?)
« Reply #3 on: October 05, 2007, 07:37:19 am »
hahaha cool
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline bulgaria

  • Major(1)
  • Posts: 5
Re: PerroRACE - very cool Racing script (beta?)
« Reply #4 on: October 05, 2007, 08:04:08 am »
thanks race hehe

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #5 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.
urraka

Offline Toumaz

  • Veteran
  • *****
  • Posts: 1906
Re: PerroRACE - very cool Racing script (beta?)
« Reply #6 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. :)

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #7 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.
urraka

Offline Aquarius

  • Soldier
  • **
  • Posts: 234
Re: PerroRACE - very cool Racing script (beta?)
« Reply #8 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.
« Last Edit: October 05, 2007, 01:43:59 pm by Aquarius »

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #9 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.
urraka

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1506
  • Also known as Curt
    • Soldat Global Account System
Re: PerroRACE - very cool Racing script (beta?)
« Reply #10 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?
Soldat Global Account System (SGAS): QuakeNet in #soldat.sgas
Rent Cheap Servers: contact CurryWurst

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #11 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.
« Last Edit: October 05, 2007, 08:30:43 pm by PerroAZUL »
urraka

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: PerroRACE - very cool Racing script (beta?)
« Reply #12 on: October 27, 2007, 11:27:41 pm »
sounds great, ill download it if I can run it and play on one computer
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline Norbo

  • Camper
  • ***
  • Posts: 338
Re: PerroRACE - very cool Racing script (beta?)
« Reply #13 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...
« Last Edit: October 28, 2007, 12:26:26 pm by Norbo »

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #14 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.
urraka

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: PerroRACE - very cool Racing script (beta?)
« Reply #15 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?
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #16 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
urraka

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: PerroRACE - very cool Racing script (beta?)
« Reply #17 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.
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs

Offline urraka

  • Soldat Developer
  • Flagrunner
  • ******
  • Posts: 702
Re: PerroRACE - very cool Racing script (beta?)
« Reply #18 on: November 02, 2007, 12:28:28 am »
First of all you must download the dedicated server, which you can downlaod >here< (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.
urraka

Offline chutem

  • Veteran
  • *****
  • Posts: 1119
Re: PerroRACE - very cool Racing script (beta?)
« Reply #19 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?
« Last Edit: November 03, 2007, 04:20:35 pm by chutem »
1NK3FbdNtH6jNH4dc1fzuvd4ruVdMQABvs