#2174: OIL! OIL! WE FOUND OIL!!!!! (bug: exponential oil drum growth)
-------------------------------------+--------------------------------------
        Reporter:  CorvusCorax       |         Type:  bug               
          Status:  new               |     Priority:  major             
       Milestone:  unspecified       |    Component:  Engine: Networking
         Version:  svn/2.3           |     Keywords:  oil drum spree    
Operating System:  All/Non-Specific  |   Blocked By:                    
        Blocking:                    |  
-------------------------------------+--------------------------------------
 In a multiplayer game, once the game is created, multiGameInit() will call
 campInit(), where the host will place PLAYER_COUNT *2 oil drums randomly
 on the map:

 {{{
 multiopt.c: #568:
         if (NetPlay.isHost)     // add oil drums
         {
                 addOilDrum(NetPlay.playercount * 2);
         }
 }}}

 if such a drum (or in fact any oil drum on the map) gets picked up, a new
 oil drum will be randomly placed on the map

 {{{
 move.c: #2912
 static void checkLocalFeatures(DROID *psDroid)
 {
         SDWORD                  i;
         BASE_OBJECT             *psObj;

         // only do for players droids.
         if(psDroid->player != selectedPlayer)
         {
                 return;
         }

         droidGetNaybors(psDroid);// update naybor list.

         // scan the neighbours
         for(i=0; i<(SDWORD)numNaybors; i++)
         {
 #define DROIDDIST (((TILE_UNITS*5)/2) * ((TILE_UNITS*5)/2))
                 psObj = asDroidNaybors[i].psObj;
                 if (   psObj->type != OBJ_FEATURE
                         || ((FEATURE *)psObj)->psStats->subType !=
 FEAT_OIL_DRUM
                         || asDroidNaybors[i].distSqr >= DROIDDIST )
                 {
                         // object too far away to worry about
                         continue;
                 }


                 if(bMultiPlayer && (psObj->player == ANYPLAYER))
                 {
                         giftPower(ANYPLAYER,selectedPlayer,true);
 // give power
                         CONPRINTF(ConsoleString,(ConsoleString,_("You
 found %u power in an oil drum."),OILDRUM_POWER));
                         addOilDrum(1);
                 }
                 else

                 {
                         addPower(selectedPlayer,OILDRUM_POWER);
                         CONPRINTF(ConsoleString,(ConsoleString,_("You
 found %u power in an oil drum"),OILDRUM_POWER));
                 }
                 removeFeature((FEATURE*)psObj);
 // remove artifact+ send multiplay info.

         }
 }
 }}}

 checkLocalFeatures() gets called any time a droid moved, so if any droid
 moves near an oil drum it gets picked up, a destroy message is sent on the
 network, but before that addOilDrum(1) is called which will place one new
 oildrum on the map, too. And inform all other players about it.

 Now imagine the beforementioned cramped map. Theres almost no free space
 on the map, except in the middle, where 8 players armies are battling it
 out.

 Right in the middle of a battlefield is a bad place for an oil drum to
 magically appear though!


 Why?


 Because the next cycle after it appeared, multiple players might have
 droids near it.

 (it doesn't matter if they are on the same team or not)

 Each of them will claim it the next cycle after they received that
 notification, since the droids are moving. Then subsequently send an obj
 removal notification to all the others, as well as place one new oil drum
 on the map.

 So For each nearby player, one new oildrum is placed on the map.

 But remember, we said the map was cramped, so at least one of these oil
 drums ends up in the midst of a pulk of units again!

 And gets magically duplicated...

 This is almost like sharing movies on PirateBay. I can have it, and you
 can have it too, and then we give copies to others!


 It didn't take long with 8 players on the attached map, and we couldn't
 build a single building anymore because everything was full of oil drums.
 And that was at the time when we barely had reached ripples. Oil drums
 spawned faster than we could pick them up and I got these errors galore:

 {{{
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,14)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (7,39)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (9,11)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (6,12)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (16,23)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (8,12)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,24)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (16,22)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (16,25)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,22)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,25)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (16,26)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,14)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,26)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (20,12)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (16,27)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,27)!
 error   |08:07:43: [recvMultiPlayerRandomArtifacts] Already something at
 (15,25)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (15,23)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (16,24)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (16,23)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (16,21)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (16,25)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (15,23)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (15,24)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (15,25)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (8,11)!
 error   |08:07:44: [recvMultiPlayerRandomArtifacts] Already something at
 (16,26)!
 ...
 }}}


 In a single player game (as in against AI) this is not reproducable, since
 AI doesn't pick up oil drums. So the exponential growth never gets
 started.



 Note, the exact resoning to why the oildrums multiply is a guess. I might
 have it wrong. All I know is,


 we reached peak oil!


 ;)
 *scnr*

-- 
Ticket URL: <http://developer.wz2100.net/ticket/2174>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to