Sign in to follow this  
Viking

System

Recommended Posts

Hello,

 

i am working on a menubased mapvote with dynamic content.

The final result is a mapvote with just a few assets an iwd that changes at the end of every map.

Clients will redownload the iwd on every new map - what should not be a problem because the iwd is very small.

As you can imagine the voteable maps will constantly change and the modder is not forced to add tons of map preview assets to his mod.

 

However, to tell the server to rebuild the iwd i created a little plugin that just makes use of system().

Now I would like to know if there is any security risk using this plugin or sharing it.

 

The whole thing is nearly done and ready for the first test on a live server.  :-)

 

Code example from gsc:

system("mkdir -p " + serverAndModPath + newFolderName);

 

Edited by Viking

Share this post


Link to post
Share on other sites

 the mapvote.iwd does change on the cod4x server after map change
HOWEVER
it does not change on a fast download server and since the files are different it reverts to downloading from the cod4x server
making it take a very long time to download on each map change

  • Like 1

Share this post


Link to post
Share on other sites

more problems besides downloading mapvote.iwd

prior to that problem I also had the problem here:
 

if I select one of the maps it does not change to the selected map.

btw I have this set up on my test server the only thing I added to it is the bot scripts

it did the same thing without the bots scripts

Edited by wkuzma

Share this post


Link to post
Share on other sites
On 11/25/2021 at 5:49 AM, wkuzma said:

 the mapvote.iwd does change on the cod4x server after map change
HOWEVER
it does not change on a fast download server and since the files are different it reverts to downloading from the cod4x server
making it take a very long time to download on each map change

Q: Players get a download loop when downloading the mapvote.iwd

A: The mod generates a new mapvote.iwd on every map end therefor the file continously changes. To avoid a download loop create a softlink instead.

 

Make sure your fastdl has a softlink to the iwd which is located in your server mods folder.

 

3 hours ago, wkuzma said:

more problems besides downloading mapvote.iwd

prior to that problem I also had the problem here:
 

if I select one of the maps it does not change to the selected map.

btw I have this set up on my test server the only thing I added to it is the bot scripts

it did the same thing without the bots scripts

Works fine for me.

What's your console log saying?

I guess the map you voted for is not in your usermaps folder (if its a custom map)

Share this post


Link to post
Share on other sites
10 hours ago, Viking said:

Works fine for me.

What's your console log saying?

I guess the map you voted for is not in your usermaps folder (if its a custom map)

the maps are all stock maps

10 hours ago, Viking said:

 

Make sure your fastdl has a softlink to the iwd which is located in your server mods folder.

how do you make a softlink to a file that is held on a different fast load server then is what your server runs on?

my mods are on www.kab.iogcod4.com\mods and my server is on a completely different server computer different ip

Edited by wkuzma

Share this post


Link to post
Share on other sites
3 hours ago, wkuzma said:

the maps are all stock maps

how do you make a softlink to a file that is held on a different fast load server then is what your server runs on?

ok I found a workaround for the file diffference

i will use curl to ftp the new file to the fast dl server

curl -u user@iogcod4.com:password ftp://ftp.yourserver.com/ -T mapvote.iwd

it works great and is very fast in transferring the file but I now need to implement it in the scripts so I need to know exactly when the new file is made so it can be transferred..

Edited by wkuzma

Share this post


Link to post
Share on other sites
2 hours ago, wkuzma said:

ok I found a workaround for the file diffference

i will use curl to ftp the new file to the fast dl server

curl -u user@iogcod4.com:password ftp://ftp.yourserver.com/ -T mapvote.iwd

it works great and is very fast in transferring the file but I now need to implement it in the scripts so I need to know exactly when the new file is made so it can be transferred..

would be nice if you didn't have to download the iwd every map change other wise it works great

you did a good job on making it but I doubt anyone will use it because of the iwd download

my work around worked good for a while after I put  30 seconds  between downloads - but if you selected the same map to play again it gets caught in a download loop  between the server and fast download  - it downloaded from the fast download then again from the server until it errors

and crashes the client not the server.

 

 

Share this post


Link to post
Share on other sites

The vote is rebuilding the iwd after every vote, that's the core of it.

How else should the loadscreen images change?


Tbh i did not test it with a second server for fastdl but i will do that and update the repro as soon as possible.

 

