|
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): // 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): 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.
|
|
|
|
|
Logged
|
|
|
|
|
atomic7732
|
 |
« Reply #1 on: October 28, 2011, 06:24:35 AM » |
|
So my further additions to "Map War 2: the Game" should be posted here?
|
|
|
|
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #2 on: October 28, 2011, 06:42:27 AM » |
|
Yes, I think so, or in a seperate topic if you prefer that.
|
|
|
|
|
Logged
|
|
|
|
|
Darvince
|
 |
« Reply #3 on: October 28, 2011, 07:13:58 AM » |
|
wtf i don't even
|
|
|
|
|
Logged
|
|
|
|
|
FiahOwl
|
 |
« Reply #4 on: October 28, 2011, 10:44:54 AM » |
|
I can do graphics art.
|
|
|
|
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #5 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.
|
|
|
|
|
Logged
|
|
|
|
|
FiahOwl
|
 |
« Reply #6 on: October 28, 2011, 10:47:11 AM » |
|
Thanks, right now I don't know anything about graphics, but I will probably read the chapters about interfaces and graphics some day.
Lol.
|
|
|
|
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #7 on: October 28, 2011, 12:53:59 PM » |
|
I read a few things in the book Main // 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 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. package map.war.pkg3; public interface Interface { //public void setPosition(0,0); //public void draw(Graphics g); }
|
|
|
|
|
Logged
|
|
|
|
|
deoxy99
|
 |
« Reply #8 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. 
|
|
|
|
|
Logged
|
|
|
|
|
atomic7732
|
 |
« Reply #9 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 
|
|
|
|
|
Logged
|
|
|
|
|
matty406
|
 |
« Reply #10 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.  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  )
|
|
|
« Last Edit: October 28, 2011, 03:06:08 PM by matty406 »
|
Logged
|
|
|
|
|
atomic7732
|
 |
« Reply #11 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.
|
|
|
« Last Edit: October 28, 2011, 09:29:54 PM by NeutronStar »
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #12 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.
|
|
|
|
|
Logged
|
|
|
|
|
FiahOwl
|
 |
« Reply #13 on: October 29, 2011, 02:47:15 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. YOU FORGOT USAE!!!
|
|
|
|
|
|
atomic7732
|
 |
« Reply #14 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.
|
|
|
|
|
Logged
|
|
|
|
|
FiahOwl
|
 |
« Reply #15 on: December 24, 2011, 06:35:13 PM » |
|
Lovely Progress!
|
|
|
|
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #16 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  ). 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  ) 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: 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) {} } } } } 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; } } } } 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; } 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.
|
|
|
« Last Edit: January 12, 2012, 12:30:18 PM by Bla »
|
Logged
|
|
|
|
|
Bla
|
 |
« Reply #17 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.
|
|
|
« Last Edit: April 24, 2012, 12:39:02 PM by Bla »
|
Logged
|
|
|
|
|
atomic7732
|
 |
« Reply #18 on: April 24, 2012, 03:49:35 PM » |
|
Awesome. I should maybe attempt Project Geodash again...
|
|
|
|
|
Logged
|
|
|
|
|
bong
|
 |
« Reply #19 on: April 24, 2012, 04:22:51 PM » |
|
uh, i hope that that is just a behind-the-scene thingy.
|
|
|
|
« Last Edit: April 24, 2012, 04:28:20 PM by bong »
|
Logged
|
|
|
|
|