Universe Sandbox

General Category => Everything Else => Topic started by: Bla on October 28, 2011, 03:38:53 AM

Title: Map War 3 (WIP)
Post by: Bla on October 28, 2011, 03:38:53 AM
I see Nue began making a program he posted in the Map War 2 topic.
Well I also started one on Tuesday in NetBeans (Java), on that date I learned how to define my own classes.
I'll need to learn a lot of more things before I can make it even close to a game. We haven't learned anything about graphics yet.

Here's the code so far:

Main file (MapWar3.java):
Code: [Select]
// Made by Bla.
package map.war.pkg3;
public class MapWar3
{
    public static void main(String[] args)
    {
        // Make the user's nation, let the user give it a name, name the leader and give the nation 5 resources.
        java.util.Scanner tastatur = new java.util.Scanner(System.in);
        Nation Nat1;
        Nat1 = new Nation();
        System.out.print("Write the name of your nation and press enter: ");
        Nat1.Name = tastatur.next();
        System.out.print("What is your name, mighty ruler of "+Nat1.Name+"? ");
        Nat1.Ruler = tastatur.next();
        System.out.println("Your name is "+Nat1.Ruler+".");
        Nat1.Resources = 5;

        // Generate 7 to 16 other nations.
        int NationNumber;
        NationNumber = (int)(Math.round((Math.random())*9+7));
        System.out.println("Number of other nations: "+NationNumber);
    }
}

Nation class file (Nation.Java):
Code: [Select]
package map.war.pkg3;
public class Nation
{
    public String Ruler;
    public String Name;
    public double Zones;
    public double Resources;
    public double Technology;
    public double Trade;
    public double SeaBases;
    
    public double Production()
    {
        double Prod;
        Prod = ((Zones - SeaBases) + (Resources) + (Trade / 5) + (Math.pow(Technology,0.6)));
        return Prod;
    }  
}

So I'll update this post with progress.
Other attempts to make this game are also welcome in this thread.
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on October 28, 2011, 06:24:35 AM
So my further additions to "Map War 2: the Game" should be posted here?
Title: Re: Map War 3 (WIP)
Post by: Bla on October 28, 2011, 06:42:27 AM
Yes, I think so, or in a seperate topic if you prefer that.
Title: Re: Map War 3 (WIP)
Post by: Darvince on October 28, 2011, 07:13:58 AM
wtf i don't even
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on October 28, 2011, 10:44:54 AM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '45930'.

Title: Re: Map War 3 (WIP)
Post by: Bla on October 28, 2011, 10:46:38 AM
Thanks, right now I don't know anything about graphics, but I will probably read the chapters about interfaces and graphics some day.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on October 28, 2011, 10:47:11 AM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '45933'.

Title: Re: Map War 3 (WIP)
Post by: Bla on October 28, 2011, 12:53:59 PM
I read a few things in the book

Main
Code: [Select]
// Made by Bla.
package map.war.pkg3;
public class MapWar3
{
    public static void main(String[] args)
    {
        // Make the user's nation, let the user give it a name, name the leader and give the nation 5 resources.
        java.util.Scanner tastatur = new java.util.Scanner(System.in);
        Nation Nat1;
        Nat1 = new Nation();
        System.out.print("Write the name of your nation and press enter: ");
        Nat1.Name = tastatur.next();
        System.out.print("What is your name, mighty ruler of "+Nat1.Name+"? ");
        Nat1.Ruler = tastatur.next();
        System.out.println("Your name is "+Nat1.Ruler+".");
        Nat1.Resources = 5;

        // Generate 7 to 16 other nations.
        int NationNumber;
        NationNumber = (int)(Math.round((Math.random())*9+7));
        System.out.println("Number of other nations: "+NationNumber);
        Nation[] Nat = new Nation[NationNumber];
       
        //Choose a random, premade map.
        Map WorldMap;
        WorldMap = new Map();
    }
}

Nation class - same as before, just removed "public" before the variables, because they are public by default.

Map class
Code: [Select]
package map.war.pkg3;
import java.awt.*;
public class Map extends Frame
{
    String MapName;
}
Not much yet...

And I just made an interface, but Idk what to do at all.
Code: [Select]
package map.war.pkg3;
public interface Interface
{
    //public void setPosition(0,0);
   
    //public void draw(Graphics g);
}
Title: Re: Map War 3 (WIP)
Post by: deoxy99 on October 28, 2011, 02:37:10 PM
Okay, a generator in Dwarf Fortress for names goes like this. It takes a dictionary of words, with their translations into Dwarven language, and combines these words (like Dakri Bowapple) and translates them into it...

You could probably try to find that dictionary, and use it for your own purposes. :P
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on October 28, 2011, 02:46:36 PM
Yes, I think so, or in a seperate topic if you prefer that.
I don't think we really need separate topics, although what if your game or mine finishes first? The "(WIP)" or the lack thereof would not count for mine :P
Title: Re: Map War 3 (WIP)
Post by: matty406 on October 28, 2011, 02:59:12 PM
Okay, a generator in Dwarf Fortress for names goes like this. It takes a dictionary of words, with their translations into Dwarven language, and combines these words (like Dakri Bowapple) and translates them into it...

You could probably try to find that dictionary, and use it for your own purposes. :P
Pretty much, and, as it happens, I have a copy here.
There's also Elf, Human and Goblin name banks. They're phenomenally in depth. (So much so I can even generate rude names in the languages :P)
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on October 28, 2011, 08:26:52 PM
Bla, if you were to describe your flag (your avatar one) and how it describes your nation, how would you do so? I'd like to put that in the game on the selection screen even though it has little relevance to the game itself.

Also, if anyone else would like to describe theirs it'd be useful to me as well.

The screen below is probably the starting screen as it will be when released... Unless someone decides to change their flag...  :-\

