Random Map Generator - How to hook it into the game?

Interesting mapping tools and mapping help.

Moderator: Morax

Random Map Generator - How to hook it into the game?

Postby Sllypper » 08 Dec 2017, 04:36

Hi. I've been thinking about the Random Map Generator idea, as so many people have thought already, and in my mind its very feasible except for this one point: How would it be hooked into the game?

Would it be possible for we to have it codded inside a map file so that it generated itself before the match started and have this map in the vault?
Or would it have to be modded into the FAF client itself?
Sllypper
 
Posts: 6
Joined: 28 Nov 2016, 23:46
Has liked: 0 time
Been liked: 0 time
FAF User Name: Sllypper

Re: Random Map Generator - How to hook it into the game?

Postby CookieNoob » 08 Dec 2017, 15:35

Generating the map on launch of the game is most likely impossible. There are only VERY limited methods available to modify a (height-)map and strata during the runtime of the game.

You can generate a set of maps though and give them a special property (i.e. in the scenario file "randomly_generated_map = true,") and adjust the random map function in the game lobby to only pick maps from that pool and only on game launch. You would have to generate a set of these maps and upload them to the vault and then make sure that all players in that game have at least a subset of this map pool. Distribution via the vault seems to be the easiest way to me.
/viewtopic.php?f=53&t=7018 this is the thread (with the code) about a random map generator Duck_42 wrote for galactic war.
Here are some pictures of the maps that came out of that generator: /viewtopic. ... 824#p74383
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Re: Random Map Generator - How to hook it into the game?

Postby uzurpator » 08 Dec 2017, 16:53

If the generator is correctly created, it can create maps on the fly in the lobby. All that needs to be done is to share a seed with all players and they will generate an exact copy of the map. Plenty of games to that.

A scenario file might also contain a seed for generation, so anyone who has it will generate the same map, all of the time.
uzurpator
Avatar-of-War
 
Posts: 70
Joined: 11 Nov 2017, 20:29
Has liked: 3 times
Been liked: 14 times
FAF User Name: uzurpatorex

Re: Random Map Generator - How to hook it into the game?

Postby CookieNoob » 08 Dec 2017, 17:02

uzurpator wrote:If the generator is correctly created, it can create maps on the fly in the lobby. All that needs to be done is to share a seed with all players and they will generate an exact copy of the map. Plenty of games to that.

A scenario file might also contain a seed for generation, so anyone who has it will generate the same map, all of the time.


no, thats not true. The game engine restricts file access for game code after launching the lobby (the initialization file is a slightly different story, but it is also not suitable) to the game.prefs file. However, to create a playable map, you need to generate the .scmap file of that map. The commands to manipulate the map from the LUA code are basically non-existant.

Sure a generator can be created as a deterministic function that generates always the same result from a seed. The problem is not the generation of the map, but the restrictions of the engine functions that prevent modification on the map files.
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Re: Random Map Generator - How to hook it into the game?

Postby Blackheart » 08 Dec 2017, 17:19

Couldnt you do it for ladder? Once you have found an opponent, the server creates a map, sends it to both players and then the game starts. Also with the map being unexplored at start please! :>
User avatar
Blackheart
Priest
 
Posts: 376
Joined: 04 Jul 2012, 13:26
Has liked: 294 times
Been liked: 299 times
FAF User Name: various

Re: Random Map Generator - How to hook it into the game?

Postby uzurpator » 08 Dec 2017, 17:23

Intresting.

Does the game load the scmap first, and then runs the scenario scripts, or vice-versa? It is possible to invoke an executable from a game lua scripts?

If the script files are run first, then it should be possible to run a map script which invokes a seperate process to generate the scmap and preview there. Unless the forged alliance process locks the entire game directory tree.

Moreover - the lobby of FAF is different then in vanilla game, so I persume there are chagnes there that should allow to transfer seeds when the host triggers a map change - rating and games playes are, after all.

Transferring random maps through the Vault seems very inefficient :)
uzurpator
Avatar-of-War
 
Posts: 70
Joined: 11 Nov 2017, 20:29
Has liked: 3 times
Been liked: 14 times
FAF User Name: uzurpatorex

Re: Random Map Generator - How to hook it into the game?

Postby uzurpator » 08 Dec 2017, 17:25

Blackheart wrote:Couldnt you do it for ladder? Once you have found an opponent, the server creates a map, sends it to both players and then the game starts. Also with the map being unexplored at start please! :>


I was actually wanting to create a random generator ( disclosure, I am a programmer and have made topographics generators before ) for this reason only. In perfect world before any match a set of, say, five maps would be created and opponets would negotiate which one they want to duke it out.

This would make it impossible to 'patent' a map.
uzurpator
Avatar-of-War
 
Posts: 70
Joined: 11 Nov 2017, 20:29
Has liked: 3 times
Been liked: 14 times
FAF User Name: uzurpatorex

Re: Random Map Generator - How to hook it into the game?

Postby CookieNoob » 08 Dec 2017, 17:49

uzurpator wrote:Unless the forged alliance process locks the entire game directory tree.
uzurpator wrote:It is possible to invoke an executable from a game lua scripts?
The game engine restricts access to all files, except the game.prefs file from the ingame code. There is no way around that. The reason for this is to prevent malicious code being executed from mods/maps (viruses...).

Blackheart wrote:Couldnt you do it for ladder? Once you have found an opponent, the server creates a map, sends it to both players and then the game starts. Also with the map being unexplored at start please! :>
that is possible (except for the unexplored part, I know it was implemented in the original sup com game, but FA doesnt contain it afaik).
Check out the next level of maps: viewtopic.php?f=53&t=13014
For adaptivity, customizability and less clutter in the vault.
User avatar
CookieNoob
Priest
 
Posts: 477
Joined: 02 Aug 2014, 17:07
Has liked: 65 times
Been liked: 249 times
FAF User Name: CookieNoob

Re: Random Map Generator - How to hook it into the game?

Postby Sllypper » 09 Dec 2017, 05:19

So it would have to be added into the FAF client as a different game section and stuff, huh?
Then it could even have replay working and wouldn't polute the Vault or anything. Like, the generator options would be saved into FAF the replay overhead and the client would generate the temporary map before launching it.

There it goes my dream of it having it with map options inside the lobby for seed, map type, etc... like the one on AoE 2. That's the downside, setting the player number outside the lobby. It wouldn't be that bad if it is used for 1v1, though.


Another question then, what would be the best implementation of it by design? Not considering if it's possible or how easy is to do it, but how would it work and be integrated the best? What would have to change for it to be possible that way?

Thanks everyone for answering and thanks CookieNoob for linking the old generator for GW. I'll check it out :)
Sllypper
 
Posts: 6
Joined: 28 Nov 2016, 23:46
Has liked: 0 time
Been liked: 0 time
FAF User Name: Sllypper

Re: Random Map Generator - How to hook it into the game?

Postby nine2 » 09 Dec 2017, 11:10

I used to share this dream.

Faf client can generate maps easily enough.

Duck got map gen working, I have played on his maps. He did a good job and broke through lots of barriers.

Twin rivers and Loki are interesting in a way that random won't be. Random isn't good, careful design and craftsmanship is good.

I personally would play random maps, but id have low expectations.

Random maps could fine tuned manually by real mappers
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Next

Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest