Hypothetical Question (Next-Generation MOO2)

Suggest or Vote on new features here.
User avatar
Posts: 8
Joined: Sat Jun 23, 2007 5:52 pm

Postby Riftwalker » Mon Jan 25, 2010 10:14 pm

@Ist: Based on what you've described for your game engine, I'd encourage you to actually take a step further backwards. Instead of working on the engine, first get the model in place to describe the game's internal state and the actions that affect that model/state.

The basic algorithm of the game, in some sort of C++/Java-like pseudocode.

Code: Select all

Model currentTurnModel = generateInitialGameState();
   for (Player p:players)
      Action actions[] = presentModelToUserAndGetActions(p,currentTurnModel);
      for (action:actions)
   Model nextTurnModel = currentTurnModel.advanceToNextState();
   currentTurnModel = nextTurnModel;
while (!currentTurnModel.isGameOver());

The Model would have the data-structures required to keep track of the game's state. For example, the list of star systems, colonies, population units, who's researched what technology, etc.

If you'll allow me--a random person on the internet--to make a suggestion, I say forget menus, graphics, everything, and get the implementation details of of the Model implementation and Model::advanceToNextState() figured out.

Posts: 17
Joined: Sat Jan 09, 2010 3:25 am

Postby Istrebitel » Tue Jan 26, 2010 2:47 am

I know. If id' be making something with alot of physics, complex algorythms etc, i'd of course start backwards. But in case of MOO2...
That is VERY simple and in fact already done by me in a text file. And i described it above. I can do this exact part again:

The game flow consists of parralel actions of players, where each player has initial state of the turn (colonies, ships, planets, stars, leaders) and makes changes to theese (swaps workers, recruits or fires leaders, scraps or refits ships, makes orders to colonies and fleets). When player makes a change to a colony, colony recalculates its numbers (gold outcome, prod, food, etc) or calculates turns to complete prod.

When each player pressed end turn, they all send their modified data to host. Host does AI turns to complete the sequence and he has an end turn state of each of the players. He then takes his state and strips it of everything that does not belong to him (ledaers, fleets, colonies, player info) and replaces it with the one from corresponding player (each player has actual information about his colonies, fleets, leaders and tech/stuff at the end of his turn).

Then, a "TimeShift()" happens that actually does production, spying, etc, all that happens in "one" turn. Ships fly towards destinations, etc. After that, combat possibilities are calculated. Appropriate players are given a choice to pick their fights.

If fight happens, a battle module is initialised, it holds reference to all participating ships. It calls battle engine to draw the battle action on the screen, and has two big states = "Someone is choosing his action" or "action is underway". If first, it waits for said player to make his choice and then adds his actions to the action queue and switches to playing them (for example, player wants to fire at the ship with 8 weapons, thats 8 actions queued).

When a ship is moving, it is done in same "TimeShift()" manner. For each point a ship moves it is checked wether someone wants to reaction-fire at him, or if any missile is after this ship. If so, missile is also given a chance to move and attack. If an attack happens, its added to the action queue before the ship movement and processed first

When ship is firing (or missile is hitting a ship, or fighter, etc) all the damage is calculated and sent to every player (so random numbers are same at each pc) then the animation is played, and sound. (piu piu piu, fsshshh, red beams scratching the target hull... numbers flying out...). After the animations damage is applied, ship checks if its alive, dies if not. Dying is also an action and can be "silent" or "detonation".

When ship dies or escapes its marked as such. Escaped ships are not drawn in combat, dead ships are removed from game when combat ends, with leaders who died on them, if any.

Technology - each player has a list of "achivements". They might be racial or technical. Each achivement can be one of different achivement types.
- some give bonuses to different fields, they are queried for when appropriate calcualtions are done (when i'm calculating my chance to hit, i am asking if the player has any modifiers to chance to hit and getting their sum).
- some give building options like AF
- some give ship weapons etc
- some are special and treated as such (Unification's no morale, TransDimensional's fly w/o drives, lucky etc)

Each tech has a list of benefits. When its researched it goes to "researched techs" but its only there to calculate player tech score and show in the INFO screen. The benefits of the tech are added to the player's achivements list. Those are the one that count

There is also planet achivement list. Theese are added by buildings built and include AF bonus, Holo Simulator bonus, etc. For example AF provides two achivements - flat bonus and per worker bonus. Building itself is there for show and achivement, if not permanent (soil enrichment for ex, if i remember correct, is permanent), stores a link to the bulding. When building is destroyed or scrapped, all achivements "depending" on it are also lost.


Well, i have all that in mind and alot in text. I dont write pseudocode as this is close enough to the code. Actually, i replace theese strings with "todo" list like:

make static class Languages. it handles all language specific strings in the game and gives them out on demand. it changes language on demand and reloads textures. strings are stored in another CurrentLanguage class instance that can FromXML itself

and todo list with verbal explanation what a class should do, like this:

public static void LoadAvailableLanguages()
runs at class constructor i suppose

tries to load every xml from Languages folder.If success reads language name and stores Dictionary of name-path.

as a result has Dictionary<> availableLanguages filled

This reads proxy class that has only name field, not the whole languagespecific class with all strings and stuff that would take 100x to read

and then this verbal explanation is commented and code is added. That way i can plan my game anywhere, in subway, at work, and then by the end of the day i have a "big TODO" list with exact instructions :)