And also the .exe for today... which I'll probably stop uploading because... idk exactly.
Title: Re: Map War 3 (WIP)
Post by: Bla on October 29, 2011, 12:32:59 AM
Nice.
(Btw, it's the Blaxian Space State, but just use "Blaland" instead).

Flag: The green color represents the enlightment our people gains from Science, the cyan color represents the Technology it gives our people and the blue color represents the bright Future of our state.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on October 29, 2011, 02:47:15 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '46003'.

Title: Re: Map War 3 (WIP)
Post by: atomic7732 on October 29, 2011, 03:47:30 PM
I realized that last night. You'll be added when I get around to working on the game for today.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on December 24, 2011, 06:35:13 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '50666'.

Title: Re: Map War 3 (WIP)
Post by: Bla on January 12, 2012, 11:37:18 AM
So we have to make a graphics journal/report, so I chose Map War 2 as the project I wanted to make for it (considered a galaxy image generator, but I have more of an itch to make progress on Map War 2, I've worked on it during most of the breaks since I chose it as my project :P).

Right now, the map is a square divided into smaller squares... It has to be either 1x1, 2x2, 3x3, 4x4, 5x5, 6x6 and so on... So far, all you can do is setting the name of your nation and your leader (which doesn't affect gameplay anyway :P) and choose which zone you want to start on. Then the game will paint that zone red. Which I just chose to be the national color of nation 1. Then it makes 3-5 other nations which don't do anything yet anyway. But I set up the turn and round structure which automagically adapts to the number of nations. And each second, it tells me what round and turn it is, which is very relaxing.

I bet I'll have to make the zones a two-dimensional array *rageragerage*.

Here's the code and a skreenshawt:

Code: (Main class) [Select]
package mapwar2;
import java.awt.Color;
public class MapWar2
{
    public static void main(String[] args)
    {
        //Make the user's nation, let the user give it a name, name the leader and give the nation 5 resources.
        java.util.Scanner tastatur = new java.util.Scanner(System.in);
        Nation Nat1;
        Nat1 = new Nation();
        Nat1.NatColor = Color.red;
        System.out.print("Write the name of your nation and press enter: ");
        Nat1.Name = tastatur.next();
        System.out.print("What is your name, mighty leader of "+Nat1.Name+"? ");
        Nat1.Leader = tastatur.next();
        Nat1.Resources = 5;

        //Generate 2 to 5 other nations.
        int NationNumber;
        NationNumber = (int)(Math.round((Math.random())*4+2));
        System.out.println("Number of other nations: "+NationNumber);
        Nation[] Nat = new Nation[NationNumber-1];
        
        //Create the map.
        Map Map = new Map();
        Map.addZones();
        
        Map.zRepaint = false;
        GraphicsWindow window = new GraphicsWindow(); //Creates the graphics window.
        window.setSize(Map.sqrtZoneNumber*101+19,Map.sqrtZoneNumber*101+39); //Sets the size of the window.
        window.setTitle("Map War 2"); //Sets the title of the window.
        window.setVisible(true); //Shows the window.
        
        for (int Round=1;;Round++) //Rounds loop
        {
            for (int Turn=1;Turn<NationNumber+1;Turn++) //Turns loop
            {
                System.out.println("It is now round "+Round+", turn "+Turn); //Shows the current round and turn.
                if (Round == 1 && Turn == 1) //The first turn in the game...
                {
                    System.out.println("Type the x coordinate of the zone you want to start on (starts at 0) and press Enter. Then type the y coordinate and press Enter.");
                    Map.xstart = tastatur.nextInt();
                    Map.ystart = tastatur.nextInt();
                    Map.zRepaint = true;
                }
                try {Thread.sleep(1000);} catch (Exception e) {}
            }
        }
    }
}

Code: (Graphics window class) [Select]
package mapwar2;
import java.awt.*;
public class GraphicsWindow extends Frame
{
    public void paint(Graphics g)
    {
        //Draw background.
        g.fillRect(8, 28, Map.sqrtZoneNumber*101+3, Map.sqrtZoneNumber*101+3);
        
        //Draw initial zones on map.
        g.setColor(Color.WHITE);
        for (int i=0; i<Map.ZoneNumber; i++)
        {
            g.fillPolygon(Map.z[i].Shape);
        }
        
        for(;;)
        {
            if (Map.zRepaint == true)
            {
                g.setColor(Color.red);
                g.fillPolygon(Map.z[(Map.sqrtZoneNumber*Map.ystart+Map.xstart)].Shape);
                Map.zRepaint = false;
            }
        }
    }
}

Code: (Nation class) [Select]
package mapwar2;
import java.awt.*;
public class Nation
{
    String Leader;
    String Name;
    Color NatColor; //National color
    double Zones;
    double Production;
    double Resources;
    double Technology;
    double Trade;
    
    double CityLvl1; //Costs 4 resources, gives 1 production.
    double CityLvl2; //Costs 7 resources, gives 2 production.
    double CityLvl3; //Costs 13 resources, gives 4 production.
    double CityLvl4; //Costs 25 resources, gives 8 production.
    double CityLvl5; //Costs 50 resources, gives 20 production.
    
//Calculates the production of a nation.
    double Production()
    {
        double Prod;
        Prod = Zones + CityLvl1 + (2 * CityLvl2) + (4 * CityLvl3) + (8 * CityLvl4) + (20 * CityLvl5);
        return Prod;
    }
    
//Calculates the resources of a nation, should be done once a turn.
    double Resources()
    {
        double Res;
        Res = Production + Resources + (Trade / 5) + (Technology / 10) - (Resources * Resources / 1000);
        return Res;
    }

Code: (Map class) [Select]
package mapwar2;
public class Map
{
    public static int ZoneNumber = 25; //Number of zones on the map. Must be the result of squaring an integer.
    public static int sqrtZoneNumber = (int)Math.round(Math.sqrt(ZoneNumber)); //Used for determining zones pr. map height/width.
    public static int ZoneReference = 0; //References which zone in the zone array methods should be called on.
    public static Zone[] z = new Zone[ZoneNumber]; //Creates the array of zones.
    public static boolean zRepaint;
    public static int xstart;
    public static int ystart;
    
    //Adds zones to the map:
    public static void addZones()
    {
        for (int i=0; i<sqrtZoneNumber; i++)
        {
            for (int k=0; k<sqrtZoneNumber; k++)
            {
                z[ZoneReference] = new Zone();
                z[ZoneReference].setShape();
                z[ZoneReference].Shape.translate(101*i, 101*k);
                ZoneReference++;
            }
        }
    }
}[/quote]

[quote=Zone class]package mapwar2;
import java.awt.*;
public class Zone extends Polygon
{  
    public String Owner;
    public Polygon Shape;
    
    public Polygon setShape()
    {
        Polygon s = new Polygon();
        s.addPoint(10, 30);
        s.addPoint(110, 30);
        s.addPoint(110, 130);
        s.addPoint(10, 130);
        Shape = s;
        return s;
    }
    
    public void claim(String claimer, Nation Nat)
    {
        Owner = claimer;
        Nat.Resources = Nat.Resources - 5;
        Nat.Production ++;
    }
}

Oh and also, teachers can scan our documents for being similar to content on the internet, so I guess I'll be convicted and eternally banned from educat-ions for plagiarizing from myself now. Kol.
Title: Re: Map War 3 (WIP)
Post by: Bla on April 24, 2012, 12:27:24 PM
A snall smapshot of the progress, I'll make the code public when summer vakashunz because skool is skary and I'm afraid of blagiarizing from myshelf.
(The production in the bottom is not correct on the snapshot, because I didn't set the program to calculate the production during turns. I have fixed this now.)

Enemies do claim zones, conquer zones and build infrastructure. So far I haven't tried losing, though, they're pretty random.

The nation and leader names are randomly taken from two .txt files. In the first line, they contain a number of how many names they contain (one pr. line). If you just write the correct number of names, you can basically enter as many custom names as you want in the files and the program will pick and combine them randomly for the AI nations.
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on April 24, 2012, 03:49:35 PM
Awesome. I should maybe attempt Project Geodash again...
Title: Re: Map War 3 (WIP)
Post by: blotz on April 24, 2012, 04:22:51 PM
uh, i hope that that is just a behind-the-scene thingy.
Title: Re: Map War 3 (WIP)
Post by: Darvince on September 14, 2012, 09:00:00 PM
plagarizing yourself? what is this i don't even
Title: Re: Map War 3 (WIP)
Post by: deoxy99 on September 14, 2012, 09:33:39 PM
This don't I even what is.
Title: Re: Map War 3 (WIP)
Post by: Bla on September 15, 2012, 02:14:29 AM
plagarizing yourself? what is this i don't even
My teachers wouldn't know if I was Bla on this forum. They'd scan the report to see if something like that is on the internet. If they found all the code on the internet I don't think they would be amused. They might not even check this forum but just see that x% of the report matched internet stuff.
Title: Re: Map War 3 (WIP)
Post by: Hellpotatoe on September 15, 2012, 03:22:15 AM
Hey, were's Iz-Lato Flags? :P
Oh, i don't make any flags to them...
Okay  :(
Title: Re: Map War 3 (WIP)
Post by: Darvince on October 27, 2012, 08:02:05 PM
sugg
Title: Re: Map War 3 (WIP)
Post by: Darvince on August 11, 2013, 08:08:37 PM
sugg
Title: Re: Map War 3 (WIP)
Post by: Bla on November 09, 2013, 01:29:03 PM
Vh seems good at Python, would he be interested in a collaborative Map War 3 Python development possibly? Anyone else maybe?

My other question would be, would Python be a good language to write the game in? (Otherwise we should find the language that would be best to use, I have most experience with Java)

Some of the biggest problems I had with the Java thing was that I had no clue how I could ever make it generate anything like the complex zone shapes we have on our maps, but that would be a nice thing to do.
Hexagonal zones could be an improvement over the square ones if we couldn't figure out a way to build the complex ones. Ideally I would want the game to randomly generate complex maps similar to the ones we use, but that would probably require a lot of programming skills.

With square or hexagonal it could at least assign random features to the zones, like mountains or water.

And I never got around to try making an interface in Java, but it seems possible. Idk if Python is good for that.
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on November 09, 2013, 02:29:22 PM
python is possible but i've heard from kip tkinter is impossible and idk about pygame but that might be possible

(protip: i have and have used pygame, but only a little bit)
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on November 09, 2013, 02:49:24 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '112648'.

Title: Re: Map War 3 (WIP)
Post by: vh on November 09, 2013, 03:23:26 PM
python is possible but i've heard from kip tkinter is impossible and idk about pygame but that might be possible

(protip: i have and have used pygame, but only a little bit)

tkinter isn't too bad actually. just need to organize code well and understand it

Vh seems good at Python, would he be interested in a collaborative Map War 3 Python development possibly? Anyone else maybe?

My other question would be, would Python be a good language to write the game in? (Otherwise we should find the language that would be best to use, I have most experience with Java)

Some of the biggest problems I had with the Java thing was that I had no clue how I could ever make it generate anything like the complex zone shapes we have on our maps, but that would be a nice thing to do.
Hexagonal zones could be an improvement over the square ones if we couldn't figure out a way to build the complex ones. Ideally I would want the game to randomly generate complex maps similar to the ones we use, but that would probably require a lot of programming skills.

With square or hexagonal it could at least assign random features to the zones, like mountains or water.

And I never got around to try making an interface in Java, but it seems possible. Idk if Python is good for that.

tkinter (a python gui thingy), allows images polygons, and getting the clicked shape

about generating maps, it could be done with voronoi cells

anyways if you're interested sure why not. we should find a good online code editor with maybe syntax highlighting, non-laggyness, and search/replace.

also an outline of the structure of the program would be good.

since the game is now processing all the turns, the players will probably be less inclined to check the map. there should be a way to prevent modifications to the game save or whatever.

there could be a server that computes the resources and everything. manipulating sockets in python is relatively pain-free.
or maybe the map is sort of savefile, and an interface allows each player to issue orders, saved as another turnfile. then a public piece of code modifies the savefile according to each turnfile in the player order.



Title: Re: Map War 3 (WIP)
Post by: Bla on November 09, 2013, 03:51:40 PM
I hadn't thought it into detail like that, in fact I was just thinking of making it a single-player game to begin with, but a multiplayer option would be cool too.

Anyway cool, it sounds like Python is the best language to use, so let's settle on that and search for a good online text editor.

Inb4 Google document
Title: Re: Map War 3 (WIP)
Post by: blotz on November 09, 2013, 04:08:11 PM
like google docs for python?
http://google.com (http://google.com)
bam http://pythonfiddle.com/ (http://pythonfiddle.com/)
but idk how it's going to like pop up a map it's probably wrong but oh well
edit: nvm ninjahed
Title: Re: Map War 3 (WIP)
Post by: vh on November 09, 2013, 04:09:52 PM
ai would be tricky for single player. how do you propose that be worked out.

a stack overflow question reccomends collabedit as a decent collaborative code editor. lets use that for now, it's easy to switch anytime

http://collabedit.com/hw5ue (http://collabedit.com/hw5ue)
Title: Re: Map War 3 (WIP)
Post by: vh on November 09, 2013, 04:12:22 PM
on second thought, collabedit may not be the best way to collaborate. unless the entire thing will go into one file, which seems unwieldy and confusing, multiple files will be needed. maybe github is a better alternative, once i figure out how it works.
Title: Re: Map War 3 (WIP)
Post by: Bla on November 09, 2013, 04:19:27 PM
AI for single player, well I worked a simple AI into the java project I made that is basically just something like "claim adjacent empty zones" then "conquer adjacent enemy zones until I run out of resources" mixed with "build cities on my own zones" I think. A genious AI isn't too important for me, you can just adjust the difficulty by adding more enemies or maybe give the others an income boost etc.

I thought of working out something like a war toggle, so that by default, the other nations wouldn't attack you unless the war toggle came on, but never made that.
Title: Re: Map War 3 (WIP)
Post by: Bla on November 09, 2013, 04:31:17 PM
I think I just made a project on GitHub

https://github.com/Red-Rainbow/MapWar3

Feel free to try joining/editing, or create a user and tell me your user if you want me to add you, if that's required.

https://help.github.com/articles/set-up-git
https://help.github.com/articles/be-social
Title: Re: Map War 3 (WIP)
Post by: blotz on November 09, 2013, 04:43:27 PM
oops i just like made a fork or something idk what
you cn like delete it if you can see it
but i didn't pull it or something
Title: Re: Map War 3 (WIP)
Post by: Bla on November 09, 2013, 04:44:24 PM
I'm making an organization called MapWar 3, the project should be under that one instead I think, then cooperating should be easier. Setting it up.

Edit:

https://github.com/MapWar3
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 05:50:27 AM
I think I'll give vh the power to take most decisions about the program planning and stuff, because vh knows much more about Python than I do, so you can choose how you want the program to be planned, which files we should use and create files etc. whenever you want.

I think it would be cool to have both a singleplayer and multiplayer option, but that singleplayer is most important - if vh is mostly interested in Multiplayer I could focus on SP and he could focus on MP.
In some areas, they will overlap, I'm not sure how to plan that most efficiently, maybe it would be best to develop them as pretty much two completely separate games inside one.

Files that I think we'll need are
Options.txt - a simple text file people can edit to change their preferences, in my Java project, this is how it looked:

Code: (Options.txt) [Select]
Turn Break Time = 1000
Show Advanced Turn Info = n
Nation Name Type = Community/Earthly
Leader Name Type = Community/Earthly
National Color = red

LeaderNames.txt - a file to store some leader names that the AI players will randomly pick, in the Java project, this was its contents (the first line was the number of names it contained):

Code: (LeaderNames.txt) [Select]
9
Bla
Atomic
Naru
Matty
Kipz
Deoxy
Fiah
Darvince
Quontex

NationNames.txt - a file to store nation names for AI players, here's the contents from the Java project:
Code: (NationNames.txt) [Select]
18
Blaist Blaland
Solea and Rift Auspikitan
Bielosia
Ethanthova
Starrie
Spheron Rilmu
Aeridani
Kaeshar
Darvincia
Socialist Republic of Yukidar
Kaktoland
Epicland
Awesomeland
Ampluterra
Desertopia
Quontia
Socialist State of Spheron
Vinelandar

Here is the code for the Java Map War 3 after I stopped working on it:
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 05:53:54 AM
Code: (MapWar2.java) [Select]
package mapwar2;
import java.awt.*;
import java.io.*;
public class MapWar2
{
    public static int Turn=1;
    public static int Round=1;
   
    public static void main(String[] args) throws IOException
    {
        // Generate 3 to 6 nations, including the player's.
        int NationNumber;
        NationNumber = (int)(Math.round((Math.random())*3+3));
        Nation[] Nat = new Nation[NationNumber];
        for (int natGen=0 ; natGen<NationNumber ; natGen++)
        {
            Nat[natGen] = new Nation();
        }
       
        //Make the user's nation and let the user give it and its leader a name.
        java.util.Scanner tastatur = new java.util.Scanner(System.in);
        Nat[0].NatColor = Color.red;
        System.out.print("Type the name of your nation and press enter: ");
        Map.input = tastatur.nextLine();
        Nat[0].Name = Map.input;
        System.out.print("What is your name, mighty leader of "+Nat[0].Name+"? ");
        Map.input = tastatur.nextLine();
        Nat[0].Leader = Map.input;
       
        // Read nation names from NationNames.txt and give the AI nations random names.
        FileReader NationReader = new FileReader("NationNames.txt");
        BufferedReader inNR = new BufferedReader(NationReader);
       
        String lineNR = inNR.readLine();
        int NationNameNumber = Integer.parseInt(lineNR);
        String[] NationNames = new String[NationNameNumber];
        for (int i=0 ; i<NationNameNumber ; i++)
        {
            NationNames[i] = inNR.readLine();
        }
        for (int i=0 ; i<NationNumber ; i++)
        {
            if (Nat[i].Name == null)
            {
                Nat[i].Name = NationNames[(int)(NationNameNumber*(Math.random()))];
            }
            for (int k=0 ; k<i ; k++)
            {
                if (Nat[i].Name.equals(Nat[k].Name))
                {
                    Nat[i].Name = null;
                    i--;
                    k=i;
                }
            }
        }
       
        // Read leader names from LeaderNames.txt and give the leaders of AI nations random names.
        FileReader LeaderReader = new FileReader("LeaderNames.txt");
        BufferedReader inLR = new BufferedReader(LeaderReader);
       
        String lineLR = inLR.readLine();
        int LeaderNameNumber = Integer.parseInt(lineLR);
        String[] LeaderNames = new String[LeaderNameNumber];
        for (int i=0 ; i<LeaderNameNumber ; i++)
        {
            LeaderNames[i] = inLR.readLine();
        }
        for (int i=0 ; i<NationNumber ; i++)
        {
            if (Nat[i].Leader == null)
            {
                Nat[i].Leader = LeaderNames[(int)(LeaderNameNumber*(Math.random()))];
            }
            for (int k=0 ; k<i ; k++)
            {
                if (Nat[i].Leader.equals(Nat[k].Leader))
                {
                    Nat[i].Leader = null;
                    i--;
                    k=i;
                }
            }
        }
       
        //Create the map.
        Map Map = new Map();
        Map.addZones();
       
        GraphicsWindow window = new GraphicsWindow(); //Create the graphics window.
        window.setSize(Map.sqrtZoneNumber*101+19,Map.sqrtZoneNumber*101+91); //Set the size of the window.
        window.setTitle("Map War 2"); //Sets the title of the window.
        window.setVisible(true); //Shows the window.
       
        rounds:for (;;Round++)
        { //Rounds loop.
            for (;Turn<NationNumber+1;Turn++)
            { //Turns loop.
                Map.mRepaint = true; //Repaint the entire map.
               
                //Calculate production and resources.
                Nat[Turn-1].calcProduction();
                Nat[Turn-1].calcResources();
               
                if (Round == 1)
                { //The first round in the game.
                    if (Turn == 1)
                    { //The first turn in the game. Lets the player claim one empty zone.
                        System.out.println("Type the x coordinate of the zone you want to start on (starts at 1 from upper left corner) and press Enter. Then type the y coordinate and press Enter.");
                        try
                        { //Lets the user type the x-coordinate of the first zone.
                            Map.xZone = tastatur.nextInt();
                        }
                        catch (Exception e)
                        { //Chooses a random x-coordinate if the user did not type an integer.
                            Map.Trash = tastatur.next();
                            Map.xZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                            System.out.println("Not an integer. Choosing a random x-coordinate: "+Map.xZone);
                        }
                        try
                        { //Lets the user type the y-coordinate of the first zone.
                            Map.yZone = tastatur.nextInt();
                        }
                        catch (Exception e)
                        { //Chooses a random y-coordinate if the user did not type an integer.
                            Map.Trash = tastatur.next();
                            Map.yZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                            System.out.println("Not an integer. Choosing a random y-coordinate: "+Map.yZone);
                        }
                        Map.xZone--; Map.yZone--; //Decrements because coordinates start at 1, but arrays start at 0.
                        Map.cSetter = Nat[0].NatColor;
                        Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].claim(Nat[0]); //Claims the zone.
                        //Setting the tech rate:
                        System.out.println("How many of your resources do you want to spend on technology for the next five turns? (In %, integer between 1 and 25)");
                        try
                        {
                            Nat[Turn-1].TechRate = tastatur.nextInt();
                        }
                        catch (Exception e)
                        { //Sets the tech rate to 5% if the user didn't type an integer.
                            Map.Trash = tastatur.next();
                            Nat[Turn-1].TechRate = 5;
                            System.out.println("Not an integer. Your tech rate has been set to 5%.");
                        }
                        if (Nat[Turn-1].TechRate < 1)
                        { //Sets the tech rate up to 1%, if the user typed a number less than 1.
                            Nat[Turn-1].TechRate = 1;
                            System.out.println("Your tech rate has been set up to 1%.");
                        }
                        else if (Nat[Turn-1].TechRate > 25)
                        { //Sets the tech rate down to 25%, if the user typed a number greater than 25.
                            Nat[Turn-1].TechRate = 25;
                            System.out.println("Your tech rate has been set down to 25%.");
                        }
                    }
                    else
                    { //During the first round, the other AI nations claim random, empty zones.
                        Nat[Turn-1].NatColor = Color.getHSBColor((float)Math.random(), (float)Math.random(), (float)Math.random()*256); //Gives AI nations random national colors.
                        Map.cSetter = Nat[Turn-1].NatColor;
                        for (;Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].Owner != null;)
                        { //The loop ensures that the claimed zone is empty. The code inside picks the zone.
                            Map.xZone = (int)(Math.random()*Map.sqrtZoneNumber);
                            Map.yZone = (int)(Math.random()*Map.sqrtZoneNumber);
                        }
                        Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].claim(Nat[Turn-1]); //Claims the zone.
                        Nat[Turn-1].TechRate = (int)(Math.random()*6+5); //Sets tech rate randomly between 5% and 10%.
                        System.out.println(Nat[Turn-1].Name+" set their tech rate to "+Nat[Turn-1].TechRate+"%.");
                    }
                }
               
                else
                { //Not the first round in the game.
                    System.out.println("Round: "+Round+", Turn: "+Turn+". "+Nat[Turn-1].Name+" may spend 5 + "+Nat[Turn-1].Production+" + "+Nat[Turn-1].prevResources+" + "+Nat[Turn-1].Technology / 10+" - "+(Nat[Turn-1].prevResources^2)/1000+" = "+Nat[Turn-1].Resources+" resources."); //Shows turn info.
                    Map.cSetter = Nat[Turn-1].NatColor; //Paints with national color of the active nation.
                   
                    //Stores statistics on the nation in publicly available objects.
                    Map.Nat0Production = Nat[0].Production;
                    Map.Nat0Zones = Nat[0].Zones;
                   
                    if (Turn == 1)
                    { //Player turns.
                        System.out.println((int)Math.round(Nat[Turn-1].Resources * Nat[Turn-1].TechRate / 100)+" resource(s) were spent on technology."); //Shows how many resources they player spent on technology.
                       
                        //Stores statistics on the nation in publicly available objects.
                        Map.Nat0Technology = Nat[0].Technology;
                        Map.Nat0Resources = Nat[0].Resources;
                       
                        boolean zoneUpgrade = true;
                        zU:while (zoneUpgrade = true)
                        { //Lets the player upgrade zones. Breaks if the answer is not y.
                            System.out.println("Do you want to upgrade infrastructure on a zone?");
                           
                            String s = tastatur.next();
                            String t = "n";
                            if (s.equals(t)) {zoneUpgrade = false; break zU;}
                            System.out.println("Type the coordinates of the zone you want to develop:");
                            try
                            { //Lets the user type the x-coordinate of the first zone.
                                Map.xZone = tastatur.nextInt();
                            }
                            catch (Exception e)
                            { //Chooses a random x-coordinate if the user did not type an integer.
                                Map.Trash = tastatur.next();
                                Map.xZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                                System.out.println("Not an integer. Choosing a random x-coordinate: "+Map.xZone);
                            }
                            try
                            { //Lets the user type the y-coordinate of the first zone.
                                Map.yZone = tastatur.nextInt();
                            }
                            catch (Exception e)
                            { //Chooses a random y-coordinate if the user did not type an integer.
                                Map.Trash = tastatur.next();
                                Map.yZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                                System.out.println("Not an integer. Choosing a random y-coordinate; "+Map.yZone);
                            }
                            Map.xZone--; Map.yZone--; //Decrements because coordinates start at 1, but arrays start at 0.
                            Map.ZoneReference = Map.yZone*Map.sqrtZoneNumber+Map.xZone;
                            Map.z[Map.ZoneReference].buildCity(Nat[Turn-1]);
                            Map.mRepaint = true;
                           
                            //Stores statistics on the nation in publicly available objects.
                            Nat[0].calcProduction();
                            Map.Nat0Production = Nat[0].Production;
                            Map.Nat0Resources = Nat[0].Resources;
                            Map.Nat0Zones = Nat[0].Zones;
                        }
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 05:54:59 AM
Continued
Code: [Select]
                        boolean zoneClaim = true;
                     zC:while (zoneClaim = true)
                        { //Lets the player claim zones. Breaks if the answer is not y.
                            System.out.println("Do you want to claim a zone? (y/n)");
                            String u = tastatur.next();
                            String v = "n";
                            if (u.equals(v)) {zoneClaim = false; break zC;}
                            System.out.println("Type the coordinates of the zone you want to claim:");
                            try
                            { //Lets the user type the x-coordinate of the first zone.
                                Map.xZone = tastatur.nextInt();
                            }
                            catch (Exception e)
                            { //Chooses a random x-coordinate if the user did not type an integer.
                                Map.Trash = tastatur.next();
                                Map.xZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                                System.out.println("Not an integer. Choosing a random x-coordinate: "+Map.xZone);
                            }
                            try
                            { //Lets the user type the y-coordinate of the first zone.
                                Map.yZone = tastatur.nextInt();
                            }
                            catch (Exception e)
                            { //Chooses a random y-coordinate if the user did not type an integer.
                                Map.Trash = tastatur.next();
                                Map.yZone = (int)((Math.random()*Map.sqrtZoneNumber)+1);
                                System.out.println("Not an integer. Choosing a random y-coordinate; "+Map.yZone);
                            }
                            Map.xZone--; Map.yZone--; //Decrements because coordinates start at 1, but arrays start at 0.
                            Map.cSetter = Nat[Turn-1].NatColor;
                            Map.ZoneReference = Map.yZone*Map.sqrtZoneNumber+Map.xZone;
                            for (int k=0;k<Map.ZoneNumber;k++)
                                {
                                    if (Map.z[Map.ZoneReference].border(Map.z[k]) == true && Map.z[k].Owner == Nat[Turn-1])
                                    { //Checks if the claimed zone borders the nation.
                                        if (Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].Owner == null)
                                        { //If nobody owns the zone.
                                            Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].claim(Nat[0]); //Claims the zone.
                                           
                                            //Stores statistics on the nation in publicly available objects.
                                            Map.Nat0Production = Nat[0].Production;
                                            Map.Nat0Resources = Nat[0].Resources;
                                            Map.Nat0Zones = Nat[0].Zones;
                                        }
                                        if (Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].Owner != null && Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].Owner != Nat[0])
                                        { //If another nation owns the zone.
                                            System.out.println("Another nation owns the zone. Do you want to attack it? (y/n)");
                                            String s2 = tastatur.next();
                                            String t2 = "y";
                                            if (s2.equals(t2))
                                            { //Conquers the zone.
                                                Map.z[Map.yZone*Map.sqrtZoneNumber+Map.xZone].claim(Nat[0]);
                                            }
                                        }
                                    if (Map.z[Map.ZoneReference].Owner != Nat[Turn-1])
                                    {
                                    System.out.println("You cannot claim the zone because you don't border it.");
                                    }
                                }
                            }
                        }
                        if (Nat[0].Zones == Map.ZoneNumber)
                        { //The player has all the zones and wins.
                            break rounds;
                        }
                        if (Round % 5 == 0)
                        { //On round 5, 10, 15, 20, 25... Let the player set their tech rate.
                            System.out.println("How many of your resources do you want to spend on technology for the next five turns? (In %, integer between 1 and 25)");
                            try
                            {
                                Nat[Turn-1].TechRate = tastatur.nextInt();
                            }
                            catch (Exception e)
                            { //Sets the tech rate to 5% if the user didn't type an integer.
                                Map.Trash = tastatur.next();
                                System.out.println("Not an integer. Your tech rate has not been changed.");
                            }
                            if (Nat[Turn-1].TechRate < 1)
                            { //Sets the tech rate up to 1%, if the user typed a number less than 1.
                                Nat[Turn-1].TechRate = 1;
                                System.out.println("Your tech rate has been set up to 1%.");
                            }
                            if (Nat[Turn-1].TechRate > 25)
                            { //Sets the tech rate down to 25%, if the user typed a number greater than 25.
                                Nat[Turn-1].TechRate = 25;
                                System.out.println("Your tech rate has been set down to 25%.");
                            }
                        }
                    }
                   
                    else
                    { //AI turns.
                        boolean zC = false;
                        while (Nat[Turn-1].Resources >= 5 && Map.ZoneNumber > Map.ClaimedZones)
                        { //The nation usually claims empty zones while they have more than 5 resources and the map has unclaimed zones.
                            search:for (int j=0;j<Map.ZoneNumber;j++)
                            { //Chooses a random zone.
                                Map.ZoneReference = (int)(Math.random()*Map.ZoneNumber);
                               
                                if (j>20) {break search;} //The AI nation will stop trying to find an empty zone if it fails 20 times.
                               
                                for (int k=0;k<Map.ZoneNumber;k++)
                                {
                                    if (Map.z[Map.ZoneReference].border(Map.z[k]) == true && Map.z[k].Owner == Nat[Turn-1] && Map.z[Map.ZoneReference].Owner == null)
                                    { //Checks if the claimed zone borders the nation.
                                        zC = true; break search;
                                    }
                                }
                            }
                           
                            if (zC = true)
                            { //Claims the zone.
                                Map.z[Map.ZoneReference].claim(Nat[Turn-1]);
                            }
                        }
                       
                        for (int x=Nat[Turn-1].Zones; x>0; x--)
                        { //Randomly develops cities in AI nations.
                            Map.ZoneReference = (int)(Math.random()*Map.ZoneNumber);
                            if (Map.z[Map.ZoneReference].Owner == Nat[Turn-1])
                            {
                                Map.z[Map.ZoneReference].buildCity(Nat[Turn-1]);
                            }
                        }
                       
                        while (Nat[Turn-1].Resources >= 10)
                        { //If the nation cannot find empty zones to claim, it attacks enemy zones.
                            search:for (int j=0;j<Map.ZoneNumber;j++)
                            { //Chooses a random zone.
                                Map.ZoneReference = (int)(Math.random()*Map.ZoneNumber);
                               
                                if (j>20) {break search;} //The AI nation will stop trying to find an empty zone if it fails 20 times.
                               
                                for (int k=0;k<Map.ZoneNumber;k++)
                                {
                                    if (Map.z[Map.ZoneReference].border(Map.z[k]) == true && Map.z[k].Owner != Nat[Turn-1])
                                    { //Checks if the claimed zone borders the nation.
                                        zC = true; break search;
                                    }
                                }
                            }
                           
                            if (zC = true)
                            { //Claims the zone.
                                Map.z[Map.ZoneReference].claim(Nat[Turn-1]);
                               
                                //Stores statistics on the user's nation in publicly available objects.
                                Map.Nat0Production = Nat[0].Production;
                                Map.Nat0Resources = Nat[0].Resources;
                                Map.Nat0Zones = Nat[0].Zones;
                            }
                        }
                        if (Round % 5 == 0)
                        { //On round 5, 10, 15, 20, 25... The AI sets their tech rate.
                            Nat[Turn-1].TechRate = (int)(Math.random()*25+1); //Sets tech rate randomly between 1% and 25%.
                            System.out.println(Nat[Turn-1].Name+" set their tech rate to "+Nat[Turn-1].TechRate+"%.");
                        }
                    }
                }
                try {Thread.sleep(1000);} catch (Exception e) {} //Wait.
            }
            Turn = 1;
        }
        System.out.println("You win!");
    }
}
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 05:55:39 AM
Code: (GraphicsWindow.java) [Select]
package mapwar2;
import java.awt.*;
public class GraphicsWindow extends Frame
{
    public void paint(Graphics g)
    {
        for(;;)
        { //Updates the graphical window.
            if (Map.mRepaint == true)
            { //Updates the entire map.
                //Draw background.
                g.setColor(Color.BLACK);
                g.fillRect(8, 30, Map.sqrtZoneNumber*101+3, Map.sqrtZoneNumber*101+3);

                //Draw empty zones on map.
                g.setColor(Color.WHITE);
                for (int i=0; i<Map.ZoneNumber; i++)
                {
                    g.fillPolygon(Map.z[i].Shape);
                }
               
                for (int i=0; i<Map.sqrtZoneNumber; i++)
                { //y coordinate loop for drawing zones on the map.
                    for (int k=0; k<Map.sqrtZoneNumber; k++)
                    { //x coordinate loop for drawing zones on the map.
                        if (Map.z[i*Map.sqrtZoneNumber+k].Owner != null)
                        {
                            g.setColor(Map.z[i*Map.sqrtZoneNumber+k].Owner.NatColor);
                            g.fillPolygon(Map.z[i*Map.sqrtZoneNumber+k].Shape);
                        }
                        if (Map.z[i*Map.sqrtZoneNumber+k].cityLevel > 0)
                        {
                            g.setColor(Color.BLACK);
                            g.drawString("C"+Map.z[i*Map.sqrtZoneNumber+k].cityLevel, (k*101)+50, (i*101)+88);
                        }
                    }
                }
               
                //Draw bottom panel.
                g.setColor(Color.RED);
                g.fillRect(8, Map.sqrtZoneNumber*101+33, Map.sqrtZoneNumber*101+3, 50);
                g.setColor(Color.BLACK);
                g.drawString("Map War 2", 13, Map.sqrtZoneNumber*101+48);
                g.drawString("Your zones: "+Map.Nat0Zones, 13, Map.sqrtZoneNumber*101+68);
                g.drawString("Production: "+Map.Nat0Production, 113, Map.sqrtZoneNumber*101+68);
                g.drawString("Technology: "+Map.Nat0Technology, 213, Map.sqrtZoneNumber*101+68);
                g.drawString("Resources: "+Map.Nat0Resources, 313, Map.sqrtZoneNumber*101+68);
               
                Map.mRepaint = false;
                //try {Thread.sleep(100);} catch (Exception e) {} //Wait.
                //Map.mRepaint = true;
            }
        }
    }
}


