Author Topic: The difference between surface and underwater team + Deployment.  (Read 7195 times)

wcho035

  • Guest
The difference between surface and underwater team + Deployment.
« on: September 04, 2019, 07:04:56 pm »
Hi, this post is me trying to understand more about the coding behind the transformation between the Alien race from alienRaces.rul

I am trying to understand the difference between STR_SECTOID and STR_SECTOID_UNDERWATER

Please check screenshot EXP2.bmp

Okay, I am putting things here in the most basic simple description  possible. So every one can understand my problem.

What so hard to understand? They are two different teams, one on land and one under the water. Yes, they are. However, what I want to know is. How are they related in the game, from the code.

For example.

In Exp1.bmp, I shot down a large scout with a crew of Sectoid on board, they crash just off the coast and in the ocean.

If you refer to screen shot Exp2.bmp I tried launching a troop transport to the crash site. When it did, an error was generated.
In screen shot Exp2.bmp, I have disable the underwater team. So the error, unknown race: STR_SECTOID_UNDERWATER defined in deployment : STR_LARGES_SCOUT.

Now.. now, hang on a minute, this ufo is crew with sectiod from the STR_SECTOID, not STR_SECTOID_UNDERWATER. However, why is it asking for STR_SECTOID_UNDERWATER?

My question is,

1) Is there a transformation done between STR_SECTOID to STR_SECTOID_UNDERWATER? There are two different teams right?
Why is the engine asking for the sea team where it is a surface team that was shot down?

So I change the code a bit to test, please check Exp3.bmp, I have put the snakemen team into the STR_SECTOID_UNDERWATER, so it will make the difference between the surface STR_SECTOID and the underwater STR_SECTOID_UNDERWATER stood out.

I run the game again, and then whola! Please check Exp5.bmp, I found snakemen from STR_SECTOID_UNDERWATER.

So, why would a large scout with sectoids now crew with Snakemen? When it crash underwater? Is there a transformation done?

So this came to the second part of my question.

IF there is a transformation done, I have code a underwater deployment for it in alienDeployments.rul.

Please check screen shot EXP6.BMP and EXP7.BMP.

I have done a craftcustomdeploy, using the STR_SECTOID_UNDERWATER as a trigger, since it is an underwater team being deploy in the map game from EXP5.bmp.

Unfortunately, the underwater deployment from alienDeployments.rul is not triggered and ignored.

However, when I use the surface team, STR_SECTOID, only then the underwater deployment is triggered.

So, is there a problem with the codes? Why can't I use the underwater team STR_SECTOID_UNDERWATER to trigger the deployment I want from  alienDeployments.rul?

From I saw in the codes, clearly there's a transformation done from a surface team to an underwater team. If there's no underwater team, the game would crash by EXP2.bmp

I really want to deploy this Hybrid game of mine out next year.  My aim is, you can intercept, shoot down and do ufo crash sites from both sea and land. You can use any craft, however, the crashsites in the ocean are limited to a selected bunch of craft. I want the game to be able to handle in a way that it will warn you some craft or armor in your team is forbidden from being used in the underwatrer crash sites. 

You can build undersea bases. You have Aliens from TFTD and UFO but they are tweak in some ways, for example, the Tentulat is no longer an alien that turn your soldier into a zombie, it is now a melee bomb. Much like the popper.

I have human factions infiltrated by Terminators. So, when you are fighting Marsec or other Human factions, chances are their ranks have terminator infiltrated in them.  When any human dies, a terminator rises out as a terror weapon you deal with.

I am implementing a salvage mechanic, where you can't buy everything you want. You have to salvage dead tanks and corpses and rebuilt them for your own use.

You can't manufacture most Alien weapons, you can only capture and horde. You can built inferior version of their weapon.

It is my hope to have a black market system beside the normal market system where you can but certain faction aligned or rare good for a high price.

My game does not have any quest, just a straight up UFO + TFTD merge. Where the R&D is along the line with TFTD merging UFO and finishing on Cydonia.

This game has human factions that make your life difficult, infiltrated by Skynet with terminator robots as tough as Lobstermen or more. You can rebuilt your dead soldiers into tough HWPs like Universal Soldiers. You can also rebuilt certain alien corpse to fight with you.

