Urban Terror Forums: Radomizing mapcycle - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

Radomizing mapcycle Rate Topic: -----

#11 User is offline   paelleon (old) Icon

  • Joined: 21-November 07
  • Posts: 178

Posted 08 September 2008 - 03:59 PM

Sorry windows. I am a slave to the microsoft corporation.


#13 User is offline   Rambetter Icon

  •   community dev   
  • Account: rambetter
  • Joined: 28-February 10
  • Posts: 1,140

Posted 09 September 2008 - 01:27 AM

At the beginning of every map, the game server reads the mapcycle file, finds the line corresponding to the map just played, and chooses the next line as the new map, or the first line of the mapcycle file if either:
a) the map just played is the last in the list or
b) the map just played is not in the list

#14 User is offline   Rambetter Icon

  •   community dev   
  • Account: rambetter
  • Joined: 28-February 10
  • Posts: 1,140

Posted 09 September 2008 - 01:32 AM

The first thing you need for a mapcycle shuffler is a utility that will take the existing mapcycle and shuffle it.  I wrote a ruby script for UNIX that does this:

#!/usr/local/bin/ruby

abort "Usage: cat <text file> | shuffle" if ARGV.size != 0
lines = readlines()
lines.size.times do
  print lines.delete_at(rand(lines.size))
end


Assuming the script is named "shuffle", you would use it like this:

[tt]cat mapcycle_old.txt | shuffle > mapcycle_new.txt[/tt]

What I ended up doing is storing my mapcycle in alphabetical order in a file called mapcycle-master.txt, so the command I want to execute periodically is:

[tt]cat mapcycle-master.txt | shuffle > mapcycle.txt[/tt]

I have a cron task that calls this every day.

#15 User is offline   Delirium Icon

  •   QA member   
  • Account: delirium
  • Country:
  • Joined: 28-February 10
  • Posts: 5,416

Posted 09 September 2008 - 02:35 AM

hmmm now how would i do that on windows?

bullet_loaderAdvertisement

#16 User is offline   paelleon (old) Icon

  • Joined: 21-November 07
  • Posts: 178

Posted 09 September 2008 - 10:24 AM

Like I mentioned, I had to do it in Excel, and it works great. I'm sure there is a better way to do it, but my skillz are not there. Raider, if you want the excel script, then pm me with an email address and I will send it to you.

#17 User is offline   Rambetter Icon

  •   community dev   
  • Account: rambetter
  • Joined: 28-February 10
  • Posts: 1,140

Posted 09 September 2008 - 06:25 PM

Um, Excel, Windows, LMAO.  The idea is the randomize the cycle automatically without human intervention on a daily basis.

Sorry, I have very strong feelings against the Microsoft camp.

#18 User is offline   paelleon (old) Icon

  • Joined: 21-November 07
  • Posts: 178

Posted 10 September 2008 - 08:53 AM

Oh I have issues with MS too, but there is no human intervention. I run excel in the background, which randomises via macro every 75 seconds. So the mapcycle is randomised continuously, and that means each time the map cycles the resultant map is a random one. I'm playing on my PC, running the dedicated server, and running the excel app in the background. The only intervention I have is whn my bullets intervene up my opponents ass.

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Advertisement


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942