Author Topic: [TFTD] [Expansion] TWoTS+ Release (v.2.62)  (Read 859455 times)

Offline murkhach@centrum.cz

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: [TFTD] [Expansion] TWoTS+ Release (v.2.62) Yacht & Container Variety
« Reply #2235 on: December 16, 2024, 07:26:14 pm »
Hi I experimented  with enemy spawning.
  In first published  maps  I tried to manually set routes spawning ranks and patrol priorities.
  This make map interesting for first play, however after several times becomes stereotype and routine.
 
 So I wrote a simple  console app in .NET  that as argument accepts FILE 
  ( IE "XCOM Routes Randomizer.exe" d:\Documents\OpenXcom\xcom2\Yacht00.RMP )

1.)  It counts number of nodes for each rank and then
2.)  Sets spawning and patrolling priorities for all nodes to 1
3.)  Shuffles node ranks (Omits X-COM & Terrorist 2 )
4.)  Saves new file as .RMPX

Because my maps contains just one block,  it is easy  adjust terrains rule, that  when mission is created, then the block is picked randomly. So variety seems more rich then before.

ENJOY and share your feedback
 

   
 
 

Offline Nord

  • Commander
  • *****
  • Posts: 1750
  • The Gate is open.
    • View Profile
Re: [TFTD] [Expansion] TWoTS+ Release (v.2.62)
« Reply #2236 on: December 17, 2024, 08:54:59 am »
Interesting idea.
Quote
3.)  Shuffles node ranks (Omits X-COM & Terrorist 2 )
This can produce a mess out of map. Like 2x2 units locked in small rooms and so on.

Offline murkhach@centrum.cz

  • Captain
  • ***
  • Posts: 56
    • View Profile
Re: [TFTD] [Expansion] TWoTS+ Release (v.2.62)
« Reply #2237 on: December 17, 2024, 11:11:16 am »
Interesting idea.This can produce a mess out of map. Like 2x2 units locked in small rooms and so on.
I can update code that both terrorist ranks would stay in place (I supposed that 2x2 is used for terrorist 2)
The code actually shuffle only ranks and reset priorities - so the unit size and movement limitations  stay as it is

 So theoretically   ( if terrorist 1 is 2x2 unit and allowed nodes for this ran  are small units only) map script does not spawn unit or report error
 However only one surface 2x2 units are terrorist , so I will add Binary that omits both terrorist ranks


Algorithm:
             for (int i = 0; i<fileLenght / 24; i++)
            {
                fs_Rmp.Read(buffer, 0, 24);   // 20 - unit rank,21-patrol priority,  23-spawn priority  (others like links, position, unit size are unaffected)
                RouteNode r = new RouteNode(buffer);
                r.SpawnPriority = 1;
                r.PatrolPriority = 1;

                ranks[r.Rank]++;
                if (r.Rank != 1 && r.Rank != 8) // not X-XCOM and terrorist
                    toMixNodeIndexes.Add(i);

                routeNodes.Add(r);
            }

            // randomization 
            while (toMixNodeIndexes.Count > 0)
            {
                int idx = RandVal(toMixNodeIndexes.Count);
                mixedNodeIndexes.Add(toMixNodeIndexes[idx]);
                toMixNodeIndexes.RemoveAt(idx);
            }

            ranks[1] = 0;

            int convertedNodes = 0;
            for (byte i = 0; i < 8; i++)
            {
                for (byte j = 0; j < ranks; j++)
                {
                    routeNodes[mixedNodeIndexes[convertedNodes]].Rank = i;
                    convertedNodes++;
                }
            }