Enemy human factions has tanks like you buy in the market, with Barrage rockets to stunt rockets. A few have nukes to throw at you.

When you started off, the weapons you have are downright primitive, from muskets to Panzerfaust. The Automatic rifles you have from the original ufo are just luxuries. Aliens have Toxic, Plasma, Ion and Sonic weapons. With Blaster bombs having Anti-mater warheads that can almost carve a ufo into half. So in this game, there are weapons that can wipe out a quarter of the map. I am also having plans to implement aliens like Teknomen, please check the anime for info. Teknomen are alien modified humans armed with alien armor and weapons, that can cut through anything with antimater weapons that can wipe out half of the battlefield. 

So, this is my mod. I hoping to have some interesting mechanic in it that's different from the other mod. I put out all my plans and cards here, hoping at least I get the right help at making this mod happens.






 



Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: The difference between surface and underwater team + Deployment.
« Reply #1 on: September 04, 2019, 08:37:03 pm »
STR_SECTOID_UNDERWATER is commented (#) thus the game will ignore and not load any lines that have a # at start

wcho035

  • Guest
Re: The difference between surface and underwater team + Deployment.
« Reply #2 on: September 04, 2019, 08:54:00 pm »
If you read carefully and look at those screen shots, the second test with snake men is not commented with #

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: The difference between surface and underwater team + Deployment.
« Reply #3 on: September 04, 2019, 10:09:04 pm »
Second image you posted, there's an error message saying that STR_SECTOID_UNDERWATER is missing, and the image is superimposed over commented code that excludes STR_SECTOID_UNDERWATER. Or 2+2=4.

If you don't want people to reach wrong conclusions and better help you, be more careful with what you show in all the images and don't assume we'll be able to figure it out.

Quote
1) Is there a transformation done between STR_SECTOID to STR_SECTOID_UNDERWATER? There are two different teams right?
Why is the engine asking for the sea team where it is a surface team that was shot down?

Because you have it defined somewhere in your code. The game doesn't perform such transformations on its own (sea and land are the same)

If I'm understanding correctly what you're trying to do (replacing the crews and alienDeployments every time a mission is at sea), I don't think it's possible.

wcho035

  • Guest
Re: The difference between surface and underwater team + Deployment.
« Reply #4 on: September 05, 2019, 05:34:59 am »
That’s precisely what I want to do, replace the sea team with a different deployment. From what  I have posted, I am trying to show the surface and sea team are two different teams. So, why is the sea team treated differently by the engine?  IF the surface team and the sea team are the SAME, then why did you need STR_SECTOID_UNDERWATER?  Why not use STR_SECTOID.

I am trying to understand.

A). Why the transformation not treating the two team differently? Yet it is two different team.

B) Is there a limitation to the engine that it can’t do a seperate deployment for the sea team?

C) If it is possible what extra coding is needed? What is missing to make it work? so I will dig into it.

wcho035

  • Guest
Re: The difference between surface and underwater team + Deployment.
« Reply #5 on: September 05, 2019, 02:19:52 pm »
I have been studying the codes for OXCE, I believe the reason the deployment does not work was because the underwater team exist only in battlescape. The under water team exist after the deployment was made not before.

So, instead of using craftcustomdeploy, it need a new code.

say Alien deployment transformation, similar to Armour transformation, the surface deployment get temporary transformed into sea deployment.

From Rulesenviroeffects.ccp, this is the function for Armour transformation. Perhaps it can be adapted for  Deployment transformation? Unfortunately, I am not familiar with the programming language use in its coding.

So from the function below, I can modify it


void RuleEnviroEffects::afterLoad(const Mod* mod)
{
   for (auto& pair : _armorTransformationsName)
   {
      auto src = mod->getArmor(pair.first, true);
      auto dest = mod->getArmor(pair.second, true);
      _armorTransformations[src] = dest;
   }

   //remove not needed data
   Collections::removeAll(_armorTransformationsName);
}

To

void RuleEnviroEffects::afterLoad(const Mod* mod)
{

        for (auto& pair : _armorTransformationsName)
   {
      auto src = mod->getArmor(pair.first, true);
      auto dest = mod->getArmor(pair.second, true);
      _armorTransformations[src] = dest;
   }
        auto surfacedep = mod->getdeploy(pair.first, true);
        auto seadep = mod->getdeploy(pair.second, true);
        surfacedep = seadep;
        Collections::removeAll(surfacedep);
        Collections::removeAll(_armorTransformationsName);
}