Adding your curl here might already fix your issue

https://github.com/VikingKampfsau/dynamic_mapvote/blob/512e8347af8f4d40be818a3684356a9e02a961e3/cod4x-server/mods/dynamic_mapvote/mapvote/script/dynamic_mapvote.gsc#L164

Share this post


Link to post
Share on other sites

I think i found a way to handle the upload to a fastdl that is running on a different server and/or ip.

Please try the new scripts, don't forget to update your config as well.

 

On 11/24/2021 at 11:46 PM, ={FMJ}=Smiley said:

If anyone gets this working with OpenWarfare MoD I would be interested to know how 🙂 Looks great btw.

I forgot to upload the material sources to allow others to add it to their mod projects.

I am sorry about that and will upload the missing files in a minute, as well as an updated readme that tells you how to add it to your mod.

  • Like 1

Share this post


Link to post
Share on other sites

I like the new version with the sshpass but in my case sshpass would not work so I replaced it with

//if(getDvar("mapvote_fastdl_ip") != "")
        system("curl -u name@myfastdl.com:password ftp://ftp.myfastdl.com/ -T /home/cod4/main-server-files/mods/kabbot2/mapvote.iwd");

and that allowed it to work ok

the only problem I see in my case is when curl is called it causes a slight connection error but its playable.

I was pleased to see it uploaded the mapvote.iwd on server start

I only have this on my test server but I wanted you to be aware of any problems I ran into - that way it would help those that do use it.

the map vote system is great and looks prefect when in play

 

 

 

Share this post


Link to post
Share on other sites

I just thought of some thing that may prevent the downloading of mapvote.iwd  on all maps

is it possible to rename mapvote.iwd to each map say like mvcrash.iwd , mvconvoy.iwd  etc

then once its downloaded the next time the map comes up it will not have to be downloaded again?

 

 

Share this post


Link to post
Share on other sites

I don't think so because of some reasons:

  • It would destroy the core intention of the vote -> predefined votes are not dynamic anymore
  • Predefined votes would not consider all maps in your rotation, especially not when you change the runtime while the server is already running
  • When the iwds are stored in the mod folder it's wasting a lot of space and at the end it would not work because of two reasons
  1. the game stores all loaded iwds in a dvar that is used to check the hash to find out if it requires a (re-)download.
    the lentgh of any dvar string is limited and might not cover all iwds in the end
  2. the game loads iwds in alphabetical order, so the content of mvcrash.iwd is ignored when there is a mvconvoy.iwd
  • When the iwds are stored outside the modfolder it won't work either because of the sv_pure dvar.
    All clients with an additional iwd (let's say mvcrash.iwd) would be kicked when the server is using mvconvoy.iwd

 

I don't see a problem with the upload/download on every new map because the size of the mapvote.iwd is quite small.

With the original loadscreen images of cod4 stock maps i get a size of 3-4 MB which is nowadays a download of a few seconds.

If you want to lower the size you can change the resolution of the loadscreen images at any time.

Also, servers nowadays usually come without a traffic limit.

 

I agree that the short lag (connection interrupt) when the new iwd is zipped and uploaded is annoying, but to be honest i don't know how to tell the plugin to run the function as a new thread.

Maybe anybody knows and can fix this issue.

If not then that short lag should not really be a problem because for me it lasts about 1-2 seconds only at a point where it's not interrupting any gameplay.

 

Thanks for your feedback and suggestions so far :)

Share this post


Link to post
Share on other sites

I see why what I suggested would really not work - since even on the same map the iwd becomes a different size then when the map was up before.

I do not know if the following is just my setup but I did find a flaw with the map vote showing the winning picture. it shows and stays long enough but then goes away and comes back for only a second then goes away again. I notice that is when the connection interrupt happens so it could be my dl work around using curl and ftp..- However it does not prevent game play and I though you should know .

my config is set as this

set mapvote_votetime 15 // Time in seconds players can vote
set mapvote_voteableItems 9 // 2-9; Maps appearing on the vote screen

set mapvote_resulttime 3 // 0-3; Time in seconds the vote winning map or results are displayed before the vote screen closes
set mapvote_resultdelay 3 // 0-3; Time in seconds the vote results are displayed before the preview of the winning map is displayed

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this