Comments (15)
picking maps purely by a random distribution at all doesn't make sense as i explained above. same maps might appear twice in a row, or with only one map in between etc.
example set of maps: A, B, C, D
using permutations of the full set
B C A D, C A B D <-- good
B C A D, D A C B <-- bad (D appears twice in a row)
using any random distribution:
A, A, A, A, A, A <-- bad, and is perfectly possible
therefore i would prefer permutations .. or some other smart algorithm that assures some spacing between equal maps.
idea extended: having a probability of appearance per map might be also cool, such that popular maps can appear more often.
from cod4x_server.
Removing maps from sv_maprotationcurrent in random order. That is all you have to do.
from cod4x_server.
sv = "server" i believe?
i'm not sure if it makes sense to pick the maps completely randomly, that would include maps can be played twice or more times in a row, and also the frequencies of maps in general wouldn't be uniform.
from cod4x_server.
You could keep track of what maps are played already, and only allow a map to be played if it hasn't been played that rotation. Basically just create an internal array of the maps in sv_randomMapRotation
, and randomly choose a map. Once the map is loaded take it out of the array. Continue this till the array is empty, and then fill the array again.
It's easy talking for me since I'm just an user, but seems reasonably easy to me.
Isn't that sv
redundant? Could it maybe be taken out? Or is this done to keep it clear in code?
from cod4x_server.
the prefixes are useful to categorize commands
what you are describing would be a permutation (like shuffling cards). problem remains between two permutations.
from cod4x_server.
You mean if you rotated once, how to make sure the first map of the next rotation isn't the same map? Don't you have a variable somewhere that holds the previous map? If so, just check if the next chosen random map is the same as the previous one. If it is, try a new random map.
from cod4x_server.
If it helps anything, I have some .gsc
code (I can't exactly remember the name of the guy who gave it to me, and the old Iceops forums are down so I can't check) that currently does it for me in localized_english_iw07.iwd
, but of course it would be preferable to just have it as a variable in Cod4X.
init(){
level.mapPool = strtok("mp_bo2mir;mp_bo2cargo;mp_box_hjacked;mp_chateau;mp_ctan;mp_mbdepot;mp_pow_rld;mp_tigertown_v2;mp_toujane_beta;mp_brecourt_v2;mp_killhouse;mp_shipment;mp_cargoship;mp_vacant;mp_farm;mp_overgrown;mp_convoy;mp_crash;mp_backlot;mp_crossfire;mp_citystreets;mp_strike;mp_fav;mp_karachi;mp_rundown;mp_scrapyard;mp_skidrow;mp_highrise;mp_inv;mp_modern_rust;mp_mw2_term;mp_sbase;mp_storm_b;mp_nuketown;mp_firingrange_v2;mp_4hanoi;mp_summit;;mp_qmx_matmata;",";");
level thread randomRotation();
}
randomRotation(){
wait 5;
newmap = level.mapPool[randomInt(level.mapPool.size)];
while(newmap == level.script)
newmap = level.mapPool[randomInt(level.mapPool.size)];
setDvar("sv_maprotationCurrent","map " + newmap);
}
Although I don't think it checks for playing same map twice in a row and frequency of maps played like you said.
from cod4x_server.
I think, I can take a look on it. The problem is C library function rand() is not providing uniform distribution of results.
from cod4x_server.
Com_RandomBytes()
from cod4x_server.
This variable just copied from sv_maprotation so deleting c from abcd will affect map sequence a bit and thats not a random
from cod4x_server.
It is a random rotation which is duplicate free.
from cod4x_server.
In vanilla cod its not random, its a sequence based on sv_maprotation. Did you changed something?
from cod4x_server.
removing random items from the rotation is a good idea. if we remove like 50% of the maps it should feel random and duplicates are avoided.
from cod4x_server.
... And might happen we will never play on map XXX or play it extremely rare.
I think it's better to rebuild whole sv_maprotationcurrent in completely random sequence of maps (having in mind different gametypes for one map)
from cod4x_server.
So... Building an array of some sorts of all maps specified by the server admin sounds good. Removing the map out of the array when the map is being played/done. When the array is empty, fill it with new maps. You just have to check that the last map being played of that array isn't the randomly picked map of the new array. The second map of the new array doesn't really matter anymore. Should be relatively easy I would think, right...?
from cod4x_server.
Related Issues (20)
- How to fix following error HOT 2
- Server crash
- no chat on server HOT 1
- Text animation HOT 5
- Cod4 Mod FF Compiler Issue HOT 1
- .ff different from server help HOT 3
- Server received signal: Segmentation fault HOT 2
- Problems with downloads HOT 15
- problem starting bots with my mod HOT 19
- CL_CGameNeedsServerComand:a reliable command was cycled out HOT 4
- [BUG] AmbientPlay is crap since 20.X HOT 12
- problem with compiling cod4x server in linux debian. HOT 5
- [request] The need of stock asset registration skip HOT 2
- Demo Recording Filename HOT 6
- Torjan - Can't be false positive? HOT 2
- Impure client detected! Invalid .IWD files referenced! HOT 3
- Error HOT 1
- Implement NAT Hole punching HOT 7
- Find game files (main, zone) from current working directory rather than where the binary is HOT 1
- Multiple Steamid same playerid HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cod4x_server.