Now, I need new function getdeploy using getarmor as a reference. Perhaps this might work

wcho035

  • Guest
Re: The difference between surface and underwater team + Deployment.
« Reply #6 on: September 05, 2019, 02:39:20 pm »
Just found the function getArmour

int Armor::getArmor(UnitSide side) const
{
   switch (side)
   {
   case SIDE_FRONT:   return _frontArmor;
   case SIDE_LEFT:      return _sideArmor + _leftArmorDiff;
   case SIDE_RIGHT:   return _sideArmor;
   case SIDE_REAR:      return _rearArmor;
   case SIDE_UNDER:   return _underArmor;
   default: return 0;
   }
}

It is an int variable, that’s not going to work. So I have to search else where.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: The difference between surface and underwater team + Deployment.
« Reply #7 on: September 05, 2019, 03:19:44 pm »
What you're trying to do isn't possible:
1) There's no way to correctly replace all the alienRaces with their underwater equivalents. So you can only have 1 underwater alienRace (Sectoids or whatever) to replace all surface races by using the 'race' field on alienDeployments. Trying to get STR_SNAKEMAN or STR_FLOATER with STR_SNAKEMEN_UNDERWATER or STR_FLOATER_UNDERWATER won't work. They'll all have to be replaced by STR_SECTOID_UNDERWATER.

2) Second issue you have is to replace the alienDeployment from surface to submerged. First, you need a Geoscape that has the oceans replaced with textures, and then you need to assign a new deployment to the texture. The issue here is the same as before: you can only assign 1 alienDeployment, so STR_SMALL_SCOUT, STR_MEDIUM_SCOUT and STR_LARGE_SCOUT would all be replaced with the same submerged UFO.

3) Using missionCustomDeploy doesn't solve any of the previous issues: you can only use it to assign a specific alienDeployment to an alienRace. But 1) that will affect all crash sites, regardless of either being on land or submerged; and 2) You either keep the original race or you replace it with an underwater version; 3) Combine both previous and you can end up with all kinds of wrong combinations: a submerged alienDeployment actually taking place on land and with always the same submerged alienRace; etc.

wcho035

  • Guest
Re: The difference between surface and underwater team + Deployment.
« Reply #8 on: September 05, 2019, 05:39:38 pm »
Thank you for the Clarity Hobbes.

"Trying to get STR_SNAKEMAN or STR_FLOATER with STR_SNAKEMEN_UNDERWATER or STR_FLOATER_UNDERWATER won't work. They'll all have to be replaced by STR_SECTOID_UNDERWATER."

I am fully aware of that. In my posting before, I am testing if STR_SECTOID and STR_SECTOID_UNDERWATER are two different team. Which the test above has clarify that with snakemen copied into the STR_SECTOID_UNDERWATER  race. It is troubleshooting and checking my suspicion it is two team used, sea and land.

As for "a Geoscape that has the oceans replaced with textures" that's already done. I have a full working globe with underwater maps on it. It is a hybrid game.

"You need to assign a new deployment to the texture" I am fully aware of that. Unfortunately, I have come to a wall with the current existing build from OXCE. enviroeffects doesn't have options I seek. Armour transformation is great. I can transform all the armors of my enemy opponents, but what about the weapons they carry?

I can get away with Aliens, all their weapons are working for land and sea. For human factions, automatic rifle does not work underwater. I am wanting them to replace with Gas weapons.

The reason I choose the Aliendeployment option, each ufo having two maps, one for land and another for sea is because of the Starting conditions I can use in Alien deployment.

I can limit what craft can land on an undersea map and what armour my side is not allow to use and etc. Like helicopter can't land on the sea floor for example.

So I was thinking of doing a Aliendeployment transformation coding, similar to Armour transformation. On the land Aliendeployment is used, in the sea, another deployment is used.

You are right missionCustomDeploy doesn't solve the problem. I thought I did. I don't know if Meridian or the coders are going to include that kind of coding in the future build of OXCE this is the only critical missing link in making my mod work. Otherwise, a lot of exciting option I have to miss out.

I like to have human or terminator faction fighting out in undersea map, wearing Aqualungs and undersea armor.