Altitude Game: Forums  

Go Back   Altitude Game: Forums > Altitude Support > Dedicated Server
FAQ Community Calendar

Dedicated Server Discuss technical issues related to hosting your own servers.

Reply
 
Thread Tools Display Modes
  #1  
Old 07-16-2012, 03:45 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default KCoop script

In case anyone's interested, here's the script running on Crack's Co-op server: http://bukva-yo.ru/kcoop-0.5.1.zip

It's not technically a script, but rather a compiled Go program. This has the advantage that it's very fast and completely standalone: you only need a single executable and nothing else.

You just start your Altitude server, start kcoop.exe (in any order) and that's it.

Included in the zip are 32 bit binaries for Windows, Linux and Mac, sample XML config file and source files.

Source files ("src" folder) are not needed for normal operation, they're only included in case you want to see what makes it tic or customize something beyond what the config file allows. To compile a new binary, you'll need the Go compiler from golang.org.

You're free to do whatever you want with this software, but you do it at your own risk. You're absolutely required to credit me, 19 cm, as the original author, unless you don't want to, in which case don't bother.

Last edited by 19 cm; 01-29-2013 at 06:38 PM.
Reply With Quote
  #2  
Old 07-17-2012, 06:57 AM
RedLight RedLight is offline
Senior Member
 
Join Date: Jul 2011
Posts: 143
Default

Very interesting. Thanks for sharing!
Reply With Quote
  #3  
Old 07-22-2012, 09:49 PM
Geiro Geiro is offline
Member
 
Join Date: Jan 2012
Location: Netherlands
Posts: 95
Default

Thanks for sharing ! So I put this on my dedicated server tonight, which runs on Windows, and it worked perfectly. Also was very easy to run, idk anything about coding but this I can do ;p.

I had 2 questions and I was wondering if you could help me:
- The commands like !rules and !admin worked, but how do I change the output of those commands? I downloaded the Go program, but I couldnt figure it out. For example putting in new rules or admins.
- Hwo do I get the / commands in? Now I can only do !bal and not /bal.

Cheers,
Geiro
Reply With Quote
  #4  
Old 07-23-2012, 11:29 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Thanks for trying it Geiro, I'm glad to hear it works on Windows.

