A Project of Mine...

Yuri2356

Test Screening
Joined
Aug 1, 2004
Messages
3,415
Location
Great White North
For a high school programming class, I am taking on the challenge of making a basic, no-frills clone of Master of Orion using C++. As such, it would greatly help my work if some of those familiar with the inner workings of this great game could provide me with some of the equations involved in functions like Combat, Growth, Research, and Trade. It would also help if those with prior experience in C++ could point me to some untilities for importing graphics files so they'll be easier to Edit.

I'll use this thread to lay down my plans, announce progress in my work, and when I complete a stable product I'll be sure to post it here for your gaming pleasure and potential comments/criticism.

Wish me luck. :)
 
*Last updated April 21, 2006*

Ok, for Starters this post will be broken down into the major sections on my plan, spoilerized for easy viewing. Each will recive periodic updates as they become availible.

Some sections will be colour coded:
Tentative [Needed]
In progress
Completed
Optional


1. Time Table
Spoiler :
My scedule is tentatively broken into weeks, measured from Mondays to Sundays.

Week 1: (Mar 27 - Apr 2)
-Familiarize myself with C++, get as much of the language in my head as possible before starting anything.

Week 2: (Apr 3 - 9)
-Begin work on Map generator. (Single 10x10 section of space)
-Be able to randomly place planets with fairly even distribution.
-Randomly assign atributes* to each planet.
-Flag one world as a potential start location, and give this world predefined atributes.
(*See Planet Section)


Week 3: (Apr 10 - 16)
-Use map generator to assemble larger maps by creating several 10x10 sections and placing them togeather into a larger square. (end result, a 20x20 'small' map, with four potential start locations)
-Begin writing functions for planet production, growth, and distribution of production. (Building sliders)


Week 4: (Apr 17 - 23)
-Write simple Text/GUI for interacting with the map and planets.
-Bring togeather map generator, interface, and prod. Functions to create a basic turn cycle. [Check growth, make changes, wait for command to carry on, repeat.]
-If Time remains, start work on Ship Class.


Week 5: (Apr 24- 30)
-Allow planet to produce predefined, generic ships, and have each placed in orbit after completion.
-Get ships moving from world to world. [simple relocation]
-Make ship movements take speed into account. [Delay between Depart and arrive, based on distance between planets]
-Enforce Range limits [Will only move if Distance <= X]
-Add ship movements to Turn cycle. [All move simultaneously at 'End' of turn]


Week 6: (May 1-7)
-Create ships with different properties [Fighters, scouts, Colonizers, Warships, etc.]
-Allow players to design basic ships.
-Allow planets to change what ships are being produced.
-Allow player to colonize other worlds.

-Create planetary reserves and Research sliders.


Week 7: (May 8-14)
-Set up basic research w/ generic technology.
-Give techs measurable effects on other aspects of the game [Range, productions, Growth, Speed, Power, etc]
-Allow planetray reserves to be transferred back to planets.
-Set up Second player.



Week 8: (May 15-21)
-Allow fleets to engage in basic Combat. (See Warfare Section)
-Allow for Basic Ground Battles (See Warfare)

-Create tactical Ship combat.
-Create Soldiers, seperate from population.
-Create Military Forts & Missile Bases
-Add Orion, with Guardian.



2. The Map
Spoiler :

As of this moment, the map is stored in its own little class Wherein I can store, access, and manipulate points which are either a 0 (for open space) or an interger (for a planet)

Sample Grids:

A raw, freshly generated map.
Code:
 [0][0][0][0][1][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][1][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][1][0][0][0][0]
[0][0][1][0][0][0][0][0][0][0][0][0][1][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][1][0][0][0][0][1][0][0][0][0][0][1][0][0]
[0][0][0][0][0][0][0][1][0][0][0][0][0][1][0][0][0][0][0][0]
[0][0][0][1][1][0][0][0][0][0][0][0][0][0][0][0][1][0][0][1]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][0][1][0][1][0][0][0][0][0][1][0][0]
[0][0][0][0][0][1][0][0][0][1][0][0][0][0][0][0][0][0][0][0]
[0][0][1][0][0][0][0][0][0][0][0][0][1][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][1][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][1][0][0][1][0][0][0][1][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][1][0][0][0][0][1][0][1][0][0][0][1][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][1][0][0][0][1][0][0][0][0][0][0][0][0][0][0][0][0][1][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][1][0][0][0][1][0][0]
[0][0][1][0][0][0][0][0][0][0][0][0][0][0][0][0][1][0][0][0]

