Balanced Map Generator

Discussion in 'General Discussion' started by Archer70, Jan 26, 2018.

  1. Archer70

    Archer70 Cadet

    Posts:
    2
    Joined:
    Jan 22, 2018
    A common problem in 4x-style games is unpredictability in starting position due to a purely random map generator. Obviously starting position is extremely important and the ensuing success or failure in game play is strongly determined by starting position. A player may realize he has a poor starting position and this results in multiple restarts. Conversely, his starting position may be so strong that victory is almost certain. This situation is definitely more enjoyable, but really we would prefer a more balanced start where the player’s choices and strategy determine the outcome. The algorithm I propose in the following paragraphs is an attempt to achieve a balanced start.

    First of all, an algorithm for evaluating a star system must be created. A number is assigned to a system determined by the usefulness to a particular race. For the purposes of this text, a number between zero and hundred is used. Zero is a worthless system and a hundred is optimal. (Any range can be used). The system evaluation takes into account all aspects of the system (planets, resources, asteroid belts and their size, ruins, etc). We will call this algorithm the system evaluator.

    Secondly, an algorithm is created to distribute system values between all the systems within range of the home system. A preset constant is used for each race which depends on the difficulty level chosen by the player. The constants are based on the range of the system evaluator and are the cumulative numbers for all the systems within range determined by the system evaluator. The amount of systems within range will vary. (in this game 2-8.) This algorithm randomly assigns a value to each system, which always sums up to the preset constant. If there a large amount of systems then the systems will be tend to be of a more mediocre variety. If the amount of systems is smaller the systems will be of higher value. For example, there are four systems within range, and the constant value for this race is 200. The values for the systems are randomly determined to be (80,50,30,40) which adds up to 200. Since 50 is the average value, we have one good system, one average system, and two poor systems. We must determine these values before we fill in all aspects of the system. This algorithm will be called the system distributor.

    Now that we have created these two algorithms, we will create the balanced map generator. This generator will appear random, but will create a more controllable start position. There will never be an astoundingly great start position or horribly poor one. First, we call the systems distributor algorithm using the preset constant and number of systems parameters. It returns the values of each system. Next a loop is created. The loop calls the random system generator (which obviously already exists), then calls the system evaluator. If the number returned matches the number generated by the system distributor, then we have found our system. If not, then the loop continues generating the system until the number matches. (If you want to lessen the number of iterations, then add in +/- 5 % error.) This is done for each system within starting range and the balanced start is complete. All other systems within the map can be generated in the usual completely random manner.

    This method of the balanced start gives some interesting possibilities for difficulty levels. The strength of the starting position for each race can be predetermined. On higher difficulty levels the starting positions for enemy races can be comparatively better than the player. And on easy levels one can do the opposite. My guess is giving all races an equal starting position is a mistake. This will lead to a dull, stagnant game. I think you want inequality between races regardless of difficulty level.

    With the pure random start, the weakest races have the worst starting systems. The situation is the same in the balanced start, except with more control.

    It might be advantageous to add weights to the system distributor algorithm. Possibly more weight to the home world, or weights based on the number of systems within range.

    There is also an option of extending the balanced start to the entire map. Systems would be grouped according to the distance from the home worlds possibly in the form of concentric shells. Adjustments would be made when shells overlap between two or more races. This option would add complexity to map generation. Just balancing starting position is a simpler option.

    Master of Orion 2 is one of my all-time favorites! Basing a game on it and then extending it seems to me a great idea. I really like what you have done so far. Keep up the good work!
     
  2. Konstantine

    Konstantine Grand Admiral

    Posts:
    2,200
    Joined:
    Oct 19, 2016
    Welcome aboard @Archer70 (really dig the avatar)
    You have obviously given this some serious thought and I'm wondering, (it's not really clear from your post), have you played ISG? If so, have you tried the various difficulty levels?
    Quite a bit of what you are proposing is being attempted already (though we could still see additional refinements), I'm wondering then how you would rate ISG in this aspect.
     
  3. Archer70

    Archer70 Cadet

    Posts:
    2
    Joined:
    Jan 22, 2018
    I have only played the game three or four times. I assumed a random start and was apparently wrong. My winning or losing seemed to depend a great deal on the quality of the systems. I'm glad your programmers tackled the problem ( which is a difficult one). I may play it some more get back to you on how i rate it in this respect.
     
  4. Konstantine

    Konstantine Grand Admiral

    Posts:
    2,200
    Joined:
    Oct 19, 2016
    I'm not one of the developers sir, and certainly anything but a programmer. In fact, I have no affiliation with the Devs or the company behind this fine game other than volunteering some of my time to test the game and do some minor non-programming work for them so they don't have to expend their limited time and resources in such trivial matters.
    As to the topic at hand, the map generator is not exactly random, especially so in the immediate area around your starting position. On easier settings you will find favorable systems near by and on harder settings less so. This is pretty much the only advantage the AI has over a player on the harder settings, it does not cheat and Adam is very much inclined not to allow that to happen, I admire that.
    By all means, give us your thoughts on the matter, the Devs here thrive on feedback, keep in mind you will soon have Pre-Alpha 10 to play with and it is a vast upgrade, (we are testing it now and I really like what I'm seeing)
     
  5. Adam Solo

    Adam Solo Developer Administrator Grand Admiral

    Posts:
    4,846
    Joined:
    Sep 9, 2016
    Hey Archer70, welcome! One of the two devs of the game here.

    The map isn't completely random, as Konstantine has said, and even less so when the "Balanced start" option is set. With that option on the quality of the start will depend on the difficulty level you choose, from a smoother start with plenty of ideal worlds nearby (and fewer for the AI), on easier difficulty levels, to a very harsh start with only a few ideal worlds around (but plenty for the AI). This is the only advantage the AI gets in higher difficulties. We can consider it a greater challenge for the player, as the game itself is played by the same rules by both the AI and human player from that point forward.

    If one wants a much more unpredictable map, for more randomness and variety, it's just a matter of switching the "Balanced start" option off.

    Let us know what you think of the game, and what you think about the map that is generated.
     

Share This Page