Author Topic: Map Randomizer!  (Read 4449 times)

Offline Stormy

  • Hero Member
  • *****
  • Posts: 678
    • http://www.op3game.net
Map Randomizer!
« on: October 04, 2005, 11:17:48 PM »
Hey, if we ever get far enough into OP2 stuff, why don't we make an 'auto' mapper that randomly creates maps using certain perameters: IE: Tiles inside x, x, x, and x, must all be passible (for bases). The cliffs, i'm calling Y.. must all be next to each other...

This might be really confusing but The bases would be 'pre-made' so they would go in the position x, x, x, and x made up above. The mines must be X tiles away from the edge of the smelter.

It has 'pre-written' code that it then auto-generates the map.

This code is then incorperated into OP2 and the map is loaded.

THis is an idea more for the future, but still, think it could ever be done?
`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·
3D artist in Blender, MS3D, and Terragen.
Trying to get good with Scene composition and lighting.

Offline spirit1flyer

  • Hero Member
  • *****
  • Posts: 621
Map Randomizer!
« Reply #1 on: October 04, 2005, 11:22:39 PM »
thats a long way off but a great idea
"Until you stalk and overrun You can't devour anyone"


Loyal Xfir supporter

Offline Stormy

  • Hero Member
  • *****
  • Posts: 678
    • http://www.op3game.net
Map Randomizer!
« Reply #2 on: October 04, 2005, 11:29:25 PM »
Hmm now that I think about it, it would be easier to make random Land Rush maps :D

Just put the vehicles in a 'formation' in the 'pre-code' and figure out where you are going to put them in the map.
`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·
3D artist in Blender, MS3D, and Terragen.
Trying to get good with Scene composition and lighting.

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Map Randomizer!
« Reply #3 on: October 05, 2005, 03:24:52 AM »
You are not the first one with that idea: http://forum.outpostuniverse.net/index.php?showtopic=1785
It could even be implemented in Outpost2 really easy, just by coding the whole map-generator in the mission-dll.

I believe that the way Homman is doing it is not the right way though. You can't just randomize so much of the map.
Settings for number of base entrances, amount of ore in/outside the bases, amount of cliffs,closed or open map etc. would be good. Maybe have the dll load an ini-file for this. And in multi the map is only randomized on one computer (player 0) and sent to the others (I guess we'd need a network interface for that to work in the dll).

The randomizing process could be similar to this: (for non-LR maps)
  • randomize base-positions, so that they are neither too far away from each other nor too near.
  • calculate cliff-placement around base areas
  • calculate cliffs outside the bases
  • place cliffs as close to the previous calculation as possible (an exact match won't always be possible, because there aren't always tiles that fit in a certain gap)
  • place structures in the base areas
  • Create mining beacons inside each base randomly in a certain distance from the commen smelter dock, but so that it isn't covered by another building or by a cliff. Optional: create a mine at that place.
  • create mining beacons outside the bases
I would do it myself if I had the time.
 

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Map Randomizer!
« Reply #4 on: October 05, 2005, 02:24:04 PM »
Well, Hooman hasn't dealt with any of the base setup itself. The only thing he's worked on is autogeneration of a .map file itself. (In fact, the program doesn't save a map file at all yet)

Dealing with the base positions on a random map could be a real pain to handle.

Offline Sirbomber

  • Hero Member
  • *****
  • Posts: 3238
Map Randomizer!
« Reply #5 on: October 05, 2005, 02:31:01 PM »
Well, I can't say I know much (anything) about OP2 mapping, so forgive my probably foolish question. Could you just tell the game to make 2/3/4/5/6 flat areas and then tell it to create your stuff in those areas based on player team and resource settings?
And would disasters be possible? (Sometimes I like that extra spoonful of hate from the game)  ;)  
"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Outpost 2 Coding 101 Tutorials

Offline TH300

  • Hero Member
  • *****
  • Posts: 1404
    • http://op3game.net
Map Randomizer!
« Reply #6 on: October 05, 2005, 02:37:34 PM »
Quote
Well, I can't say I know much (anything) about OP2 mapping, so forgive my probably foolish question. Could you just tell the game to make 2/3/4/5/6 flat areas and then tell it to create your stuff in those areas based on player team and resource settings?
no, there is no code in Op2 for automatic map-generation.

Quote
And would disasters be possible? (Sometimes I like that extra spoonful of hate from the game)  ;)
adding random disasters would be the least of a problem. (volcanic eruptions might be a bit complicated, but since dark-gray tiles can be automatically set to lava-possible, its just about time to code a function for that)

Offline thablkpanda

  • Full Member
  • ***
  • Posts: 249
Map Randomizer!
« Reply #7 on: October 05, 2005, 09:12:18 PM »
Yeah TH300-