I always start from the hardest and most boring parts. Because if i do the "sweet" and easy parts, the hard parts would then discourage and probably make me drop this whole thing, loosing all work that was already done.

Planning this game, i figured most of the time would be spent on making controls (buttons, text fields, stars, planets, colony screen buildings, ship/colony lists...) that interact with player in correct way, are re-usable (same class to display workers and spies, same class to display list of colonies and list of ship weapons...) and work fast. And making screens of them. Thats why i start from there.

If using windows controls (that is windows forms for all, colony list as a popup form, colony screen as another popup) i would estimate that it would take less a week to make a kinda-playable moo2 clone (strategic combat though) engine. It would let you do all the same you could in moo2, but with windows buttons, lists etc. Its just very easy to do. Then add tactical combat (with 2d net drawn with Canvas.Lineto and X instead of ships), and just fill the XML files with data (tech lists, race perk lists, bulding lists, weapon lists..) and you have a windows forms moo2. But making all those fancy graphics, colonists moving controls (where you pick 3 men and others stretch to their positions), combat action animations is what takes most time.

PS: IMHO of course. I might be 100% wrong at any of theese. And i'm open to crticism and suggestions 100% because i know i'm not a "know-it-all" nor a professional game programmer :)

Posts: 17
Joined: Sat Jan 09, 2010 3:25 am

Postby Istrebitel » Tue Jan 26, 2010 5:22 am

Oh i think i should cut myself... literally ^_^ i mean:
This forum does not support "under cut" marking and i write alot of unnessecary text that explains one simple sentence, it should be only open when someone thinks he needs to read it, otherwise it should hide behind one string of text "long explanation goes here"

What i tried to say in previous post is that i have in mind and "on paper" (virtually) the gameflow you suggested. I dont use pseudocode for that but more literal approach because its easier for me that way, because i can then comment the text and write the code and i dont have to write commentary :)

And i think that the gameflow (change of states, taking user actions) for MOO2 can be written very fast, if using windows forms (buttons, textboxes,listboxes,captions). Its fun and simple. It is the graphic UI part that is tedious, boring and taking most hard work. Thats why i chose to start from there.

Still thanks for your suggestions, i'd appreciate anything you'd have to say... i'm same "noone from the internet" as you :)

PS: If this will get anywhere serious i'd make a website to go on with suggestions and stuff. But thats when i can present something to the community, not just "plans"...

Posts: 3
Joined: Sat Jan 23, 2010 8:59 am

Postby hlop4ik » Tue Jan 26, 2010 11:38 am

http://www.spheriumnorth.com/orion-foru ... .php?t=657
Istrebitel look this topic

moo2 remake in python

Posts: 2
Joined: Sat Jan 23, 2010 1:33 pm

Postby openMOO2 » Tue Jan 26, 2010 3:44 pm

i sent letter to author of "Moo2 saveeditor 0.40" Dennis Preuss about
save format. I think he knows about it more than others. He didn't answer yet. (http://www.sohryuasuka.de/editor.html)
There is no any source code about Moo2, neither c# nor python nor c
Many men wrote in forums that they is remaking. Then disappear. And didn't publish any source code.

Posts: 17
Joined: Sat Jan 09, 2010 3:25 am

Postby Istrebitel » Thu Jan 28, 2010 11:05 am

2 hlop4ik
o_O definetly worth a look, thanks!

Posts: 17
Joined: Sat Jan 09, 2010 3:25 am

Postby Istrebitel » Sun Jan 31, 2010 7:15 am

Okay, i'm almost done with starmap generation, i think i will be able to provide some screenshots of my program soon...

Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 1 guest