Code: (Map.java) [Select]
package mapwar2;
import java.awt.Color;
public class Map
{
    public static int ZoneNumber = 49; //Number of zones on the map. Must be the result of squaring an integer.
    public static int ClaimedZones = 0; //Number of claimed zones. Changes during the game.
    public static int sqrtZoneNumber = (int)Math.round(Math.sqrt(ZoneNumber)); //Used for determining zones pr. map height/width.
    public static int ZoneReference = 0; //References which zone in the zone array methods should be called on.
    public static Zone[] z = new Zone[ZoneNumber]; //Creates the array of zones.
    public static boolean mRepaint;
    public static int xZone;
    public static int yZone;
    public static Color cSetter;
    public static String Trash = new String(); //If the user types integers wrongly, they are put in this string to clear tastatur.nextInt().
    public static String input = new String(); //Keyboard input is stored in this string.
   
    //Publicly available ints used to display statistics in the graphics window.
    public static int Nat0Technology;
    public static int Nat0Production;
    public static int Nat0Zones;
    public static int Nat0Resources;
   
    //Adds zones to the map:
    public static void addZones()
    {
        for (int i=0; i<sqrtZoneNumber; i++)
        { //y coordinate loop for adding zones on the map.
            for (int k=0; k<sqrtZoneNumber; k++)
            { //x coordinate loop for adding zones on the map.
                z[ZoneReference] = new Zone();
                z[ZoneReference].conqCost = 10;
                z[ZoneReference].setShape();
                z[ZoneReference].Shape.translate(101*k, 101*i);
                ZoneReference++;
            }
        }
    }
}
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 05:56:11 AM
Code: (Nation.java) [Select]
package mapwar2;
import java.awt.*;
public class Nation
{
    String Leader; //Name of the leader of the nation.
    String Name; //Name of the nation.
    Color NatColor; //National color.
    int Zones; //Number of zones owned by the nation.
    int Production; //Production of the nation.
    int cityProduction; //Production of city infrastructure in the nation.
    int Resources; //Number of resources owned by the nation.
    int prevResources; //The amount of resources which were not spent last round.
    int Technology; //The amount of technology owned by the nation.
    int TechRate; //Percentage of resources spent on technology at the start of the turn, from 1% to 25%.
    int Trade; //Production of nations trading with the nation.
    
