Jump to content
  • 0

Restarting Arma3 dediserver 500 times during script development?


mgm

Question

Hi All,

 

I have a question to seasoned scripters please. First a little background, I recently started writing a basic script, lots of pain with 'general error' / 'object is null' etc. errors but finally there is some progress, things looking up at least it is fun! :D

 

I now have some tools which I did not have on day0 - these help me save time suchas git setup on desktop+laptop+mobile and bat/cmd scripts to easily restart server and so on.

However there is one issue which still feels like I am doing something totally wrong: each time I change a file, however tiny, I still need to restart the whole dam server which takes a good 2-3 minutes.

2-3 mins doesn't sound like a lot but I need to test a lot of things as you can imagine so 500per day x 2-3 minutes quickly add up to serious numbers [i admit I exaggerate the number a little but you get the point!].

 

Potential solutions/improvement options I read about:

  1. I read about Arma2Net but I don't totally understand the implications so I ignored it for the time being - also I don't know if it is an Arma2-only thing as I am currently working on Arma 3.
  2. I also came accross that command in BIKI (which I can't remember now) the one basically lets you reload a file while the server is still running thus (in theory) eliminating time-wasting restart - unfortunately Windows is putting a lock on the file and file cannot be modifed unless you use unlocker.exe etc. pulling files from under could affect arma3 game negatively and having limited time I have not done extensive tests on it either (just skipped it for the time being).
  3. I also thought about a potential virtualization solution (haven't read about it anywhere which suggests maybe not that good of an idea!) I do understand the extreme perf. penalty but when testing basic scripts it probably won't be an issue so perhaps quiesce snapshots is the way to go?

So the above is my problem, what do you guys do to quickly change files & re-test? Is there a utility or some clever hack to improve the development cycle massively?

 

Thanks in advance for any input!

 

 

P.S.: (don't get mad awol but) in my quest for quicker restarts, for the time being I even dropped 'epochmod' from startup options. Once I have less 'general error's I will add it back  to test the relatively mature code under Epoch. I read about different classnames possibly being an issue and that some BIS_fnc's might not working with Epoch (info source: Vampire's blog) so will need to definitely test in Epoch - as soon as I have something to test!)

Link to comment
Share on other sites

19 answers to this question

Recommended Posts

  • 0

My test server runs from SSD, the only way I found to do quick restarts.. The server itself starts from a batchfile that copies all files from a deploy folder at start.

 

So something like :

@echo off
:start
d:
cd "D:\Steam\steamapps\common\Arma 3"
taskkill /f /im arma3server.exe
timeout 3
taskkill /f /im werfault.exe
timeout 2
start Tools\log-rotator.cmd
xcopy d:\deploy\*.* "D:\Steam\steamapps\common\Arma 3" /s /q /y
del d:\deploy\*.* /s /q
start "arma3" "arma3server.exe" -port=2321 -malloc=system -config=SC\config.cfg -ip=192.168.2.3 -profiles=SC -name=GFS_Admin -cfg=SC\basic.cfg -autoinit -mod=@AllInArmaTerrainPackLite;@taviana;@Epoch;@EpochHive
timeout 20
cd \bec
start /w bec.exe -f Config.cfg
goto :start

This way I only have to close the server console to shut all down, reload all changed files and start again.. P. much easy since I can edit files from a separate tree while reading through the rpt files and tackling errors, when done copy to deploy and restart.

Link to comment
Share on other sites

  • 0

I do it much the same as nedfox, my server re-compiles the PBO before startup and grabs all the changes I made. 

 

I can merilly change what I want and then just bounce the server (takes about 2 minutes to start fully) and we have our changes. 

 

I would also love to be able to reload files on the fly, like script file changes and something, if someone could do that I would be ever in your debt!! 

Link to comment
Share on other sites

  • 0

I think the key is loading the server from an SSD, when I did that the sever startup time dropped to about 90 seconds from about 3 minutes (including starting a headless client, updating trader stock and copying updated files to the server and then waiting for missions to start)

Link to comment
Share on other sites

  • 0

Start Your client with "-showscripterrors" and the exact same mods/addons as You would start the server with (no redis DB needed).
See if any error pops up, then read the client .rpt, fix the errors in Your code and test again.
If everything seems to work on the client, upload your files to the Server and do a "live test".

You can also test scripts by simply loading them clientside in a little "test" mission You created in the Mission Editor.
All You have to do is, start the client with the @epoch (and the terrain You use) mod and You are ready to test most of the scripts clientside by placing them into the test mission folder (no .pbo!).
This way You can edit "on the fly" and exec or preprocess and call the edited script via the debug console.

Greez KiloSwiss

Link to comment
Share on other sites

  • 0

All,

Thank you for the inputs.

...

KiloSwiss,

I have placed my script in a test mission already but it is in a folder (rather than a @mod server start parameter).

ArmaServer.exe process is placing a lock on all files under the \mission-directory\*.* hence the need to restart (a lot!).

Are you saying if I move my mission from <mission-directory> to a mymission.pbo, [which is to be added to the launch parameters list, just like @epoch] then I can change mymission\myScript\myScript_init.sqf file?

But how can it be, it will be an active (in-memory) packed mission.PBO won't it?

Question #1: Would arma3server process even allow me to overwrite that mission.pbo file?

Question #2: And if it does allow me to change it while the server is still running, how will it "detect" the changed script file contents? [because it has been loaded in to the memory and being run from memory isn't it?]

Sorry just trying to understand...

Link to comment
Share on other sites

  • 0

Would You kindly remove that stupid full quote, it looks so retarded.

I edited my previous post to make it as obvious as possible, that I'm talking about the client, the client, the client and not the server, but the client.

Greez KiloSwiss

P.S.
I'm not putting any gay smileys into my post, but I can assure you that it was written without any anger or aggression towards You or any other person.

No "C", "E", "I", "L", "N" or "T" keys were harmed during the writing of this post.

Link to comment
Share on other sites

  • 0

During development I tend to do as much in the editor as possible initially. I often spend two hours a day on the train so time used developing on my laptop.

 

The debug console is a godsend. Use it to fire off your scripts or parts of to test.

 

The server is obviously needed, with the current build you'd 'need' to run a vanilla server to enable the debug console. 

 

Arma will read newly created files then will lock them, the engine remembers the content even when not locked  ;)

Link to comment
Share on other sites

  • 0

During development I tend to do as much in the editor as possible initially. I often spend two hours a day on the train so time used developing on my laptop.

 

The debug console is a godsend. Use it to fire off your scripts or parts of to test.

 

The server is obviously needed, with the current build you'd 'need' to run a vanilla server to enable the debug console. 

 

Arma will read newly created files then will lock them, the engine remembers the content even when not locked  ;)

Okay thanks. In the light of this experience, my respect for all scripters instantly doubled. So time consuming this process.

Link to comment
Share on other sites

  • 0

Yeah, luckily you can see the errors, but sometimes the smallest things are the hardest.. I spent 1 bloody hour searching for an error in 1 line, where I just had an unremarked textline just above it without realising it wasn't remarked... The SQF plugin in Notepad++ is pretty nice, but still I totally overlooked it :P

Link to comment
Share on other sites

  • 0

Yeah, luckily you can see the errors, but sometimes the smallest things are the hardest.. I spent 1 bloody hour searching for an error in 1 line, where I just had an unremarked textline just above it without realising it wasn't remarked... The SQF plugin in Notepad++ is pretty nice, but still I totally overlooked it :P

I am aware there's an SQF plugin I had it installed before but currently I'm using Notepad++ and quickly setting .SQF .SQM .HPP file extensions as C++ code it is automatically working as syntax highlighter - good enough for me.

 

What it does not do is, it doesn't warn HEY DUDE YOU FORGOT AN OPEN    {

Arma3 does tell me that (it's kind like that) but it takes 2-3 minutes for the server to startup and notice the problem.

 

There should be a script parser to warn about code blocks without ; at the end or any open but unclosed { ( [ etc.

 

With this many scripters, I can't believe noone wrote a parser for Arma.

Link to comment
Share on other sites

  • 0

What it does not do is, it doesn't warn HEY DUDE YOU FORGOT AN OPEN    {

Arma3 does tell me that (it's kind like that) but it takes 2-3 minutes for the server to startup and notice the problem.

 

There should be a script parser to warn about code blocks without ; at the end or any open but unclosed { ( [ etc.

Notepad++ does highlight [{( that are "closed" with its counterpart )}] in red if You place the cursor on it and it also adds the option to collapse and extend whole "scopes" or code blocks.

 

Closed but never opened:

}

 

Opened but never closed;

{

 

That's how its supposed to be:

{

};

 

Klick on the attachment to see an example post-27764-0-42941100-1425590876_thumb.j

 

Greez KiloSwiss

Link to comment
Share on other sites

  • 0

Yeah it does, I have the same color coding on my screen [it's Notepad++'s default syntax highlighter which you can get by setting file type to for example C++ as I reported earlier).

However I'm still missing things with that color coding.

 

If you're never forgetting an open bracket just because of that color code, maybe I just need practice to reach your level...

 

I'm thinking like an F12 or some hotkey to press which should go through the file in about 2 seconds and report "in line 188 y

 

ou have an open bracket". Arma engine does that, ruleset is pretty example, for each open { [ (, expect one corresponding } ] ) or report error... Anyway I'll try to be more careful. << EDIT1: I mean Arma engine does that but then you have already wasted 2-3 minutes. Fix that dam ; and re-try hopefully you won't lose another 2-3 minutes. In my first week of writing stuff from scratch I probably had to go back 100 times. Hence this thread. It is gettign better now though...

 

Also I set up git, integrated git comparison showing line by line what I changed in between revisions that's very helpful.

 

EDIT2: Ah, thanks for this. It looks like exactly what I was trying to describe ==> https://docs.google.com/presentation/d/1aq6n7L8IckNBNSP7uHvfXFG7Y58Il9YQPx4NA6jlfO0/present#slide=id.i24< slide 4 specifically!

 

EDIT3: Aww this thing is cool - it's giving all these warnings below! Exactly what I had on mind, thanks a lot axeman!

 

TysEawV.png

wAo5NAg.png

 

 

 

 

 

 

EDIT4: Okay below are the TIPS I can think of.

Not that I am seasoned etc. but having wasted so much time, I wish someone told me these on day0 - would definitely save a lot of time...

so here's my tips to any other new scripters that might come across this post later - do the following for your own good:

  1. gitlab.com sign up for a gitlab.com account, gives you git space just like github but you can also set private repos to keep private notes etc. this is essential for versioning single click 'checking' old code and reverting back to current one, comparing differences etc. etc.
     
  2. Smartgit on the git client side, having tried a few and read about others experiences I am super happy with this one. indeed good for starters - designed to help you get started with git quick
     
  3. SSD for dedi server & test client as stated above it took 5+ minutes down to 2.5 minutes or so. with 50 restarts over a long night, it does make a huge time saving.
     
  4. Squint wow it even detect declared-but-unused vars!
     
  5. unloading Epoch for basic testing, you miss all the rich stuff but if you're creating a basic script that 'should' work with Epoch, it might be a good idea to test in a vanilla Arma environment - of course to be tested with Epoch just before public release.
     
  6. cygwin environment on Windows development box + show me the last 100 lines of latest RPT file and keep doing this every second command: this basically helped me stop reopening/refreshing RPT files (last RPT file I opened was 8 days ago, hopefully will never open one again in my life - I just double click on the link) command:         while sleep 1; do tail -n 100 /cygdrive/c/Users/your-username/AppData/Local/Arma\ 3/`ls -ltrFAlh /cygdrive/c/Users/your-username/AppData/Local/Arma\ 3/ | tail -n 1 | cut -d " " -f 11-`; done          [you might need to play with cut value (11) a bit, try 9 - 10 - 11 - 12 one of them should show the RPT. (haven't revisited this command chain since last week as it takes 0.5 seconds to find the workingvalue)
     
  7. git on the go also if you like reviewing others sqf code occasionally on your smartphone, a git app would work fine, simply expand the SQF folder in Smartgit, pull in mobile client, and scipts at your fingertips. BIKI is good to explain stuff but seing it in actual program code helps understand better - at least for me.
     
  8. grepwin this free software helps you search for text in multiple files & dirs.
    an example use case: dump all SQF code you can find in one directory, go to this tool and type what you are looking for (e.g.: 'addpublicservereventhandler') it will parse all dirs and show you relevant one-line code from thousands of files, pick the easiest one to learn how to use that keyword/code etc. http://stefanstools.sourceforge.net/grepWin.html

 

 

 

EDIT5 I'm about to break world EDIT record here....

Just wanted to add: I will be grateful if axeman and any other scripting  gurus share any tips. If there is any other must-not-miss stuff out there please let us know

Link to comment
Share on other sites

  • 0

Helpful thread! restarting the server just to realize you forgot a }; is a pain in the a.. 

 

i use some simple batch commands like 

IF EXIST "D:\A3epoch\GoliveMission\epoch.Altis" (
Robocopy D:\A3epoch\GoliveMission\epoch.Altis D:\A3epoch\MPMissions\epoch.Altis /MIR
)

which checks if i have a epoch.Altis folder in my "GoLiveMission" folder, it then copies and overwrites that to my mission folder. You can do the same with your addons folder. 

 

I then execute this in a bat which runs if i restart the server. 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...