- if you have installed the Go compiler from golang.org, re-compiling the script should be as easy as typing "go build" in DOS console in the folder containing kcoop.go and lconfig.go (that's what works for me in Linux anyway).
So if you want to change !rules, edit kcoop.go with a text editor and recompile. Same for the !admin output. Note that the script doesn't actually have an idea who the admins are, it's just the message to the players that you can edit. Use Altitude's launcher_config to add/del admins.

- for /bal etc to work, make sure the file custom_json_commands.txt is in Altitude/servers. You may have to restart the server.

I may make this stuff configurable with a config file so you don't have to mess with Go compilers... one day
Reply With Quote
  #5  
Old 07-23-2012, 04:25 PM
Geiro Geiro is offline
Member
 
Join Date: Jan 2012
Location: Netherlands
Posts: 95
Default

So the 2nd question is solved, putting that command text in the server file worked, thanks for that!

About the first question, I edited the kcoop.go file with notepad; put some new rules in etc. After that I turned it into a GO-file again, I relaunced my server (and the script) but nothing changed.. What did I do wrong :P?

EDIT: First question also solved, I read your post again and I forgot the Go Build command

EDIT2: The admin command is missing, if you type it in the server it gives the same as the !about funtion. This is what the About function says, I cant find the admin function though..

func showAbout(pl *player_t) {
serverWhisper(pl, "You're playing on G's Co-op server, have fun!")
serverWhisper(pl, "Using KCoop script by 19 cm")
serverWhisper(pl, "Server location: Helmond, the Netherlands")// serverWhisper(pl, "Administrators: Geiro, Bob17, Butter, 19 cm")
}

Last edited by Geiro; 07-23-2012 at 05:08 PM.
Reply With Quote
  #6  
Old 07-23-2012, 09:42 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

I wanted an "about" command where I could put whatever information about the server I want people to know: location, software, hardware, connection, admin(s)... And it didn't find !admin particularly useful, so I just made it an alias for /about, just for "compatibility" with Co-op Sandbox.

If you insist on having a dedicated !admin command though, you can add a new function for it:

func showAdmin(pl *player_t) {
serverWhisper(pl, "Administrator: Geiro the Mighty")
}

and change

if message == "!admin" && pnum >= 0 {
showAbout(&players[pnum])

to

if message == "!admin" && pnum >= 0 {
showAdmin(&players[pnum])
Reply With Quote
  #7  
Old 07-24-2012, 12:37 AM
Geiro Geiro is offline
Member
 
Join Date: Jan 2012
Location: Netherlands
Posts: 95
Default

Thanks again, this worked! I don't want to bother you, but I have 2 more questions :P:

- There are certain maps (like Anthrax, Apocalypse and Shade) that play with the right team and you fixed the automatic assigning (all to the right team instead of to the left) on the Kosmos server, how do I do this? Also we have certain 'race' maps that require both teams to be played on, can I make an exception in the automatic assigning for those maps? (might host a race server later, but I only have 2 maps of them atm. If anyone has more race maps, 1dm of ffa, please pm me )

- I'm not sure if it has to do with my server or if it is a bug, but the script only seems to work for a few hours. I also noticed this on your Kosmos server, so it cant be the dedicated server? If this idd is a bug, can't we make the script restart every hour or something like that? I don't know if that's possible, but just an idea

Last edited by Geiro; 07-24-2012 at 12:41 AM.
Reply With Quote
  #8  
Old 07-24-2012, 02:42 AM
RedLight RedLight is offline
Senior Member
 
Join Date: Jul 2011
Posts: 143
Default

I doubt it's a matter of where the script simply "stops working" after a couple of hours. Sounds like the script encounters an unhandled exception and decides to crash. I'm unfamiliar with Javascript (or GO, for that matter), but try to find the console log that the script writes to, if at all.
Reply With Quote
  #9  
Old 07-24-2012, 10:24 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

1. Right-team maps: find the line
if /*mapname == "1de_coop_kead" ||*/ mapname == "1de_coop_anthrax" {

You can add ass many right-team maps as you like, like this:
if mapname == "1de_coop_anthrax" || mapname == "1de_coop_map2" || mapname == "1de_coop_map3" {

2. Race maps: find the line
fmt.Println("Reassigning player to team", playerTeam)

BEFORE it, add
if mapname == "1de_coop_racemap1" || mapname == "1de_coop_racemap2" {
break
}

This will turn off auto-assignment, but you lose your warranty as to the correct announcement of match results...

3. Does the script crash with "unexpected end of JSON input"? This should fix it:

Find the two places where it says

err := json.Unmarshal(b, &f)
if err != nil {
log.Fatal(err)
}

and change them to

err := json.Unmarshal(b, &f)
if err != nil {
fmt.Println("Whoops! Couldn't unmarshal this: ", b)
return
}
Reply With Quote
  #10  
Old 07-24-2012, 10:46 AM
Geiro Geiro is offline
Member
 
Join Date: Jan 2012
Location: Netherlands
Posts: 95
Default

Thanks, I'll try this later today. As for the script 'crash', it doesn't give any error or message, it literally just stops working. For example I put it up last night at 8 pm, and when I got home at 12 the script was still running, but it didn't do anything anymore. The last line was a chat log of 10 pm orso.
Reply With Quote
  #11  
Old 07-24-2012, 11:29 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Does your log_old.txt have a last-modified time of "10 pm orso"?

Then it looks like the script fails to notice when the server rotates logs (rename log.txt -> log_old.txt, start new log.txt) and keeps trying to read the log that's no longer being written to. I found a neat solution for this on Linux but apparently it doesn't work on Windows.

I'll try to come up with something.

Last edited by 19 cm; 07-24-2012 at 11:31 AM.
Reply With Quote
  #12  
Old 07-24-2012, 12:02 PM
Geiro Geiro is offline
Member
 
Join Date: Jan 2012
Location: Netherlands
Posts: 95
Default

Quote:
Originally Posted by 19 cm View Post
Does your log_old.txt have a last-modified time of "10 pm orso"?
log_old is last modified 23/7 16.47 and the log is last modified 24/7 11.01
Reply With Quote
  #13  
Old 07-26-2012, 12:57 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

New version uploaded: http://bukva-yo.ru/kcoop-0.2.zip

What's new: configuration via xml file, colored console output, admin list from launcher config, Windows log-rotate freeze fixed.

Last edited by 19 cm; 07-26-2012 at 01:00 AM.
Reply With Quote
  #14  
Old 07-26-2012, 11:45 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

New version uploaded: http://bukva-yo.ru/kcoop-0.3.zip

What's new: some bug fixes, Windows log-rotate freeze fixed (again), better support for race (winning team is announced even if both bases are destroyed).
Reply With Quote
  #15  
Old 08-02-2012, 08:56 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

New version: http://bukva-yo.ru/kcoop-0.4.zip

What's new: "player still considered alive after team change" bug fix, "win counted even if base not destroyed on 1de_coop_truecoop" fix.
Reply With Quote
  #16  
Old 08-10-2012, 01:22 AM
Jesus Jesus is offline
Member
 
Join Date: Oct 2011
Location: Heaven
Posts: 60
Default

I can't be bothered to figure out if it's possible at the moment, but if this Go stuff can be used with Mac maybe I'll try and compile it on my mac later.
Reply With Quote
  #17  
Old 08-10-2012, 09:35 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

There's a good chance it will "just work" on Intel Mac. Just copy kcoop_linux.go to kcoop_darwin.go.
Reply With Quote
  #18  
Old 11-12-2012, 09:06 AM
sukosevato sukosevato is offline
Member
 
Join Date: Jul 2011
Posts: 35
Default

Nice script, I've been looking through it on the server.

Would it be possible to add a java function so you can talk with people on the server from the console?
Reply With Quote
  #19  
Old 11-13-2012, 07:34 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Quote:
Originally Posted by sukosevato View Post
Would it be possible to add a java function so you can talk with people on the server from the console?
Chatting from the console shouldn't be too hard if you don't insist on it being a "java function"
Reply With Quote
  #20  
Old 11-13-2012, 11:45 AM
sukosevato sukosevato is offline
Member
 
Join Date: Jul 2011
Posts: 35
Default

Well, your code looks a LOT like java :P Which is why I was wondering you could just add one / thought it was Java or Javascript or something :P

As far as i know right now it isn't possible to chat from console.

I have 1 instance of the Altitude server running which runs 4 servers.

And 3 instances of Kcoop.exe, it would be awesome if the command window of Kcoop.exe would feature a commandline. That way it's way easier to announce a 15 minute downtime due to a reboot from the server side instead of having to log on to the servers 1 at a time.

You're the man if you can implement it =D

Still, nice code :P
Reply With Quote
  #21  
Old 11-13-2012, 11:30 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Here's a new version: http://bukva-yo.ru/kcoop-0.5beta.zip

Highlights: entering server commands from the console, Intel Mac binary (untested)

You can type any text into the window, press Enter, and it will be executed as a server command. Examples:
Quote:
changeMap 1de_coop_101
serverMessage Server shutting down for maintenance
There is no TAB completion and no error message if you mistype something, so pay attention.

You can use ">" as a shortcut for serverMessage. For example,
Quote:
>Server shutting down for maintenance

Last edited by 19 cm; 11-14-2012 at 09:17 AM.
Reply With Quote
  #22  
Old 11-14-2012, 01:13 PM
sukosevato sukosevato is offline
Member
 
Join Date: Jul 2011
Posts: 35
Default

Thanks a lot. I'll go test it when the servers are empty. And report back.
Reply With Quote
  #23  
Old 11-14-2012, 05:59 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Another update: http://bukva-yo.ru/kcoop-0.5beta2.zip

A thorough revamp of the user command system. Makes it possible for admins to disable specific commands via config file. The text of /cmds is also customizable via config.

!kickme command added

Fix occasional spurious "testPlaneScale set to 100" messages. The script won't touch the test* vars unless specified by map config.

Automatic team assignment only works on coop maps now, that is, maps whose name looks like ???_coop_*
Reply With Quote
  #24  
Old 11-14-2012, 07:07 PM
sukosevato sukosevato is offline
Member
 
Join Date: Jul 2011
Posts: 35
Default

It works perfectly. Thanks a lot. Very useful feature!
Reply With Quote
  #25  
Old 11-14-2012, 09:52 PM
Cracker Cracker is offline
Senior Member
 
Join Date: Oct 2012
Location: Netherlands
Posts: 183
Default

Quote:
Originally Posted by 19 cm View Post
Another update: http://bukva-yo.ru/kcoop-0.5beta2.zip

A thorough revamp of the user command system. Makes it possible for admins to disable specific commands via config file. The text of /cmds is also customizable via config.

!kickme command added

Fix occasional spurious "testPlaneScale set to 100" messages. The script won't touch the test* vars unless specified by map config.

Automatic team assignment only works on coop maps now, that is, maps whose name looks like ???_coop_*
Also this works perfectly, thnx again! Only the !kickme command also says its a drop, might be fun if it says (in the server) its a long ban :P
Reply With Quote
  #26  
Old 11-15-2012, 08:20 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

So that is the purpose of !kickme you say, to give people a few giggles?
Reply With Quote
  #27  
Old 11-15-2012, 08:48 AM
Cracker Cracker is offline
Senior Member
 
Join Date: Oct 2012
Location: Netherlands
Posts: 183
Default

Of course, what would it else be :P?
Reply With Quote
  #28  
Old 11-15-2012, 09:23 AM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

It has always been a mystery to me
Reply With Quote
  #29  
Old 12-10-2012, 01:03 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

Re-uploaded version 0.5beta2 as version 0.5: http://bukva-yo.ru/kcoop-0.5.zip

It's exactly the same code and binaries, just the name changed to reflect the fact that it's been out for a while and no bugs have been found.
Reply With Quote
  #30  
Old 01-29-2013, 06:39 PM
19 cm 19 cm is offline
Member
 
Join Date: Nov 2011
Posts: 73
Default

A small update: http://bukva-yo.ru/kcoop-0.5.1.zip. Fixes a security issue.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with PHP Script jardanc@yahoo.com Dedicated Server 24 10-12-2010 07:09 PM
Gargamel - Smurf Detection Script tec27 General Altitude Discussion 12 07-25-2009 03:30 AM


All times are GMT. The time now is 06:02 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
2008 Nimbly Games LLC