    void calcProduction()
    { //Calculates the production of a nation.
        Production = Zones + cityProduction;
    }
    
    void calcResources()
    { //Calculates how many resources a nation can spend at the start of a turn, and spends some of the resources on technology based on the tech rate.
        prevResources = Resources;
        Resources = 5 + (int)Math.round(Production + Resources + (Trade + Technology) / 10 - (Resources * Resources / 1000));
        int Tech = (int)Math.round(Resources * TechRate / 100); //The amount of technology which the nation gets this turn.
        Technology = Technology + Tech; //Adds the tech to the total amount of tech the nation has.
        Resources = Resources - Tech; //Subtracts the tech which the nation got this turn from the the number of resources.
    }
}

Code: (Zone.java) [Select]
package mapwar2;
import java.awt.*;
public class Zone extends Polygon
{
    public Nation Owner;
    public Polygon Shape;
    public int conqCost; //The amount of resources it costs to conquer the zone
    public int cityLevel; //The level of the city infrastructure on the zone. 0 by default.
    public int nextCityCost; //The cost of upgrading the city infrastructure to the next level.
    public int nextCityTechRequirement; //The required technology needed to upgrade a city to the next level. The technology is kept when upgrading.
    
    public Polygon setShape() //Method for setting the shape of a zone.
    {
        Polygon s = new Polygon();
        s.addPoint(10, 32);
        s.addPoint(110, 32);
        s.addPoint(110, 132);
        s.addPoint(10, 132);
        Shape = s;
        return s;
    }
    