The same map, with planets numbered off.
Code:
[ 0][ 0][ 0][ 0][COLOR="Yellow"][ 1][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][COLOR="Green"][ 2][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Green"][ 3][/color][ 0][ 0][ 0][ 0]

[ 0][ 0][COLOR="Yellow"][ 4][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][B][COLOR="Green"]< 5>[/color][/B][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Green"][ 6][/color][ 0][ 0][ 0][ 0][COLOR="Yellow"][ 7][/color][ 0][ 0][ 0][ 0][ 0][COLOR="Green"][ 8][/color][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Green"][ 9][/color][ 0][ 0][ 0][ 0][ 0][COLOR="Orange"][10][/color][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][11][COLOR="Green"][12][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][B][COLOR="Green"]<13>[/color][/B][ 0][ 0][COLOR="Green"][14][/color]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Red"][15][/color][ 0][COLOR="Orange"][16][/color][ 0][ 0][ 0][ 0][ 0][COLOR="Orange"][17][/color][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][B][COLOR="Green"]<18>[/color][/B][ 0][ 0][ 0][COLOR="Yellow"][19][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][COLOR="Yellow"][20][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Orange"][21][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Green"][22][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][23][ 0][ 0][COLOR="Yellow"][24][/color][ 0][ 0][ 0][COLOR="Orange"][25][/color][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][COLOR="Orange"][26][/color][ 0][ 0][ 0][ 0][COLOR="Orange"][27][/color][ 0][COLOR="Orange"][28][/color][ 0][ 0][ 0][COLOR="Yellow"][29][/color][ 0][ 0][ 0][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]

[ 0][COLOR="Red"][30][/color][ 0][ 0][ 0][COLOR="Yellow"][31][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][B][COLOR="Green"]<32>[/color][/B][ 0]

[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Red"][33][/color][ 0][ 0][ 0][COLOR="Red"][34][/color][ 0][ 0]

[ 0][ 0][COLOR="Green"][35][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][COLOR="Yellow"][36][/color][ 0][ 0][ 0]
Map Key:
Spoiler :

[0] - Space
[#] - Planet
<#> - Start Location

Types: (w/ tentative names)
1 (Terran)
2 (Jungle)
3 (Ocean)
4 (Steppe)

5 (Minimal)
6 (Barren)
7 (Tundra)

8 (Dead)
9 (Inferno)
10 (Radioactive)


Next up, the mapmaking process assigns certain 'natural' values to each of these planets, which will remain constant over the corse of the game. Their locations are recorded, a size given, and a climate type given based on that size. (The larger the world, the better the type. Lower type #s are better than higher #s)

Four are then randomly selected and flagged as Start locations.

Planet Stats from the above map:
Spoiler :
Number Location [x-y] Size Type Flag
0 0-0 0 0 0
1 4-0 85 3 0
2 1-1 95 1 0
3 15-2 90 1 0
4 2-3 55 4 0
5 12-3 100 1 1
6 6-5 85 1 0
7 11-5 80 3 0
8 17-5 95 1 0
9 7-6 95 1 0
10 13-6 65 5 0
11 3-7 30 7 0
12 4-7 85 1 0
13 16-7 100 1 1
14 19-7 70 1 0
15 9-9 10 9 0
16 11-9 30 7 0
17 17-9 60 6 0
18 5-10 100 1 1
19 9-10 50 4 0
20 2-11 75 2 0
21 12-11 50 6 0
22 7-12 75 1 0
23 8-13 60 5 0
24 11-13 75 2 0
25 15-13 60 5 0
26 4-15 20 7 0
27 9-15 45 6 0
28 11-15 55 6 0
29 15-15 75 2 0
30 1-17 25 8 0
31 5-17 50 4 0
32 18-17 100 1 1
33 13-18 20 9 0
34 17-18 20 9 0
35 2-19 70 1 0
36 16-19 45 4 0

And a screenshot of how it looks at the moment:
Spoiler :

Behold, ASCII in all its glory.
Map_Display_1g.gif

(Text in Yellow added for convinience)




3. Turn Cycle


4. Planets


5. Ships


6. Warfare
 
Go to Atari forum and find the two games being made. One is for Moo and I think the other is Moo2. They have a solid knowledge of the games and have partial version done.
 
Ok, here's some tips from a software developer.

1st - Know the development cycle:

- Indentification. Ok, you've done that. This one's fairly simple.
- Feasibility. (There's also cost-benefit, but that's another story) Since it's for a course, ask yourself if you have the resources. In this case, time would be a resource. How long do you have? 2 months? Is it feasible?
- Analysis. This is where you must be specific.
** Entity/Relationship. These will wind up being specific functions or data in your program. For example, a unit is an entity. A unit might have hitpoints, attack, and movement. A unit can attack another unit. This is an entity-relationship. Relationships always have a verb.
** Musts/Wants. This is your "Wishlist" that we all know and love. If time is short, then you'll need very specific musts that MUST be completed before any other "frills", if any, are added.
** State Transition. This is how the game will move.
- Design. Now comes the part where you start to piece it all together. Take your musts, your data, and make some prototypes - be it small pieces of code, or even drawings of what the thing will look like.
- Coding & Testing. Ah, the part we've all been waiting for! Hopefully, you have a good idea of what the game will intail, and a good idea of how gameplay will go about in code (this is what the state transition diagram is for). Ever since I was a little tot, I've always tested my code, mostly to see my progress and see if there were any errors. Turns out, that was good practice! Now, you'll probably want someone else to test for you, too, if you can. It's always good to have a fresh pair of eyes that will find something you didn't think of, or forgot to change/add.
- Maintanence. Ok, since this is a school project, you won't get to this step. But, in the real world, this is better knows as "patches" or "updates". Some companies work on a bunch of change, and give them to you all at once. Others will make changes and give them to you monthly, or regularly, as does one 3rd party company where I work.

2nd - Research, research, research. You'll learn, not only programming techniques, but also how the game you want to duplicate works.

3rd - Don't spend too much time on one feature. If a feature just isn't working the way you want it, it might be best to just drop it, or go with something simplier for the time being. If you had more people working with you, you could ask them for help.

4th - Hardcoding is bad. Speghetti-coding is too - that is, putting all of your code into one, very long function. Seperate your functions into classes. Not only does this make your code easier to read, you can create independant parts to your program.

Here's an example of how I'd go about making a "no frills game" in 2 months.

Graphics Class - This will be the text-based user interface that initializes different screens, and colored ASCII text. (You could use normal graphics if you feel confident with that. Just remember to use a layer system -- each function is its' own layer).

Data Handling Class - This handles the reading and writing of your data.

Calculations Class - This might hold the random number generator, and other calculations that you'll need.

AI Class - Your AI functions.

5th - Try to keep your functions as small as possible. (In the case of AI, you're gonna be using large switch case statements, for loops, and wieghed values..). Use a lot of get() set() and boolean type functions to manipulate class variables. (i.e., getPlayer(...), isAlive(...), isFriend(...)).


Note for Designing - Sometimes, you may find something that's already out there, and only needs to be modified slightly. In the case of a school project, that's probably not possible, or feasible given the time you may or may not have.
 
One more thing before I call it a night. (Note, it might seem a little off towards the end, as I'm getting sleepy)


Just for kicks, here's a sample user interface for MOO, and how to code each thing. Remember, I don't know that much about this game, so what I'm showing you is based on what I see on the screen. For ease of use, we'll assume that these objects on the screen are fixed (they can't be moved), thus, they can be hard-coded. Essentially, an exercise in prototyping.

Sample user interface:

moo_screen001.jpg

(Did you notice the first two menu options are, "Game Design"? :lol: )
Parts:

Top-Left - The Game Map.
Right - Information Panel.
Bottom - Menu.

I'll start with the easy one - the menu.

There are eight options. Let's assume that this menu bar is a graphic that we put onto the screen. It'll be rather simple, like this in the area of code where you paint the graphics:

graphicsClass.PaintMenu();

If the menu had themes, the internal code of graphicsClass.PaintMenu(); might look something like:

/*
Some other code, such as initializing menu objects if
.
.
.
*/
for(int i=0;i<iGetNumberOfMenuOptions();i++)
{
// Note how I have the function with an "i" in front
// of it. That means it returns an integer.
PaintLabel(i,getLabelType(label.PurpleStuff)); // uses an enum
PaintLabelText(i,getLabelTextType(labeltext.HiTech),getLabelTextDesc(i));
}
// Notice how I'm using functions to gather the data. I can use these
// functions elsewhere, too. We're also assuming that the functions are in
// the same class.


This would build the lower menu. When the user clicks on the menu, this could be done one of two ways. Hard code the game to detect when the user clicks on a certain rectangle on the screen (like a hotspot on a webpage image), or, detect the object the user clicked. The later is more involved, but isn't hardcoded. If the object has an event (or a script) attached to it, the program would run that event (or script), such as "Open fleet menu", or "Show map".



Right Side of the Screen.

Here's a fun part! Let's go from the top down.

- First up to bat is a simple one. It's a label with some text. In fact, it works the same way as the menu code for printing the labels.

- Next up is a more complex label. This one has a picture of a globe, and some stats. The planet data might look something like this:

// In semi-psudeocode

structure somePlanetColor {
int iType;
.
.
.
} PLANETCOLOR;

structure somePlanetStructure {
PLANETCOLOR iPlanet; // This tells what color the planet is based on an integer.
char* cType; // This is the type of planet (i.e. Terran)
int iMaxPop; // The maximum population the planet can have.
} sPlanet[];


The code for this might look something like:

PaintLabel_PlanetGlobe(getGlobeType(sPlanet[iGetCurrentPlanet()].ePlanet));
PaintLabel_PlanetText(getText(sPlanet[iGetCurrentPlanet()].cType));
PaintLabel_PlanetPop(getText(sPlanet[iGetCurrentPlanet()].iMaxPop);

The same would be true for other labels and statusbars in that section of the screen. (Note: I'm not sure if those sliders (Ship, Def, etc.) are workable or not, as I don't have the game).

The three buttons in the right side, of course, are just like the menu options.


And of course, in the main screen, clicking on an object would cause the game to find what event the object refers to, and use ultra secret user engineering techniques to make the user think something wonderful just happened! :D
 
I think even a non-frills version of MOO would be too much for one person do within a school year. I think most high-school teachers would probably be impressed if you could just display a star map on the screen that you can zoom/-zoom and be able click on each star to get the system information.
 
For the Combat, Growth, Research, and Trade...

Here's a bit of psuedo-code. In fact, I'm basing it on my knowledge of Civilization, not MOO. Since I don't know how it works, it may or may not be the right code. Also, I'm typing this up as I go along. (sort of like notetaking in code)

Game loop
{
Player Loop
{
.
.
.

// When it's the end of the turn...

gameClass.UpdateGrowth(getCurrentPlayer());
gameClass.UpdateResearch(getCurrentPlayer());

.
.
.
}
}

In the gameClass file....

Growth

UpdateGrowth(int iPlayerIndex)
{
int j;
for(j=0;j<GetNumberOfCities(iPlayerIndex);j++) // This player has X cities...
{
CityClass.Owner[iPlayerIndex].City[j].Food += CountFoodSurplus(i);
if(CityClass.Owner[iPlayerIndex].City[j].Food > CityClass.Owner[iPlayerIndex].GetMaxFood(CityClass.Owner[iPlayerIndex].City[j].GetCitySize()))
{ // If there's an overflow, increase the size, and set the food to 0.
CityClass.Owner[iPlayerIndex].City[j].SetSize() += 1;
CityClass.Owner[iPlayerIndex].City[j].SetFood() = 0;
}
}
}

Tech

UpdateTech(int iPlayerIndex)
{
PlayerClass.Player[iPlayerIndex)].Tech.Research += CityClass.Owner[iPlayerIndex].GetTotalResearchBeakers();
if(PlayerClass.Player[iPlayerIndex)].Tech.Research > TechClass.GetNumBeakers(PlayerClass.Player[iPlayerIndex)].Tech.Index))
PlayerClass.Player[iPlayerIndex)].Tech.Add(PlayerClass.Player[iPlayerIndex)].Tech.Index);
PlayerClass.Player[iPlayerIndex)].Tech.Research = 0;
}

Combat

This one is kind of broad, and I'm not sure if you have to move a unit into another unit, or issue a command (like fire a missle 5 tiles away). Don't expect a combat engine in the lines of code I'm about to write. :)

Ok, in psuedo-code... Now, since you say you only have 2-3 months, I'm going to assume that unit stacking is out. It'll take more time than a simple 1 unit to 1 tile method.

// The player clicks a tile containing a unit. This triggers an event to show a menu of weapons.
// The player clicks a weapon. This triggers a "Select another tile" prompt.
// The player selects another tile... (assume that this is a function)
// The getMouseX/Y thing could be substituted for a better unit selection code if you want. I'm using "..." to denote possible code.

if(Map.bUnitExists(Graphics.GetMouseX(),Graphics.GetMouseY())
{
// It exists...
if( Map.bIsEnemy(FindOwner(Graphics.GetMouseX(),Graphics.GetMouseY()) )
{
Map.DoBattle(getAttacker(...),getDefender(...));
}
}

In the DoBattle() function...

void DoBattle()
{
// Since you've done a RPG game, I'm sure you're familiar with a battle engine..
}


Trade

I'm not sure how MOO works, but if it's like a diplomacy screen....

On the trade panels -
- For each NPC item, show the ones that the player doesn't have.
- For each player item, show the ones that NPC doesn't have
- Make two lists of items to be swapped.
- When the player confirms it, Delete the items in the player's swap list, and add the items in the NPC swap list, and vice versa.

Don't worry about AI yet, unless you want to do something simple like add up the values of the items to be traded and if the value is within X (maybe cost, or percentage), than the NPC will ok the trade.



---------------------

Your very first builds should look like they're a prototype. That is, a 2D screen (please don't tell me you're going 3D. :) ) where you can move, and dummy data that has X,Y coordinates that you can place on the map. If you must, generate units, ships, planets, etc. using code. (so you have have different colored planets/ships, etc. without having to make several files and worry about loading those files).

If I were coding this, my approach would be: (assuming I'm at the coding phase)

1 - Create the graphics class, and make sure that works. The graphics class will display the map, and in your main code, the ability to place units, ships and planets. (i.e., Graphics.PlacePlanet(x,y/*,z // if you want to be fancy and use 3D graphics, atleast make the object larger/smaller in scale... That's how I'd do 3D on a 2D engine. Granted, you'll have to make everything move towards/away from a central location in a conical shape.*/);

2 - Create the unit, improvement and planet classes (data gathering only - you're not deleting, updating or writing yet. It's only viewing the data.) and populate the unit/planet/improvement files with dummy data - maybe 1 or 2 items. Then, test it again with the graphics in place. (i.e., make sure that, using the main game file, you can display the data in some way, and that when you give a unit to the AI, it actually belongs to them.)

Note: I'd probably give the AI some super-unit at this point. 999 attack, 999 defense, 999 missiles, etc.

3 - Create the player class. Then, create your basic game loop.

while ( ... some game ending conditions are not met - save & quit, game over (player loses all units and planets, and so on), etc. ... )
{
.
.
.
doPlayer1Loop();
doUpdatePlayerStats();
doAILoop();
.
.
.
}


For doAiLoop(), I would make it a dummy function with a return 0; line. For the player loop, I would let the player control a unit until their turn is over.

4. Update the unit/city classes for algorithmic data. These would be things like get/set values (i.e., getPlanetName()..., setPlanetName(cName)... updatePlanet(...)). This is where you'd put any game features you want in your planet, such as soldiers being a percentage of the population.

Now, you should be able to go through the turns, and watch your galatic empire grow. Planets will grow, units and improvements will be built and healed. That's about all it can do right now. (units don't move at this point)

5. Give your units actions, including movement. You could also create a Fog of War at this point, too, but, I would actually place this (on the want/must scale of 1-5, with 5 being a much) at a 3. It's a cool feature, but if I only have 2 months to do this, it can wait. Now, if your unit finds the AI, it could do things like fire missles. Granted, I'm not sure how the battle system works. Is it 1vs1 like Civilization? Is it a "seek and destroy" where you can attack on the same map with short or long range weapons like Battleship? Or, does it go into its' own strategy screen that displays a fleet? Personally, this goes back to feasibility. With only 2-3 months, I'd opt for the simple method of "seek and destroy" (if you're close enough to the enemy, use an option) or "1vs.1" (if you bump into the enemy, attack). Create other basic features, like a simple attacking algorithm.

6. Create the user interface. At this point, many of the commands can be done with the mouse and keyboard. It always helps to have some sort of simple interface. The stuff that's on it could include a minimap, quick action buttons, and a menu. If time permits, a info-panel would be helpful to show quick information on a selected object.

Now, you may have an "interface" of sorts if you were displaying info to a section of the screen from step 2. That's fine if you want to keep it that way.

By now, you'd have a basic game where you can grow your planets, build units, explore and attack enemy units. Currently, there's only 1 enemy on the map, and 1 enemy unit (or planet if you wanted to give the AI a planet). You'll also have a simple interface to move around and see info in the game.

7 - Create multiple AI players. there'll still be a lack of AI code, but atleast you'll know that you can add/remove players. Speaking of which, if a player loses, you may want to remove whatever the player had left on the map. That way, you don't wind up fighting ghost ships (unless you want that, in which case, you might allow AI ships, but remove the crew).

8 - Create the main menu and sub menus for the game (New Game, Load Game, Hall of Fame, Exit...). "New Game" would lead to the game setup, where you can design the world (universe), and add players.

9 - Add in some rudimentary AI, and improve on any dummy-algorithms (like the battle engine). This includes things like battles, trade, exploration and growth.

Battle AI -

I would add some code that says, "Attack the weakest enemy unit with a weapon that will do the right amount of damage to defeat it". That way, I'm not having the AI attack a medical ship with a planet buster.

Trade AI -

I'd put in an algorithm that checks the value of the difference of items to be traded. If it's within a reasonable value, then do the trade. You could add a reputation system in where it makes it more/less likely that the AI will trade. An example would be this:

* Suppose the base difference was 500. Arbitrary number. A high reputation might expand that number to 2000, meaning you could rip the AI off if you wanted. A value of maybe, -300, would mean the AI's less likely to trade (200 value).

Exploration AI -

The AI could cheat and know where everything is, and just go to it. That might be the way to go for now, and if you have time, change it. It might involve something like keeping track of explored tiles and unexplored tiles, claiming valuable spots on the map, etc..

Growth AI -

I'm not sure how growth is done in MOO, but you could have the AI maybe focus on food (growth), and if it's an internal planet (not a border planet), then focus on production.

10 - If time permits, add or update any features. At this point, I might be wanting to check for bugs and gameplay issues.
 
Thank you all for the advice thrown out thusfar. I've started to fill out the Progress/Planning post so you can all have a better Idea of what I'm trying to do. One section finished, will write the Edit the others in as I get to them.
 
I made a color-coded map of your two maps you generated (for planet location, and planet type), and they don't seem match up....
Code:
[COLOR="SlateGray"]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0]
[0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color]
[0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][0]
[b][color=darkblue][1][/b][/color][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0]
[0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0]
[0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][b][color=darkblue][1][/b][/color][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][b][color=darkblue][1][/b][/color][0][b][color=darkblue][1][/b][/color][0][0][0][0]
[0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0]
[0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0]
[0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][b][color=darkblue][1][/b][/color][0][0][0][0]
[0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color]
[0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0]
[0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0]
[0][0][0][0][0][0][0][b][color=darkblue][1][/b][/color][0][0][0][0][0][0][0][0][0][0][0][0]



[ 0][ 0][ 0][ 0][b][color=darkblue][ 1][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][b][color=darkblue][ 2][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][ 3][/b][/color][ 0][ 0][ 0][ 0]
[ 0][ 0][b][color=darkblue][ 4][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][ 5][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][ 6][/b][/color][ 0][ 0][ 0][ 0][b][color=darkblue][ 7][/b][/color][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][ 8][/b][/color][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][ 9][/b][/color][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][10][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][b][color=darkblue][11][12][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][13][ 0][ 0][b][color=darkblue][14][/b][/color]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][15][/b][/color][ 0][b][color=darkblue][16][/b][/color][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][17][/b][/color][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][b][color=darkblue][18][/b][/color][ 0][ 0][ 0][b][color=darkblue][19][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][b][color=darkblue][20][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][21][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][22][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][23][/b][/color][ 0][ 0][b][color=darkblue][24][/b][/color][ 0][ 0][ 0][b][color=darkblue][25][/b][/color][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][b][color=darkblue][26][/b][/color][ 0][ 0][ 0][ 0][b][color=darkblue][27][/b][/color][ 0][b][color=darkblue][28][/b][/color][ 0][ 0][ 0][b][color=darkblue][29][/b][/color][ 0][ 0][ 0][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0]
[ 0][b][color=darkblue][30][/b][/color][ 0][ 0][ 0][b][color=darkblue][31][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][32][/b][/color][ 0]
[ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][33][/b][/color][ 0][ 0][ 0][b][color=darkblue][34][/b][/color][ 0][ 0]
[ 0][ 0][b][color=darkblue][35][/b][/color][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][ 0][b][color=darkblue][36][/b][/color][ 0][ 0][ 0][/COLOR]
 
Update:

Map generator has been more or less completed, posessing the features it should need for a simple working game in a few months. OP now has up-to-date Map info, and my focus will move on to the planets themselves.
 
For the sake of stimulating response and letting the general public know that I am, in fact, getting things done with this project, I present to you all a sample of my work thus far:

http://www.civfanatics.net/uploads11/G11Project3.zip
(This is already compiled, so you won't need anythign special to get it working)

Included this far:
-Can select number of players involved
-Generates Pseudorandom Map
-Grants each player a start location (Some bugs encountered on 4 Player maps)
-Allows player to select planets and fiddle arround with how production is distrubuted.
-Planets can use that production to make factories and speed up population growth.

More to come as time goes on.
 
Hey Yuri,

I downloaded the prototype you had a link to and went through it - so far, it looks great. It's certainly very cool to see how much you can do in a DOS game. I have one question though, and it's about keypress readings...I'm trying to make a simple game, or at least understand how I can do it, and I'm stuck at getting the arrow key readings. What I'm using now is WASD, and I use:

Code:
if(kbhit())

        {
        // getting the input...
        keyboardinput = getch();
        // ...and acting on it
        switch(keyboardinput)
            {
            case 'w': row = row-1; 
            break;
            case 'a': col = col-1;
            break;
            case 's': row = row+1;
            break;
            case 'd': col = col+1;
            break;
            default: cout << "Press WASD." << endl;
            }
            gotoxy(col, row);

Then it updates the cursor position based on the key pressed...how are you getting it to use the arrow keys?
 
I'm using getchar(); to take keyboard input, then convert the char taken to an interger. From there, I used a simple program to find out which key has which number when pressed. Try it for yourself.
(Press any key to get its int value, enter to exit)

For a quick ref -> Up - 72, Down - 80, Left - 75, Right - 77.
 
In other news, Behold!

With this version:

-Players can now build and move a nice generic ship.

Issues: At this time, for some reason, you can only move ships which are located at planets you own. Also, fleets have an odd habbit of vanishing if you try to move mor than one at once. (I've got a good Idea of where these bugs originate from, so expect them to soon be remedied.)

Edit: Yep, multi-fleet was fixed with a single flick 'o the keys. Still getting at the movement one.
 
Well folks, the project marches on!

Enjoy!

In today's update:
-Players now have a selection of six ships which are identical for each player.
-Ships have different extras and combat abilities, though at this point only expanded fuel (Scout and Cruiser) and Colony Base (Colony) do anything.
-Ships can be toggled between ('s' key)
-Planets can be colonized. (Simply move the colony ship to an uninhabited world. If it's better than barren the colony will be built automatically)
-Map cusor can now remember where it last was for each player, saving time when scrolling arround.

For those few who wish to test, be sure to report any bugs you may encounter.
 
This is quite an impressive achievement considering the timeframe, and your level of formal programming education. Is this project still active?

StuporMan
 
Not at the moment, but I still have all my files, notes, and flowcharts. I'll be taking my next programming class in my second semester this year. (Starting Feb '07) So I'll probably pick this up and again, finish off the other elements, and upgrade to full-blown Pixelated graphics, with the odd vector-based visual. Maybe even get some nice midi sounds going.

When I've started work on this again, I'll be sure to let you all know.
 
Back
Top Bottom