Excellent idea, but seems kinda irrelevant in the long run. I mean sure- you've got a randomized map. But in order to keep the games 'fair' you'll need to setup all kinds of parameters for the randomization (Player 1's space must be X tiles wide, and Y tiles long; at least. Then maximum parameters, etc. etc.)

True - LR maps would be simpler. But what is the purpose for a randomized LR map? You pretty much define your own base in LR, so wherever in the hell you want to be your land- you so declare.

True - that would allow for more defined boundaries between players. But at what cost? (i.e. Possibliites for maps like (insert name of the one with all the rocks.. i forget the name), where you've got a crap-load of obstacles, annoying as hell.)

It'd require too many separate parameters IMO, and anyone that would consider such work, is more of a man than I am. (Apologies to all females that consider my statement offending, it's not meant in a sexist manner- simply a metaphor).

Christopher M.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Map Randomizer!
« Reply #8 on: October 06, 2005, 07:09:15 PM »
Well, a few points I'd like to make here. First of all, that project of mine that was mentioned was meant to be more of an idea test for auto filling regions in the mapper. That kinda takes a lot of the difficulty of fairness away since the person doing that mapping can accept or reject what the algorithm outputs well before a game is started.

As for the possibility of a random map type of level, and ignoring fairness for the moment, it's quite possible from a technical perspective. The map generation code can be placed in a level DLL. Having everyone randomly generate the same map isn't a problem either. When the game starts, all people in the game share the same random number seed, so if you're using the random number generator that OP2 exports functions for, you'll all generate the same sequence of random numbers. Thus, you'd all generate the same map without having to send it to other people. That's one way the game stays in sync without adding a large communication overhead. Instead of sending things like random weapon damage during combat, every client just generates the same random number themselves, so the only data that needs to be sent are the actual player commands.


Also, I'd like to point out that any map that's randomly generated would need to have player start locations accessible from one another. It'd be no fun if players were put on either side of an impassible ridge with no way to get across it. Or even worse, if one player was stuck on a small "island", and the other player(s) weren't. It'd be especially bad if the so called island was small enough that everywhere on it was within weapons distance of people off the island. Mind you, that's not such a hard problem to solve. Just do a breadth first search traversing all passible tiles from one start location, and see if it reaches the other start locations. You can also create some sort of template base area to ensure fairness within the immediate region around a base, but there may still be issues for the surrounding regions. Things like narrow mountain passes on the rest of the map, or the number of paths from one base to any other given base location, and the distribution of resources would all be concerns.


I'd also like to point out that the current map generation algorithm has certain glitches. The easiest to notice is that not all tiles it places next to each other really fit next to each other graphically. This can be improved or eliminated by using a better data set. The next big problem is the order in which tiles are generated, and the restrictions adjacent tiles put on each other causes transitions between terrain types to appear along diagonal lines from the top left to the bottom right. With the current test code I was using, it's very unlikely that a sequence of random numbers would allow for much transition along any other line. There is a change to the algorithm that I know of and would fix this problem, but it could greatly increase the memory and time needed to generate the map. Which brings me to my next point. The current test project (written in VB) is much to slow to really be used in generating a full sized map. The test project only generated 32 x 32 tiles. Also, ignoring the problem of speed, there is also the problem that it might never finish. It is possible for this type of algorithm to get stuck in an infinite loop and never finish outputting a map. It depends largely on the data set used, and the order in which tiles are placed. I see no easy way to know before hand if the data set allows for this possibility, and no way to reliably detect if the algorithm is stuck, or just being slow.


 

Offline Flanx

  • Newbie
  • *
  • Posts: 33
Map Randomizer!
« Reply #9 on: October 12, 2005, 02:33:50 PM »
What about making it so it just picks a random map out of the ones already there? Just an idea. I know I haven't been on IRC much but part of that's because like others I don't like the pure rush that OP2 has turned into and part of it is lack of time.
To the Sky

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Map Randomizer!
« Reply #10 on: October 12, 2005, 02:53:37 PM »
OP2 has not turned into pure rush but like you say your not on irc much so you wouldnt know that.

A script on a website or a script on the bot or a app could be made to pick maps to play randomly.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Map Randomizer!
« Reply #11 on: October 12, 2005, 07:10:45 PM »
Randomly loading an existing map isn't too hard, but you could get odd resource placement. Things like beacons and fumaroles, and all the startup locations/vehicles aren't sotred in the map files. They're stored in the DLLs, and there is no feasible way to read that data directly from a DLL.

... although, now I'm having brainstorms of creating a dummy exe to load the DLLs, call InitProc, and record calls made back to the exe. That way the things like starting conditions are also recorded. But still, it'd be a bit of a pain to implement and use.
 

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Map Randomizer!
« Reply #12 on: October 12, 2005, 07:48:46 PM »
Quote
... although, now I'm having brainstorms of creating a dummy exe to load the DLLs, call InitProc, and record calls made back to the exe. That way the things like starting conditions are also recorded. But still, it'd be a bit of a pain to implement and use.
Hey, you stole my idea!  :heh:

(I had started work on one, but stopped after a while)

There's a couple problems with all that though; you have to deal with things like conditionals (difficulty setting changing the beacons), etc.

Offline Hooman

  • Administrator
  • Hero Member
  • *****
  • Posts: 4955
Map Randomizer!
« Reply #13 on: October 12, 2005, 07:53:39 PM »
Quote
There's a couple problems with all that though; you have to deal with things like conditionals (difficulty setting changing the beacons), etc.
Yes, I had considered that. If things are fixed for a given difficulty setting, then you can just loop through the settings and get values for each. But if things are randomized at all, you're probably only going to get partial information. I guess you can always iterate things a few times to get as many possible outputs as you can. (Heh, funny thing about probabilistic algorithms. If you want to better your chances of getting good output, just iterate them a few times. You can usually get very good results with a modest number of iterations.)
 

Offline Flanx

  • Newbie
  • *
  • Posts: 33
Map Randomizer!
« Reply #14 on: October 12, 2005, 09:52:55 PM »
Just to clarify my statement of multiplayer turned into rush every game I played set up through IRC was on Pie Chart (the original one) and wound up being "who can get microwave lynxes first." Rather a turn off for somebody that enjoys longer games with more strategy than get a basic weapon on a basic chassis and go blow people up.
Just my 2 bits.
To the Sky

Offline Stormy

  • Hero Member
  • *****
  • Posts: 678
    • http://www.op3game.net
Map Randomizer!
« Reply #15 on: October 12, 2005, 10:22:40 PM »
Quote
Just to clarify my statement of multiplayer turned into rush every game I played set up through IRC was on Pie Chart (the original one) and wound up being "who can get microwave lynxes first." Rather a turn off for somebody that enjoys longer games with more strategy than get a basic weapon on a basic chassis and go blow people up.
Just my 2 bits.
I'm just like you, however I have played pie a lot, and I can keep up with maybe the average player, so that's my tidbits :P
`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·
3D artist in Blender, MS3D, and Terragen.
Trying to get good with Scene composition and lighting.

Offline Freeza-CII

  • Administrator
  • Hero Member
  • *****
  • Posts: 2308
Map Randomizer!
« Reply #16 on: October 13, 2005, 02:09:31 AM »
All these lengthy post when all you needed to say it cant be done right now but I sure cant wait for it lol

Offline Mez

  • Hero Member
  • *****
  • Posts: 648
Map Randomizer!
« Reply #17 on: October 13, 2005, 04:21:09 PM »
perhaps the randomiser could be a sep exe?

like u run the random.exe select the settings on the say VB / C++ page difficult day night and res level.  then click next, it created the random.map and random.dll file in the op2 folder.  You then create a multiplayer game and select the 'random' map off the list.


the only problem is how to tell the non host op2 versions which map, difficulty and night settings to use.

perhaps the dll the randomiser creats thells the other clients to load a specific dll and map i dont know if this is possible im just giving an alternative view.
perhaps the simlple on is to just use a completely external program that creats the random.map and .dll, you then send it over irc etc to the peron you are playing against, they stick it in their op2 folder, restart op2 and select the random.map

the map/dll will then load the same one regard les sof difficlulty/ settings in the op2 seletion.



basically

External prog launched first: you set up dmap, difficulty etc
click button it creates random.dll and random.map  (later could connect to clients and send them map over op2 udp port 48000 ?) the random lient at the other end would then put this file in the op2 folder, launch op2 and auto connect to the ip addy it recieved the file from)
then loads op2
you select the random map from the list
play op2

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3093
Map Randomizer!
« Reply #18 on: October 13, 2005, 04:37:16 PM »
You wouldn't need an external EXE really, it could be even simpler.

Remember the DLL could handle all of it. It can set tiles at runtime so all that is needed is to reference a .map file of the correct size (it doesn't matter what's in it) and the DLL can set the tiles properly at runtime.

The random numbers would work properly since they are the same for all sessions of the game. Difficulty and other game settings would be handled automatically too because the DLL can pull the settings from the game.

The DLL could pop up a dialog at startup to show that it is generating the map, so the users know why it's taking longer than normal.

Offline Leviathan

  • Hero Member
  • *****
  • Posts: 4055
Map Randomizer!
« Reply #19 on: October 14, 2005, 07:54:43 AM »
Flanx its no supprised your turned off by rush games if you like longer games or other game types or whatevea. So just dont play thos type of games!

Find people to play with the settigns you want, and enjoy :) Start a thread or somthing!

That person aint me of chorse ;P