    public boolean border(Zone z)
    { //Method which checks if two zones border each other.
        boolean border = false;
        int borderingPoints = 0;
        
        for (int i=0;i<Shape.npoints;i++)
        { //Runs through all the points in the original zone.
            int x1 = Shape.xpoints[i];
            int y1 = Shape.ypoints[i];
            
            for (int k=0;k<z.Shape.npoints;k++)
            { //Runs through all the points in the zone which the original one is being compared to.
                int x2 = z.Shape.xpoints[k];
                int y2 = z.Shape.ypoints[k];
                //Calculates the distance between the x- and y-coordinates which are being compared in the zones:
                int xdiff = x2 - x1;
                int ydiff = y2 - y1;
                
                if (xdiff < 2 && xdiff > -2)
                { //Checks if the x-coordinates are less than two pixels apart.
                    if (ydiff < 2 && ydiff > -2)
                    { //Checks if the y-coordinates are less than two pixels apart.
                        borderingPoints++;
                        if (borderingPoints == 2)
                        { //Sets border to true if two points have passed the test.
                            border = true;
                        }
                    }
                }
            }
        }
        return border;
    }
    
    public void claim(Nation Nat)
    { //Method for claiming a zone.
        if (Owner == null)
        { //If nobody owns the zone.
            if (Nat.Resources >= 5)
            { //If the claimer has at least 5 resources.
                Owner = Nat;
                Nat.Resources = Nat.Resources - 5;
                Nat.Zones++;
                Map.mRepaint = true;
                Map.ClaimedZones++;
                if (Nat.Zones == 1)
                {
                    System.out.println(Nat.Leader+" established "+Nat.Name+".");
                }
                else
                {
                    System.out.println(Nat.Name+" claimed an empty zone.");
                }
            }
            else
            { //If the claimer doesn't have enough resources to claim the zone.
                System.out.println("You don't have enough resources to claim the zone.");
            }
        }
        else
        { //If another nation owns the zone.
//            System.out.println("Owner is not null."); //Debug
            if (Nat.Resources >= conqCost)
            { //If the claimer has at least 10 resources.
                String Victim = Owner.Name;
                Owner.Zones --;
                if (cityLevel > 0)
                { //If the city infrastructure is above level 0, update the city production of the nation which lost the zone.
                    Owner.cityProduction = Owner.cityProduction - (int)(Math.pow(2, (cityLevel))-1);
                }
                Owner = Nat;
                Nat.Resources = Nat.Resources - conqCost;
                Nat.Zones ++;
                if (cityLevel > 0)
                { //If the city infrastructure is above level 0, it loses one level when conquered.
                    cityLevel--;
                    conqCost = (int)(Math.round(10*Math.pow(1.8, (cityLevel))));
                    Nat.cityProduction = Nat.cityProduction + (int)(Math.pow(2, (cityLevel))-1);
                }
                Map.mRepaint = true;
                System.out.println(Nat.Name+" conquered a zone from "+Victim);
            }
            else
            { //If the claimer doesn't have enough resources to conquer the zone.
                if (MapWar2.Turn == 1)
                {
                    System.out.println("You don't have enough resources to conquer the zone.");
                }
//                else
//                {
//                    System.out.println("AI nation tried to conquer an enemy zone, but didn't have enough resources."); //Debug
//                }
            }
        }
    }
    
