Hello, first i would ask my question on civfantics, but get no email from them. So i'm here.
I see there is a race editor, so the thing i wish should be possible. I hate this standard races with just ohne thing change between difficult change. Why not a random generator? Some ideas.
1.) A prepost script, which work like rules 10 rounds, but high chance nothing to take. Most races are default.
2.) First only negative picks are random take. After this, all positiv will taken. Will make stupid races.
3.) First negativ picks, gouverment picks, positiv picks. Will create races never seen before.
4.) Little AI, first negativ pics, goverment picks, positiv picks. Negativ pics will reduce chance to get wrong positiv picks.
5.) First goverment picks, negativ, positiv picks. But we will look, what is usefull. A democracy will have a higher change of creativ as feudal, which will get uncreativ. It doesn't need it. It will attack all.
6.) For every race 2 or 3 new stats. It will be easy i think.
7.) Stupid way, get first positiv picks or goverment, third negativ. Equal, what you do, it won't be nice. Sometimes good things must drop to get this races started.
Can we change some texts? I hate "finished construction:" better "finished" or "built". Also "Next in queue was (yesterday)" can be "Next:" or "christinend a ship". OK, a ship. Not a spy, turtle or quark. Can we drop it to christinend?!
Hope my english is good enough to understood, what i want.
Random Races? Should possible
Re: Random Races? Should possible
Do you want to randomize races for AI players or for human players or both? We have a request to add "randomize" button to race editor, but that's not what you want?
These messages look perfectly fine to me, but then, english is not my native language. Why do you hate "finished construction"? In any case, one can use moo2 workshop to edit rstring0.lbx.Can we change some texts? I hate "finished construction:" better "finished" or "built". Also "Next in queue was (yesterday)" can be "Next:" or "christinend a ship". OK, a ship. Not a spy, turtle or quark. Can we drop it to christinend?!
-
- Posts:7
- Joined:Mon Nov 20, 2017 10:15 am
Re: Random Races? Should possible
Random races for ai players. Play only single game. I have never looked at the editor. Will be fine, when it can be automatically at start from game. A batch file or so will first create random races and i can start a new game. When it can realized as command line parameter, it will be fine.
Textstrings to long. I know, what i build. So i don't need an explanation that i had build a ship or construction.
After shorten them, they will use only on line, not two. "Planet finished construction: Missle Base" needs two lines.
"Planet build: Missle Base" needs one line.
Or "Perizona Prime finished training a new spy" better
"Perizona Prime trained a new spy" or
"Perizona Prime trained a spy.
Next: Spy"
Textstrings to long. I know, what i build. So i don't need an explanation that i had build a ship or construction.
After shorten them, they will use only on line, not two. "Planet finished construction: Missle Base" needs two lines.
"Planet build: Missle Base" needs one line.
Or "Perizona Prime finished training a new spy" better
"Perizona Prime trained a new spy" or
"Perizona Prime trained a spy.
Next: Spy"
-
- Posts:7
- Joined:Mon Nov 20, 2017 10:15 am
Re: Random Races? Should possible
Found editor and testet. After a little time i understand, how to use it. Shortened texts, create new lbx and get following error:
An unexpected error occured, MoO2 version 1.50.9 will now terminate.
MoO2 internal error:
150\language\en\RSTRING0.LBX [entry 0] has an incorrect record size
So install original file, make some test. When i shortened text and overwrite rest with hex 00 it will create many new entries. In game nothing is more shown on turn summary. With space overwritten, it shows right text, but ending with original lenght. Ending text with hex 00, rest space, will created text like "Comet 1 built an android farmer."
Any idea how to correct record size?
An unexpected error occured, MoO2 version 1.50.9 will now terminate.
MoO2 internal error:
150\language\en\RSTRING0.LBX [entry 0] has an incorrect record size
So install original file, make some test. When i shortened text and overwrite rest with hex 00 it will create many new entries. In game nothing is more shown on turn summary. With space overwritten, it shows right text, but ending with original lenght. Ending text with hex 00, rest space, will created text like "Comet 1 built an android farmer."
Any idea how to correct record size?
Re: Random Races? Should possible
I guess i mislead you and workshop can't handle this file. You can edit the file with ordinary hex/text editor (with some care, editors like notepad might ruin the file). Edit messages but don't pad individual ones, leave exactly 1 null between consecutive messages, then insert enough nulls in the end of file, so that total file length is 8552. This will take care of record length.Shortened texts, create new lbx and get following error:
150\language\en\RSTRING0.LBX [entry 0] has an incorrect record size
Re: Random Races? Should possible
Regarding AI random races, there is no easy way in 1.50.9. Will be possible when I add support for modifying players from scripts. Next release probably.Random races for ai players. Will be fine, when it can be automatically at start from game. A batch file or so will first create random races and i can start a new game. When it can realized as command line parameter, it will be fine.
Technically you can generate random configs with AI races (ai_race_variant_table) using external program and then include that config. For example run 'gen_random_races.exe > rraces.cfg' and add 'include rraces.cfg;' to USER.CFG. But you'll need to write such program first.
Last edited by Alex on Thu Nov 23, 2017 6:58 pm, edited 1 time in total.
-
- Posts:7
- Joined:Mon Nov 20, 2017 10:15 am
Re: Random Races? Should possible
I think about this. But we should about a version of creating random races. I think step 5 with first gov. neg, pos is the best solution for MoO2.Regarding AI random races, there is no easy way in 1.50.9. Will be possible when I add support for modifying players from scripts. Next release probably.
Technically you can generate random configs with AI races (ai_race_variant_table) using external program and then include that config. For example run 'gen_random_races.exe > rraces.cfg' and add 'include rraces.cfg' to USER.CFG. But you'll need to write such program first.
First i must create an array of 21 elements (poor and rich homewolrd make the use of unsigned byte instead sign int or byte). After this a random generator will create a random number of picks. I need three values for this. This are count_pos, count_neg and count_all. count_all has at this moment a disctrictend at 20. Negativ and count_ pos have a max at 10, but a while loop will stop them by hitting a value like (6 or
![Cool 8)](./images/smilies/icon_cool.gif)
Second step it should look, if a spezified value (uncreativ or poor homeworld or grow neg and random will make a pos value) is in the array. When yes eleminate this, make a new turn or say "oh, nothing". This is just a little function, which look at some array stats and say "Ohh". Where is the problem? This is controlled function, which is like a stupid AI. So we can a max use of picks, when it compiled with tables, that will picks correct. (A pick with 8 points shouldn avaible when a counter is at 4 or more points).
Next step after a little while like 10 or 20 turns will print this array.
Edit: Its 19:35 and i'm drunk. I missed something in this thread. What is going on there?
Last edited by Dumpfbacke on Sat Nov 25, 2017 4:04 am, edited 1 time in total.
Re: Random Races? Should possible
someone made a html race randomizer, perhaps the coding of it can help you somewhat:
https://apolyton.net/forum/other-games/ ... randomizer
https://apolyton.net/forum/other-games/ ... randomizer
-
- Posts:7
- Joined:Mon Nov 20, 2017 10:15 am
Re: Random Races? Should possible
I have look at the code. First he make a negativ counter with 10 and a loop, which run so long the counter is zero. After this a positiv counter. And he look, if there is a value in contradiction with a new value. If negativ pic feudal, other goverments will make a new run in the loop.
Why is my other replay away? Because i shorted Assault to Ass? My ships have an easy names schematic (shipsize, job, model = Doom Star, Assault ships or missle/ torpedos or beams = D Ass/ Rock(et)/ Ray 0X)
Edit: Negative picks are written. positiv comes later.
Edit 2.: Doesn't work correct. Sometimes not enough is choosen.
Edit 3.: Found my mistake. Array was to short.
Edit 4.: Finished, generate 1 line. A batch could do the rest.Problem is random generator, which have a problem, when no sekund is gone.
Windows 7 knows sleep command, but XP not. So i wrote a batch to generate random races. Above stand how to make a new rraces with "Batch >> rraces.cfg" which must include in user.cfg.
Why is my other replay away? Because i shorted Assault to Ass? My ships have an easy names schematic (shipsize, job, model = Doom Star, Assault ships or missle/ torpedos or beams = D Ass/ Rock(et)/ Ray 0X)
Edit: Negative picks are written. positiv comes later.
Edit 2.: Doesn't work correct. Sometimes not enough is choosen.
Edit 3.: Found my mistake. Array was to short.
Edit 4.: Finished, generate 1 line. A batch could do the rest.
Code: Select all
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
/* randomize races in Master of Orion 2
written by Dumpfbacke, November 2017 */
int main () {
short number, i, pos, neg, count, dice, roundneg, roundpos;
number = 0;
i = 0;
pos = 0;
neg = 0;
count = 0;
dice = 0;
roundneg = 0;
roundpos = 0;
/* array with 0 */
signed short race[31] = { 0 };
/* initialize random seed: */
srand ( time(NULL) );
/* Goverment select */
race[0] = rand()%4;
// Feudal, Dictator doesnt cost points
if ( race[0] == 0 ) ( neg = neg + 4);
// Uni
if ( race[0] == 2 ) ( pos = pos + 6);
// Democracy
if ( race[0] == 3 ) ( pos = pos + 7);
count = pos + neg;
// set correct value
if ( race[0] != 0 ) {
race[0] = race[0] * 2;
};
/* 13 negativ picks from 1 to 6 points. Thinking about handling it with neg */
do {
dice = rand()%13;
/* pics and points. some rounds needed. */
if ( dice == 0 && neg < 7 && race[1] == 0 ) { (race[1] = 1); neg = neg +4; };
if ( dice == 1 && neg < 8 && race[2] == 0 ) { (race[2] = 1); neg = neg +3; };
if ( dice == 2 && neg < 8 && race[3] == 0 ) { (race[3] = 1); neg = neg +3; };
if ( dice == 3 && neg < 8 && race[4] == 0 ) { (race[4] = 1); neg = neg +3; };
if ( dice == 4 && neg < 7 && race[5] == 0 ) { (race[5] = 1); neg = neg +4; };
if ( dice == 5 && neg < 9 && race[6] == 0 ) { (race[6] = 1); neg = neg +2; };
if ( dice == 6 && neg < 9 && race[7] == 0 ) { (race[7] = 1); neg = neg +2; };
if ( dice == 7 && neg < 9 && race[8] == 0 ) { (race[8] = 1); neg = neg +2; };
if ( dice == 8 && neg < 8 && race[9] == 0 ) { (race[9] = 1); neg = neg +3; };
if ( dice == 9 && neg < 6 && race[10] == 0 ) { (race[10] = 1); neg = neg +5; };
if ( dice == 10 && neg < 10 && race[15] == 0 ) { (race[15] = -1); neg = neg +1; };
if ( dice == 11 && neg < 5 && race[19] == 0 ) { (race[19] = 1); neg = neg +6; };
if ( dice == 12 && neg < 7 && race[21] == 0 ) { (race[21] = 1); neg = neg +4; };
// printf ("Neg %d dice %d \n",neg, dice); // debugging
roundneg++;
}while (neg < 9); // 9 points are often, but 10 not.
/* 30 positiv picks, 36 possible values . writing same stuff */
number = 10 + neg;
do {
dice = rand()%36;
if ( dice == 0 && pos < (number - 3) && race[1] == 0 ) { (race[1] = 2); pos = pos +3; };
if ( dice == 1 && pos < (number - 6) && race[1] == 0 ) { (race[1] = 3); pos = pos +6; };
if ( dice == 2 && pos < (number - 4) && race[2] == 0 ) { (race[2] = 2); pos = pos +4; };
if ( dice == 3 && pos < (number - 7) && race[2] == 0 ) { (race[2] = 3); pos = pos +7; };
if ( dice == 4 && pos < (number - 3) && race[3] == 0 ) { (race[3] = 2); pos = pos +3; };
if ( dice == 5 && pos < (number - 6) && race[3] == 0 ) { (race[3] = 3); pos = pos +6; };
if ( dice == 6 && pos < (number - 3) && race[4] == 0 ) { (race[4] = 2); pos = pos +3; };
if ( dice == 7 && pos < (number - 6) && race[4] == 0 ) { (race[4] = 3); pos = pos +6; };
if ( dice == 8 && pos < (number - 5) && race[5] == 0 ) { (race[5] = 2); pos = pos +5; };
if ( dice == 9 && pos < (number - 8) && race[5] == 0 ) { (race[5] = 3); pos = pos +8; };
if ( dice == 10 && pos < (number - 3) && race[6] == 0 ) { (race[6] = 2); pos = pos +3; };
if ( dice == 11 && pos < (number - 7) && race[6] == 0 ) { (race[6] = 3); pos = pos +7; };
if ( dice == 12 && pos < (number - 2) && race[7] == 0 ) { (race[7] = 2); pos = pos +2; };
if ( dice == 13 && pos < (number - 4) && race[7] == 0 ) { (race[7] = 3); pos = pos +4; };
if ( dice == 14 && pos < (number - 2) && race[8] == 0 ) { (race[8] = 2); pos = pos +2; };
if ( dice == 15 && pos < (number - 4) && race[8] == 0 ) { (race[8] = 3); pos = pos +4; };
if ( dice == 16 && pos < (number - 3) && race[9] == 0 ) { (race[9] = 2); pos = pos +3; };
if ( dice == 17 && pos < (number - 6) && race[9] == 0 ) { (race[9] = 3); pos = pos +6; };
// Low and high G
if ( dice == 18 && pos < (number - 6) && race[10] == 0 && race[11] == 0 ) { (race[11] = 1); pos = pos +6; };
if ( dice == 19 && pos < (number - 5) && race[12] == 0 ) { (race[12] = 1); pos = pos +5; };
if ( dice == 20 && pos < (number - 6) && race[13] == 0 ) { (race[13] = 1); pos = pos +6; };
if ( dice == 21 && pos < (number - 1) && race[14] == 0 ) { (race[14] = 1); pos = pos +1; };
if ( dice == 22 && pos < (number - 1) && race[15] == 0 ) { (race[15] = 1); pos = pos +1; };
if ( dice == 23 && pos < (number - 3) && race[16] == 0 ) { (race[16] = 1); pos = pos +3; };
// Cyber and litho
if ( dice == 24 && pos < (number - 5) && race[17] == 0 && race[18] == 0) { (race[17] = 1); pos = pos +4; };
if ( dice == 25 && pos < (number - 10) && race[18] == 0 && race[17] == 0) { (race[18] = 1); pos = pos +10; };
// race[19] is repusilve, neg pick
if ( dice == 26 && pos < (number - 3) && race[20] == 0 && race[19] == 0 ) { (race[20] = 1); pos = pos +3; }; // charisma and repulsive
if ( dice == 27 && pos < (number - 8) && race[22] == 0 && race[21] == 0) { (race[22] = 1); pos = pos +8; };
if ( dice == 28 && pos < (number - 10) && race[23] == 0 ) { (race[23] = 1); pos = pos +10; };
if ( dice == 29 && pos < (number - 4) && race[24] == 0 ) { (race[24] = 1); pos = pos +4; };
if ( dice == 30 && pos < (number - 6) && race[25] == 0 ) { (race[25] = 1); pos = pos +6; };
if ( dice == 31 && pos < (number - 3) && race[26] == 0 ) { (race[26] = 1); pos = pos +3; }; // Luck
if ( dice == 32 && pos < (number - 3) && race[27] == 0 ) { (race[27] = 1); pos = pos +3; };
if ( dice == 33 && pos < (number - 4) && race[28] == 0 ) { (race[28] = 1); pos = pos +4; };
if ( dice == 34 && pos < (number - 5) && race[29] == 0 ) { (race[29] = 1); pos = pos +5; };
if ( dice == 35 && pos < (number - 4) && race[30] == 0 ) { (race[30] = 1); pos = pos +4; };
// printf ("Pos %d dice %d \n",pos, dice); // debugging
roundpos++;
}while (pos < (number - 2)); //Most time number is 19, so end with 17 is good enough
/* print array out */
i = 0;
do{
printf (" %d", race[i]);
i++;
} while (i < 31);
printf (";\n # Neg: %d, Pos: %d rounds Neg: %d rounds pos: %d number: %d\n", neg, pos, roundneg, roundpos, number);
}
Windows 7 knows sleep command, but XP not. So i wrote a batch to generate random races. Above stand how to make a new rraces with "Batch >> rraces.cfg" which must include in user.cfg.
Code: Select all
@ECHO OFF
cls
echo stock_race Alkari = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Bulrathi = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Darloks = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Elerians = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Gnolams = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Humans = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Klackons = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Meklars = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Mrrshan = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Psilons = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Sakkra = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Silicoids = && ai_races_gen
ping -n 1 -w 1000 192.168.10.1 |find ""
echo stock_race Trilarians = && ai_races_gen
Re: Random Races? Should possible
Cool. Not that i checked all numbers.
imo easier done in c, rename your main to generate and add this:Edit 4.: Finished, generate 1 line. A batch could do the rest.
Code: Select all
int main()
{
freopen("rraces.cfg", "wt", stdout);
srand ( time(NULL) );
for (int i = 0; i < 13; ++i) {
printf ("stock_race %d =", i);
generate();
}
}
-
- Posts:7
- Joined:Mon Nov 20, 2017 10:15 am
Re: Random Races? Should possible
roundpos and roundneg just for debbuging. So its possible to see, how often it runs throw the loop. The value 17 at the end of pos picks makes it good. Change this to 18 let the loop sometimes hang up, because random doesn't hit something with 1, 2 or 3 points.Cool. Not that i checked all numbers.
My problem is, that i'm a long time not programming. Most things i would make as functions, i haven't (gov for goverment randomize, neg and pos. To change the order an get other randomize.But i think, this order gov, neg, pos is ok).imo easier done in c, rename your main to generate and add this:Code: Select all
int main() { freopen("rraces.cfg", "wt", stdout); srand ( time(NULL) ); for (int i = 0; i < 13; ++i) { printf ("stock_race %d =", i); generate(); } }
But it works good enough. Feel free to take it and change some things. Will fine to see different randomize and some logic.
Created yesterday races like a democracy, uncreative, democracy with negative research or creativ feudal. Doesn't make sense, but funny.
Re: Random Races? Should possible
Just saying how to get rid of batch. In any case thanks for the code, will generalize a bit and ship as mod. Races look fun indeed.
Who is online
Users browsing this forum: No registered users and 85 guests