    public void buildCity(Nation Nat)
    { //Method for building/upgrading city infrastructure.
        if (Owner == Nat)
        { //Nations can only upgrade their own cities.
            nextCityCost = (int)(Math.pow(2, (cityLevel+2))); //Calculates the cost of upgrading the city.
            nextCityTechRequirement = (int)(Math.pow(2, (2*cityLevel-1))); //Calculates how much technology is needed to upgrade the city.
            if (Nat.Resources >= nextCityCost)
            { //Checks if the nation has enough resources to upgrade the city infrastructure.
                if (Nat.Technology >= nextCityTechRequirement)
                { //Adds the city level, updates conquest cost of the zone and the nation's resources and city production if the nation has enough technology.
                    Nat.Resources = Nat.Resources - nextCityCost;
                    cityLevel++;
                    conqCost = (int)(Math.round(10*Math.pow(1.8, (cityLevel))));
                    Nat.cityProduction = Nat.cityProduction + (int)(Math.pow(2, (cityLevel-1)));
                    System.out.println(Nat.Name+" upgraded city infrastructure to level "+cityLevel+".");
                }
                else
                { //Tells the user if it doesn't have enough technology to upgrade the city infrastructure.
                    if (MapWar2.Turn == 1) System.out.println("You need "+nextCityTechRequirement+" technology to upgrade the city infrastructure, but you only have "+Nat.Technology+".");
                }
            }
            else
            { //Tells the user if it doesn't have enough resources to upgrade the city infrastructure.
                if (MapWar2.Turn == 1) System.out.println("You need "+nextCityCost+" resources to upgrade the city infrastructure, but you only have "+Nat.Resources+".");
            }
        }
        else
        { //Tells the user if it chose a zone it doesn't own.
            if (MapWar2.Turn == 1) System.out.println("You can only upgrade cities inside your nation.");
        }
    }
}

PS: I just tried running it and the map isn't rendering stuff so kol
/abandon
Title: Re: Map War 3 (WIP)
Post by: Bla on November 10, 2013, 08:21:29 AM
And the development has begun!

https://github.com/MapWar3/MapWar3
Title: Re: Map War 3 (WIP)
Post by: vh on November 11, 2013, 04:29:18 AM
no time to commit and push so this is the explanation of why i changed what i did

i used settings.py rather than a text file because what if you need to store a list of values instead of just numbers
for example, the price of cities might be 1, 3, 5, 12, 20, 80, 100, and you can store that just by saying
cityprice = [1,3,5,12,20,80,100]
if you want to create the first ten powers of two for city prices you might say
cityprice = [2**x for x in range(10)]
which will make a list [1,2,4,8,16,32,64,128,256,512]
while you can do all this with a textfile and some string manipulation, i think it is a bit simpler with a .py file

initializer just creates a nation file for now. if you run order.py though, it should first initialize the nation file, then run all the rounds.

edit: ok order.py works. it asks you for the debug mode twice but besides that it works.
Title: Re: Map War 3 (WIP)
Post by: Bla on November 11, 2013, 04:41:05 PM
I still feel a bit lost in the project, but do you have some suggestions for what we could work on?
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on November 11, 2013, 04:48:48 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '112740'.

Title: Re: Map War 3 (WIP)
Post by: vh on November 11, 2013, 05:59:40 PM
i made a diagram of how the files might work together to make it clearer.
https://github.com/MapWar3/MapWar3/blob/master/layout.png

as for what we could work on next, i guess the zones would be a good starting point.
by that i mean the points used to generate the polygonal zones. this is pretty much algorithmic, so everyone knows as much as i do here. figure out how to generate points and group them into lists. once you have the list of points it's straightforward to draw the polygons.

maybe create a class for zones. attributes like structures, type, owner, list of points, adjacent zones, etc. an id attribute would be very useful

add attributes to the nation class like owned zones, at war with, etc.

then let the processor read in turn files and modify the nation files. for example, a turnfile that says a nation has conquered zone 1 and 2, the processor would add zones 1 and 2 to the nation's list of zones.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on November 11, 2013, 06:59:21 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '112747'.

Title: Re: Map War 3 (WIP)
Post by: vh on November 11, 2013, 07:03:10 PM
i was thinking something with voronoi cells. they look nice, are polygonal, and non regular. almost like the map war 2 maps.

they're a bit tricky to code though.

i guess there isn't anything wrong with a hex grid or a square grid, but if there's nothing else to do a better map would be cool.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on November 11, 2013, 07:30:18 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '112749'.

Title: Re: Map War 3 (WIP)
Post by: Darvince on November 11, 2013, 07:37:05 PM
or you could get a "drawer" to draw lots and lots of maps (basic, without unit zones)
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on November 11, 2013, 08:05:13 PM
I like the options for all three. Maybe some default maps (a few of the map war 2 games and earth or something?)
Title: Re: Map War 3 (WIP)
Post by: Bla on November 12, 2013, 03:48:15 AM
Looks nice
http://en.wikipedia.org/wiki/Voronoi_diagram (http://en.wikipedia.org/wiki/Voronoi_diagram)

I think it's best to focus on voronoi cell maps to begin with, if we make code that is compatible with that, it should be compatible with generating square and hex maps as well.

And important part is how we'll check whether two zones border, I never got that to work properly in the Java program I made, but the code I tried to write there I think I made flexible enough to apply to maps with all kinds of polygons and not just squares.
What we need is to check whether zones have at least two points that are a part of both zones' edge, so that squares don't connect diagonally.
Title: Re: Map War 3 (WIP)
Post by: Bla on November 12, 2013, 11:19:57 AM
I found this project with publicly available code, maybe we could draw some inspiration from it for our map generation.

http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/ (http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/)
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/#source (http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/#source)
https://github.com/amitp/mapgen2 (https://github.com/amitp/mapgen2)

It also uses the voronoi diagram method. The Appendix: References also has sources to other sites that could be useful.

This page also has info on voronoi diagrams:
http://www.gamedev.net/topic/576541-voronoi--worley-noise-knowlege-dump/ (http://www.gamedev.net/topic/576541-voronoi--worley-noise-knowlege-dump/)

This page has example code to generate a voronoi diagram:
http://rosettacode.org/wiki/Voronoi_diagram#Python (http://rosettacode.org/wiki/Voronoi_diagram#Python)

The code requires PIL, which is available here:
http://www.pythonware.com/products/pil/ (http://www.pythonware.com/products/pil/)
Title: Re: Map War 3 (WIP)
Post by: vh on November 12, 2013, 01:24:27 PM
interesting.

here's a thread on how we could possibly figure out which cells are adjacent
http://stackoverflow.com/questions/9651940/determining-and-storing-voronoi-cell-adjacency (http://stackoverflow.com/questions/9651940/determining-and-storing-voronoi-cell-adjacency)

to store adjacency, i think we should consider networkx, a python module
http://networkx.github.io/ (http://networkx.github.io/)
the module has many algorithms implemented like shortest path, minimum spanning tree (all good for AI and even human use).
Title: Re: Map War 3 (WIP)
Post by: vh on November 16, 2013, 08:50:42 AM
huh.
the code for map generation you uploaded won't work well.

it uses brute force to compute the nearest point and color it. this doesn't scale well. On a 200x400 pixel image with 400 points, this can take a minute or so. on a 2000x2000 pixel image with 400 points, it might take an hour.

an hour isn't too bad if you don't need to generate a bunch of maps -- we could even pregenerate the maps so that the user can select one rather than having to create one

The problem is that we never really 'get' the cells. we've colored an image, but we don't know which cells are adjacent or what the real boundaries are. we'll have to store all the cell values for each pixel and search for it every time the user clicks. this is somewhat sloppy and might be slow. in addition, searching for adjacent cells or the distance from one cell to another seems like a huge nightmare. you'd have to look at every pixel and it's adjacent pixels.

luckily scipy can solve both these problems for us. i'm implementing a solution
Title: Re: Map War 3 (WIP)
Post by: Bla on November 16, 2013, 03:08:18 PM
Good, feel free to change it however you want.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 02, 2016, 04:03:35 PM
Some extremely basic restart work on Map War 3. Uses Python 2.7 and Pygame.
http://www.pygame.org/wiki/GettingStarted

https://github.com/MapWar3/MapWar3/tree/2016

(http://i.imgur.com/g3atMLi.png)
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 02, 2016, 04:24:30 PM
cute
Title: Re: Map War 3 (WIP)
Post by: blotz on July 03, 2016, 07:50:28 AM
i has added a coordinate tracker, dont forget to git pull
Title: Re: Map War 3 (WIP)
Post by: Bla on July 03, 2016, 08:29:30 AM
Nice jobes. Not sure if we need the coords displayed but good to see it works relative to the window and not entire display. I'm thinking we should see if we can get some buttons to work, coordinate detection probably wouldn't be needed for that though.
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on July 03, 2016, 09:32:42 AM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '172559'.

Title: Re: Map War 3 (WIP)
Post by: Bla on July 03, 2016, 02:27:39 PM
I added a button function, maybe the next goal could be to set up a second screen after clicking the start button, adding a quit button or whatever. I've been following some of these videos and it describes how the button could start e.g. the main game loops, with rounds and turns.

https://www.youtube.com/watch?v=P-UuVITG7Vg
Title: Re: Map War 3 (WIP)
Post by: blotz on July 04, 2016, 08:25:28 AM
something really weird was going on with the button, i think it was the fact that my mouse position displayer was wiping the screen black every loop, so that bugged it up a lot. so i fix'ed that part and commented it out, as long as a few other things, also the button you made it display the rectangle on the picture but i switched it so it would be on the screen so now it works and we have 1 button declaration in the whole thing instead of like 2 so it's nice and working

ok added a second screen that works
Title: Re: Map War 3 (WIP)
Post by: Bla on July 04, 2016, 10:04:13 AM
Good jobes. I was working on it earlier today but let's just continue on your work. I added a quit button and got stuck at an image of Seb Castro for second screen.

I added the quit button now to both screens. On the second screen, there's a problem with it, seems to be related to mousePos not updating after going to the second screen.
I'm thinking of just letting the "startGame" variable for action be changed to a more general button action, because it would work for any button to make the button return 1 when clicked, and cause that to run some code that starts game, changes settings or quits or whatever.



I think maybe the next goal could be to find a way to make a map or something... This is the really hard part...

We'd probably need a screen to set up the game after the intro screen, so the second one could also divert the player to a third screen that actually has the game/map.

Maybe a zone could work slightly like a button. In a basic version of the game, each zone could just be a rectangle with similar functionality to a button.

I will try to work a bit on this just to see how it goes.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 04, 2016, 03:08:10 PM
Now the program has very basic gameplay.
No AIs currently, but you can win by claiming every zone to make Seb proud. Who wouldn't want that?

(http://i.imgur.com/IsPflp6.png)
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on July 04, 2016, 03:26:35 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '172619'.

Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 04, 2016, 03:34:38 PM
Kol. I would have done the same.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 04, 2016, 03:35:41 PM
Lots of work to do:

- Add settings, e.g. national color, map size, number of players, to the settings screen
- Add a way to check if zones border each other, based on the coordinates of their edges. Ideally this can be extended to non-rectangular zones in the future.
- Add a way to develop and show infrastructure on the zones
- Add a way to set tech rate every 5 rounds and in the beginning (maybe the settings screen)
- Add nation and player names
- Add AIs and options to conquer zones
- Make the game show your production, zones, resources etc. on the screen with the map, for easy reference
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 04, 2016, 08:07:50 PM
this looks cute so far
Title: Re: Map War 3 (WIP)
Post by: Bla on July 05, 2016, 05:12:42 AM
Progress

Also an idea: Right-mouse clicking zones should show info on them, e.g. conquest cost.

(http://i.imgur.com/dAVZual.png)

(http://i.imgur.com/uPc2srK.png)
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 05, 2016, 07:42:21 AM
cute

the map looks suspiciously square though :P
Title: Re: Map War 3 (WIP)
Post by: Bla on July 05, 2016, 01:03:30 PM
Just think of it as one giant city all the players get to upgrade different levels of simultaneously
Title: Re: Map War 3 (WIP)
Post by: blotz on July 05, 2016, 04:50:21 PM
generating dynamic maps is hard, i've been thinking about it and we might need some fancy polygon work for it to happen
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on July 05, 2016, 06:27:27 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '172656'.

Title: Re: Map War 3 (WIP)
Post by: blotz on July 05, 2016, 07:03:33 PM
http://www-cs-students.stanford.edu/~amitp/game-programming/polygon-map-generation/

at a second glance... (https://github.com/amitp/mapgen2/blob/master/Map.as) uhh
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 05, 2016, 09:39:42 PM
Code: [Select]
import voronoimapgenerator as vmg
Title: Re: Map War 3 (WIP)
Post by: Darvince on July 05, 2016, 10:04:43 PM
imapge
Title: Re: Map War 3 (WIP)
Post by: Bla on July 07, 2016, 05:19:18 PM
Updated: Now checks for adjacent zones

https://github.com/MapWar3/MapWar3

(http://i.imgur.com/YUekHiD.png)
Title: Re: Map War 3 (WIP)
Post by: Bla on July 08, 2016, 03:46:10 PM
Today's update: Added nation names (can't be entered yet), statistics overview (in the future, the button can be clicked for a full view and nations will be sorted in the list, probably showing only the top 5 in some stat in the game view). Reduced how big the zones are and increased the max number of zones, increased max number of nations to 11 and made the map size and nation number buttons depend on each other (e.g. can't make the map hold fewer zones than there are nations, or set it to more nations than there are zones).

(http://i.imgur.com/UnA8eaq.png)

(http://i.imgur.com/Ay0yNMc.png)

(http://i.imgur.com/JPUniNm.png)

(http://i.imgur.com/mpA0dSW.png)
Title: Re: Map War 3 (WIP)
Post by: tuto99 on July 08, 2016, 03:50:29 PM
>Blaland has to win of course

btw really cool game you are making.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 08, 2016, 04:27:28 PM
Thank yous
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 08, 2016, 07:47:08 PM
amazing

you're making progress really fast
Title: Re: Map War 3 (WIP)
Post by: Bla on July 09, 2016, 03:57:57 PM
Thanks

Added spectator mode, picking national color, nation name, ruler. Increased max map size to 32x30, made it scale with different sizes and max players to 17. Made the statistics sort. Made it possible to go back to intro screen after finishing games. Introduced an autogo button to automatically advance rounds if you're defeated.

(http://i.imgur.com/SxX78WZ.png)

Here's a big game Darvincia won.

(http://i.imgur.com/EXTMEcE.png)

(http://i.imgur.com/NTHmgrN.png)

(http://i.imgur.com/aHFRjSh.png)
Title: Re: Map War 3 (WIP)
Post by: Darvince on July 09, 2016, 04:08:49 PM
kaktoland, the greatest universalis nation
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 10, 2016, 12:55:44 AM
some dead people have one province

(https://i.gyazo.com/331d33b6a8ad39d3fa5e88b11bdc4351.png)
Title: Re: Map War 3 (WIP)
Post by: Bla on July 10, 2016, 07:15:45 AM
That looks strange. Haven't seen that happen.

It should be prevented in the next update, even though it's a bit strange and may give some other minor problems.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 10, 2016, 01:04:05 PM
Today's update adds statistics with several different graphs you can view in-game (haven't put numbers/info on the axes yet) and stealing tech + resources when you fully conquer a country.

(http://i.imgur.com/clVYyZC.png)

(http://i.imgur.com/wIsOJfd.png)
Title: Re: Map War 3 (WIP)
Post by: tuto99 on July 10, 2016, 01:07:01 PM
who is pink? who is green? who is blue? you should still make dead nations colored so we know which nations are which (imo)
Title: Re: Map War 3 (WIP)
Post by: Bla on July 10, 2016, 01:15:45 PM
I was thinking the same. Added an update that still keeps the nation name colored.

Edit: Added water zones and an option to pick the percentage of zones to be water. Right now they can't be claimed.
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 10, 2016, 04:05:34 PM
why is the water percent so low
Title: Re: Map War 3 (WIP)
Post by: Bla on July 10, 2016, 04:10:09 PM
why is the water percent so low
Currently you can't claim water zones, so I set it low so there's a low chance of land zones getting surrounded by water, which would make the game impossible to win.

Also optimized the AI so it won't try to claim/conquer zones on the map multiple times anymore.
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 10, 2016, 06:11:49 PM
ok

here: ethanthova has no provinces, but exists

(https://i.gyazo.com/1163ad97fff7706a1c09295636fba623.png)

i think what might have happened is it died (i killed it) and it took its next turn thinking it had just started the game?

idk i just barely noticed it
Title: Re: Map War 3 (WIP)
Post by: vh on July 10, 2016, 06:51:08 PM
proposal for new mechanic:
Code: [Select]
[18:35] <+syule> every player gets a special zone
[18:35] <+syule> which starts on their first zone
[18:35] <+syule> and they can move it once each turn to an adjacent zone
[18:36] <+syule> and all construction and attacks on the zones on and adjacent to your special zone have half cost

the motivation:
Code: [Select]
[18:30] <+syule> one thing which is missing from map war 3
[18:30] <+syule> well map war in general
[18:30] <+syule> which might be interesting to add
[18:30] <+syule> but also might be bad to add
[18:30] <+syule> for reasons
[18:30] <+syule> which i will specify shortly
[18:30] <+syule> is logistics
[18:30] * Stowaway screams
[18:30] <+syule> like currently, if you have resources
[18:30] <+syule> you can move them anywhere instantly
[18:31] <+syule> you can build a city and attack a zone instantly
[18:31] <+syule> there's no need to strategize your logistics
[18:32] <+syule> with some game settings, warlight can do this really well
[18:32] <+syule> with the logistics of moving your armies
[18:32] <+syule> but i'm pretty sure we don't want to make map war a warlight clone
[18:32] <+syule> so how can this be done effectively but with a simple mechanic
[18:32] <Stowaway> logistics and infrastructure makes me wet but having to meticulously manage it in games kills me
[18:32] <Stowaway> liek in Wargame
[18:33] <+syule> yeah so the idea here is to make it a very simple mechanic without much micromanagement
[18:33] <+syule> but still maintain the strategy which it creates
[18:33] <+Yqt1001> sounds impossible
[18:34] <Floenne> uh
[18:34] <Floenne> i think
[18:34] <Tuto> which makes it really cool but
[18:34] <Floenne> board games can only get so complicated
[18:34] <Floenne> if you want to add logistics
[18:34] <Floenne> you need to start automating things
[18:34] <Floenne> start coding
[18:34] <Floenne> to keep track oveverything
[18:34] <+syule> >yes that's why i emphasized a simple mechanic
[18:34] <+syule> >to simulate logistics

details:
Code: [Select]
[18:36] <Floenne> interesting
[18:36] <Floenne> what happens if someone conquers the special zone
[18:36] <Floenne> anything?
[18:37] <+syule> the zone has to stay on your territory
[18:37] <+syule> so if it's captured you have to move it to you zone which is closest to it during your next turn
[18:37] <+syule> and if multiple are tied for closes you get to pick
[18:38] <+syule> although to prevent rule clutter
[18:38] <+syule> you might just let that special zone be anywhere at all
Title: Re: Map War 3 (WIP)
Post by: Bla on July 11, 2016, 08:36:50 AM
i think what might have happened is it died (i killed it) and it took its next turn thinking it had just started the game?

idk i just barely noticed it
I think I've fixed it for the next update I'll upload. Now players will only become dead if there are no unclaimed zones.

proposal for new mechanic:
Cool, thanks. I think it would be better to start by implementing the gameplay from Map War 2 before adding logistics, but maybe afterwards. But then I think something like armies would probably work better and seem more realistic than special zones like that. Maybe require that, to conquer zones, you need to spend resources on military forces you deploy to fight or something.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 11, 2016, 04:27:23 PM
Today's update adds extractors with the 4 upgradeable levels and sea bases, and there's no longer a harsh limit on the fraction of sea zones, other than there always being at least one land zone per player.
Also added the option to change tech rates, and set AIs to change theirs randomly.

https://github.com/MapWar3/MapWar3/tree/2016

(http://i.imgur.com/c1LXhwT.png)
Title: Re: Map War 3 (WIP)
Post by: blotz on July 11, 2016, 05:32:13 PM
Kool
Title: Re: Map War 3 (WIP)
Post by: atomic7732 on July 11, 2016, 05:57:19 PM
problems: there's no "not enough tech" message if you don't have enough tech

also if someone takes one of my level 2 production extractors and i take it back two things can happen. if i take click in the area of the extractor, it automatically upgrades (presumably one level) but it actually displays that it's level 2, instead of level 1. same thing happens if you only claim the zone and then upgrade the extractor afterward.

also, i just moved some of the nation names around in mapwar3.py so that their colors matched better

it'd be nice to have some sort of permanent or completely random association of the nation name, color, and ruler (for example storing them in a list of tuples, but then that would be the permanent route)

but i didn't want to mess with anything so i didn't do that
Title: Re: Map War 3 (WIP)
Post by: FiahOwl on July 11, 2016, 06:37:53 PM

This message is only viewable with Universe Sandbox Galaxy Edition. Access it and much more with promo-code '172978'.

Title: Re: Map War 3 (WIP)
Post by: vh on July 12, 2016, 03:30:45 AM
by the way i was going to refactor the code sometime if you guys don't mind because it seems like the entire game is encoded in one huge while loop spanning from like line 200 to 1250

Quote
But then I think something like armies would probably work better and seem more realistic than special zones like that.

right but adding an army system makes it
1. a lot like warlight
2. you have to do a lot more micro-management
3. implementation is a lot more complex

and part of the goal here was to find a simple mechanic to simulate logistics. i think the special zone captures the concept of logistics by rewarding strategic planning of where you want to attack just as well as armies would while being as minimal as possible
Title: Re: Map War 3 (WIP)
Post by: Bla on July 12, 2016, 06:03:24 AM
Maybe we can implement the special zone idea, we can consider that later.

And I agree with moving the code to multiple files probably. You're welcome to try.

Added extractor error msgs + a small delay after clicking zones to solve the problem Atomic mentioned.
And you can make changes to the code if you want, just tell me then I can check the changes on Github, but I may revert if  there are problems with it. Later the plan is to have a txt file with nation, ruler and color combinations.
Title: Re: Map War 3 (WIP)
Post by: Bla on July 12, 2016, 04:41:14 PM
Added cities, except making them cost more to conquer.
Not all zones used to have cities be upgradeable all the way to level 6 either, that's not taken into account either.

(http://i.imgur.com/a5ToTn1.png)
Title: Re: Map War 3 (WIP)
Post by: blotz on July 12, 2016, 07:39:19 PM
should we wipe out master and make 2016 master
Title: Re: Map War 3 (WIP)
Post by: Bla on January 30, 2017, 03:32:16 PM
Added cities, except making them cost more to conquer.
Cities now cost more to conquer depending on their level

Also implemented the military base.

https://github.com/MapWar3/MapWar3/tree/2016