aliens

Author Topic: UFO and TFTD in the single sequential campaign  (Read 20963 times)

Offline darkestaxe

  • Colonel
  • ****
  • Posts: 254
  • Emissary of the Brain
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #15 on: December 21, 2017, 01:34:51 pm »
An order to make this idea viable I would look at a transition system, ie 'What should this give you in TFTD?' and 'When do you get it?' In a story sense, UFO stuff cannot actually be directly used in TFTD, and funding status isn't going to directly change over. We'd need transitional items and a way to redeem them at the appropriate time, a way to rehire your old soldiers and formula for what their stats would become, a similar system for converting and redeeming base facilities, and determining the number of starting bases you have.

TFTD was more difficult by design but we'd still need to jump start alien aggression, probably by having extra active alien missions at the start. Aliens should be more busy in the first months to match X-COM starting off with extra resources, for obvious balance reasons.

    For Example:
    • Funding: UFO funding nations would each have a % applicability to TFTD funders. Only funding nations above normal base starting value would be considered. If a TFTD funder had 60% US applicability and 40% Canada applicability then the it's Base Funding-Rate Increase (BFI) would be 1 + (US funding- base US funding)/base US funding*0.6 + (Canada funding- base Canada funding)/base Canada funding*0.6. A BFI greater then 1 would increase the TFTD funders starting funding amount on a curve topping out at 2.5x funding.

    • Bases and Base Facilities: All players would start with 2 bases. One with normal starting facilities plus a second interception/investigation base (radar, stores, living quarters, 2 hangars). Players with more then two bases at the end of UFO would be granted 1 free new base for every 2 bases they had, to be placed when they see fit throughout their TFTD playthrough, thus you would get between 2 and 4 free access lifts depending on how many bases you had in UFO.

      All of the facilities the player had would be added up in a list of 'redeemable' facilities, which would built from the normal build facilities menu but have accelerated build times and reduced costs. They could be redeemed from the build facility menu also as the player sees fit, provided the proper research is done. TFTD starting facilities would be cut from your redeemable facilities at a 1 to 1 rate, after which each facility would be worth .5 of it's TFTD equivalent and you would receive a bonus .5 to the number of each facility type. Thus if you had 5 workshops and 3 Hyperwave Decoders between all of your UFO bases then, 1 workshop would be deducted for the initial Base 1, leaving you with 4*0.5 + 0.5 or 2.5 truncated to 2 redeemable workshops and 3*0.5 + 0.5 or 2 redeemable transmission revolvers.

      Redeemed facilities that the TFTD version normally would build in 15 days or less would redeem-build in 3 days with no construction cost, facilities that normally take 16-26 days in TFTD would build in 5 days when redeemed and cost 5% of their normal TFTD cost, 27+ take 8 days at 10% cost.

    • Purchasable and rentals: Scientists, Engineers, Skyrangers, Intercepters, etc are all rentals. You would be refunded any deposits (initial purchase cost) minus deposits already transferred to starting scientists, technicians, Tritons, and Barracudas. All other purchasable items would be liquidated. If you want TFTD equivalents, buy em.

    • Craft and HWPs: Craft and HWPs would be redeemable in the same way as facilities, but from a tab in the purchase/hire screen. Craft would be worth half a TFTD equivalent with a bonus 0.5, while HWPs would be 1 for 1. Celocanth w/Gause would either come with ammo or would have separate ammo production removed.

    • Redeemable Cores: Alien Grenades through heavy Plasma clips would become Plasma Ammo Cores, with heavy plasma clips giving more cores then plasma pistol clips. Weapons themselves become Plasma Weapon Cores. These would be a redeemable currency to get sonic weapons and ammo once researched, likewise Fusion based weapons and ammo would become the appropriate cores. Laser weapons would simply become laser cores, which make either gauss weapons or clips.

    • Soldiers: Prior soldiers would be rehire-able from a tab in the purchase/hire screen, their stats would truncated to the highest possible starting values +10. So a soldier with 80 TUs and 78 FA would show up as rehire-able from a list of prior soldiers but would now only have 70 TUs, that's 60+10, and 78 FA, since 70+10 is more then 78. Psy Strength would convert to Mol Strength with +/- random*15 + (Psy-Skill-30)/4. Only psy skills above 34 are used and starting Mol Strength cannot exceed the starting Mol Strength cap.

    • Everything Else: Any other manufacturer-able items would be redeemable for their monetary manufacturing cost. Redeemed items would transfer in the same amount of time as if they had been purchased. E-115 would be redeemable at a 4 to 1 ratio once zyrbite research is complete.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #16 on: December 27, 2017, 02:40:36 am »
An order to make this idea viable I would look at a transition system,
I wrote a long and detailed answer with a thorough analysis of your suggestions, which took me 5 evenings. Then it was all lost to a browser glitch :(

I'll be short then. What you suggest is a way to transfer games between UFO and TFTD. The only advantage is that they can stay separate. But it would still require much modification of engine to implement redeeming. It also allows to skip the interim period, where X-COM would have nothing to do and new missions will need to be invented.

The most noticeable new idea is the ability to downsize and later to invite the trained operatives back. Adds some depth.

The easiest way to implement redeeming is through money. Either all objects on a certain list (Avenger, Ellerium...) are automatically sold after the victory, or they are no longer allowed in any missions and the player can do nothing but sell them. Selling bases would be a nice addition.

What I suggested is the single unbroken game, where the victory at Cydonia gives several months of quiet and then Aquatoids start appearing much earlier than 2040s. Some balance-breaking objects would be taken away (in line with the game lore), but X-COM still has the chance to retain much of its resources, if the player acts correctly.

'What should this give you in TFTD?' and 'When do you get it?' In a story sense, UFO stuff cannot actually be directly used in TFTD, and funding status isn't going to directly change over.
Yes, it can, if the pause is short enough. Funding will remain several months after the victory — global international organizations tend to be slow, especially if every representative needs to inform his superiors they need to change their budgets again :) After that funding has to be reduced somehow. I suggest a lot of cheap quickly-expiring missions, that would not drive X-COM to disbanding, but will keep the score negative. Or if the engine allows — just reduce the funding by 90% after the victory or 3 months after the victory. Or to 0 at victory and then increase it according to the month's score (but that would look to much like a game glitch) :)

TFTD was more difficult by design but we'd still need to jump start alien aggression, probably by having extra active alien missions at the start. Aliens should be more busy in the first months to match X-COM starting off with extra resources, for obvious balance reasons.
Maybe. I'm thinking about high number of missions and their high variability. Don't forget that X-COM would have to rearm itself for the new environment and that would require a lot of money.

Funding:
All countries are the same, but their control zones from the start include pieces of oceans. The funding was reduced after the victory, but something remains.

Bases and Base Facilities:
I see no justification for floating bases. Hyperwave decoders should still work fine. (Unless the official lore says why they can't. Does it?) If not, radars would still detect USOs above water, and a single sonar wouldn't see far underwater — they'd need a network of buoys, the control centre of which may just as well be far inland. Still, there should be a range limit for the network and some inconveniently located bases would have to be relocated. This is where selling facilities or bases would be handy.

Scientists, Engineers, Skyrangers, Intercepters, etc are all rentals.
You get them by paying a monthly wage/price in advance, and you get nothing for letting them go. That simple. The only question is how to add subs to the list. Right after Cydonia would be ugly. Triggered by a mission against Aquatoids or Gillmen?

Craft and HWPs:
Same as anything else in the stores. Some stuff is requisitioned by the Council after the victory, the rest remains. Let's also follow the official lore that alien alloys and ellerium slowly dissolve in seawater. There'd be limitations on what can go to underwater missions, but the rest will be usable.

Redeemable Cores:
Useful idea, but not here. But it gave me another idea. If all ellerium was requisitioned for expeditions to Mars, but X-COM is tasked with recovering old UFO wrecks, there may be a loophole that it can extract ellerium from any found weapons. It contradicts the short stories, though.


Soldiers: Prior soldiers would be rehire-able
Good idea. Downsize the bases, then rehire the veterans next year. Some may refuse to return. I doubt the engine can do that, can it?

E-115 would be redeemable at a 4 to 1 ratio once zyrbite research is complete.
If the interplanetary search for ellerium yields something quickly enough, ellerium would become purchasable. Guess, it has to be expensive for balance reasons.

There are many approaches of how to merge the two together:
- from the simplest of just starting TFTD new game automatically after win at cydonia (which is nothing else than saving the user two or three clicks to do it manually)
- to a complete engine rewrite (and potentially completely new artwork)

First the idea needs to be formulated, then reviewed for feasibility, then compromises will inevitably be made... and then a lot of time will be required for both coding and modding.

In my humble opinion a "complete" merge is too much effort for little to no gain.

Personally, I didn't like the starting premise of TFTD. So, let's not give X-COM a chance to stagnate.

What I'm talking about is a standard UFO playthrough with additions:
  • Cydonia or Bust doesn't end the game.
  • All of TFTD content is moved to the mod. (Or is it easier the other way around?)

I see several variants requiring from no to significant modifications of the engine. I tried to compile the list of questions about the engine capabilities:
  • Which would be easier: implementing UFO as a mod for TFTD or TFTD as a mod for UFO? (I assume no difference and pick the latter.)
  • Can UFO-based mod use TFTD sprites? Artwork? Maps? Paths? Rulesets? If no, to what extent can their extraction be automated? (I've seen scripts that came with UFO:TTS, but didn't study them.)
  • UFOs that crash in the sea disappear. USOs remain, both in water and on dry land. What is the difference? (I assume it can be set on the mod level.) Will it require remaking the whole globe?
  • Can a craft sent to Cydonia disappear for a few days? (I assume no.)
  • A mission can be unlocked by timer from the start, by research or by winning another mission. Can a mission be unlocked by timer started by another mission? Like Aquatoids start to attack 6 months after Cydonia. (I assume no.)
  • Can a mission trigger a change in funding? (I assume no.)
  • Can a mission render all Ellerium unusable? (I assume yes.)
  • Can all Avengers be forcefully sold after an event? (I assume no.)
  • Can an expired mission automatically become another mission? (I assume no.)
  • Is there a limit on the number of missions available in Geoscape at the same time? (I assume no.)
  • Is it possible to combine water and dry land in the same mission? Can water be implemented as smoke?
  • Is it possible to upgrade base facilities?
  • Is it possible to sell base facilities or the whole base?
  • How hard would be implementing rehiring veterans? For example, an operative is downsized, but several months later is invited to join again. He can refuse (the dates when he agrees or refuses are encoded by the hash of his stats).
  • Can USOs become invisible for radars (but stay visible for sonars) when they dive?
  • Can soldiers have more characteristics on the statistics screen than standard? I know of various damage resistances, but how about 2 sets of parameters for 2 kinds of mind control: psionic and "molecular"?

Here are the variants of the scenario:
  • No extra missions. Just the proof that all relevant TFTD content can be put into a mod, with essential adjustments. No engine modifications required. Victory at Cydonia unlocks all TFTD gear and aquatoids start attacking next month.
    When I started this thread, I hoped somebody had already done it :) What needs to be there?
    • Zones of control over seas.
    • All TFTD units.
    • All TFTD items.
    • All TFTD X-COM craft.
    • All TFTD ports and islands.
    • All TFTD alien missions, with necessary changes to retaliation (see below).
    • X-COM builds bases on dry land only.
    • Sonars and transmission receiver are replaced with radars and hyperwave decoder.
    • Psionics instead of MC.
    • All weapons work in both environments, unless TFTD says otherwise. For simplicity.
    Anything else?
  • Same as above with drowned UFO recovery. Required extra engine features: none. Desired extra engine features:
    • Missions unlocked by timer and events.
    • Expiring missions create new missions.
    Changes:
    • The craft to recover drowned wrecks is available from the start, but it's something more mundane than flying subs, like tilt-rotor hydroplane.
    • Underwater suits and harpoon guns are also available — operatives are armed just in case.
    • They may instead/additionally have more realistic modern underwater weapons.
    • Fresh drowned UFOs may have survivors. Old drowned UFOs may have TFTD terror units. Or just the latter, if feature isn't available.
    • Have to decide if lasers are waterproof. If no, there may be an extra weapon line.
    • Gauss weapons are unlocked by plasma research.
    • Plasma weapons are not waterproof. If found in the wreck, they won't work, but may be intact afterwards.
    • Skyranger, Lightning and Avenger can't be sent to an underwater mission.
    • Flying subs can be researched at some point. Should they be unlocked by Lightning? Or Lighning + Cydonia? Or Lightning + underwater enemy? They are still purchasable, not manufactured. (Can they be both?)
    • Tanks and hovertanks are not allowed to underwater missions.
    • Earth diving suits have a depth limit. Coelacanths start as an unarmed drone for deep underwater work.
    • Armed coelacanth research is unlocked by an underwater enemy.
    • After the victory at Cydonia X-COM starts getting missions to recover UFOs downed by other forces.
    • There can also be missions to recover UFO wrecks on dry land.
    • Underwater wrecks now may have small numbers of armed TFTD aliens in them.
    • Dry wrecks may have surviving Reapers, Floaters, Snakemen, Mutons, Silacoids, Celatids. Or hostile armed humans.
    • 12 months after Cydonia TFTD aliens start attacking. If this is impossible, they start attacking after X-COM does all existing kinds of recovery missions, and the mod needs enough kinds to last a year.
  • Council searches for ellerium. They even find it, but too late to make a difference. This can be implemented before the previous item. Or together.
    Required extra engine features: none. Desired extra engine features:
    • Missions unlocked by timer and events.
    • Confiscating items after an event.
    Changes:
    • After Cydonia all ellerium and ellerium-powered craft is requisitioned by Council. X-COM is still allowed to use in any way any ellerium it recovers later. Also use the existing mod to extract ellerium from weapons.
    • If confiscation is impossible, X-COM is prohibited to use Ellerium, weapons and craft and can only sell them. This order will be cancelled after research of TFTD "Alien Origins". Or another proof how grave the situation is.
    • 2 years after Cydonia Ellerium becomes purchasable. Or in 2005. Or when?
  • Balancing. Primarily, relieving X-COM of its riches before TFTD part starts. To up the challenge. Again, can be implemented before the previous 2 items.
    Required extra engine features: none. Desired extra engine features:
    • Missions unlocked by timer and events.
    • Changing funding after an event, possibly by timer too.
    • Re-hiring downsized operatives.
    Changes:
    • After Cydonia Council informs you, that since the threat is gone, much of your income is gone too. This can happen next month, or it can be stretched over a few months.
    • If it is impossible, there can be a workaround. A series of missions called "Alien Sighted" that allow to capture a single Deep One or someone equally useless. The score is small, but the missions expire quickly and there are too many to reach every site even with 64 Skyrangers. This results in negative score and decrease in funding. The trick is keeping the score sufficiently high to avoid game over, while not allowing it to become positive.
  • Everything else. All the work that can reasonably be expected when switching from infantry to underwater operations. Upgrading radars to sonars. Moving bases closer to the shore. Discovering that people without psionic skills can still be useful with an MC implant. Combined air-water missions. Reimplementing UFO inventions with zrbite instead of ellerium: air-flying magnetic armour, air-flying torpedos... But it's too early for that yet.
« Last Edit: December 27, 2017, 01:07:52 pm by tkzv »

Offline Etaoin

  • Squaddie
  • *
  • Posts: 1
  • "Unable to throw there!"
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #17 on: August 27, 2018, 12:18:56 am »
Apologies for the necropost, but I'm new here and didn't feel what I had to say warranted a new thread...

Firstly, a big thanks to everyone involved in making OpenXcom - I've been a fan of these games since they came out and consider them unmatched to this day in terms of strategy, atmosphere and difficulty. It's truly awesome to still be able to enjoy them today, cleanly rewritten and free of bugs - under Linux - and with lots of little enhancements. Nice work guys!

But I primarily registered here to reply to this thread, because as I've immersed myself yet again in the complex and challenging task of saving the earth from its benthic bane (yes, I'm on the nightlies - quite literally too), I cannot get it out of my head how insanely great it would be if both games could be combined into a new, third game, which included both land and sea X-Com bases and alien colonies, and all the different terrains, aliens and mission types provided. Personally, I couldn't care less about keeping the original timeline - in fact it would probably make more sense if it was positioned as a continuation of the storyline, or even a (partial) rewrite(!)*. Ruleset/AI would be TFTD. Weapons, craft and equipment included only where appropriate, and modified when appropriate. Troops dedicated to land or sea, but land/sea capability of weapons and craft adjusted (e.g. the Barracuda should be able to engage over land as well). Technology trees merged as far as possible (and sensible)**. Perhaps an entirely new endgame tree. Anything that doesn't fit, doesn't work, or creates too much complication: dropped*.

It's been said in this thread that this is the "holy grail" of OpenXcom, and that it is a topic often discussed in these forums, yet my search attempts only turned up this one remotely relevant discussion in the past year. If we all want it so bad, what efforts are going into making it happen? If none, what are the show-stoppers?

Etaoin

*) It's not gospel you know.
**) This sounds to me as the single most difficult task here?

P.S. Radical thought: no more throwing of things under water!
« Last Edit: August 27, 2018, 12:27:28 am by Etaoin »

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #18 on: October 02, 2018, 03:02:33 am »
Apologies for the necropost,
Not a problem here, it seems :)

how insanely great it would be if both games could be combined into a new, third game, which included both land and sea X-Com bases and alien colonies, and all the different terrains, aliens and mission types provided.
Thanks for your kind words.

Anyway, after postponing this again and again, I decided to start. But I've got questions to specialists.

First step would be recovering of crashed UFOs from the sea in 1999. (Assuming all aliens drowned.) This requires:

1. A globe where sea is a separate terrain.

2. A terrain that kills all sectoids (for example).

Part 1 is tedious, but straightforward. Decode UFO/GEODATA/WORLD.DAT and  TFTD/GEODATA/WORLD.DAT, identify overlapping polygons, correct them, add polygons from TFTD/GEODATA/WORLD.DAT to UFO/GEODATA/WORLD.DAT. Maybe use the globe from Terrain Pack ( https://openxcom.mod.io/terrain-pack ) instead of UFO/GEODATA/WORLD.DAT. The Python script is ready, but doesn't work yet :)

I still don't understand some things about terrains:
1. Is there a limit to the number of terrains? Can I simply continue numbering TFTD terrains after 21 (for Terrain Pack)?
2. How are crashed UFO maps are generated? At what point do exploding engines kill part of the crew? How do I kill all UFO crew for underwater terrains?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11401
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: UFO and TFTD in the single sequential campaign
« Reply #19 on: October 02, 2018, 11:35:44 am »
I think it's also a balance issue: shoot down a UFO over the ocean, recover all tech and corpses at no risk.
There are no practical limits to number of terrains. I have dozens in XCF.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #20 on: October 02, 2018, 05:48:29 pm »
There are no practical limits to number of terrains. I have dozens in XCF.
In the globe_XCOMFILES.rul you have several terrains for each non-negative ID except 12. How are they picked? Randomly according to weight?
What is the purpose of negative IDs? Only for mission maps?

I think it's also a balance issue: shoot down a UFO over the ocean, recover all tech and corpses at no risk.
I want to partially destroy the equipment and eventually add sea monsters. The question is: how to kill aliens and destroy their ship?

(Note to self: https://openxcom.org/forum/index.php/topic,6201.0.html )
« Last Edit: October 02, 2018, 07:55:49 pm by tkzv »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11401
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: UFO and TFTD in the single sequential campaign
« Reply #21 on: October 02, 2018, 07:57:47 pm »
In the globe_XCOMFILES.rul you have several terrains for each non-negative ID except 12. How are they picked? Randomly according to weight?

Yes, exactly.

What is the purpose of negative IDs? Only for mission maps?

It doesn't matter if the number is negative or positive, it's simply a convention of discerning between globe texture terrains and deployment-specific terrains. This is in accordance with vanilla, where terror missions are -1.

I want to partially destroy the equipment and eventually add sea monsters. The question is: how to kill aliens and destroy their ship?

Umm... With blaster bombs? :D
But seriously, I don't understand your question. Is this about ship crashes? If yes, then it's hardcoded, sorry.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #22 on: October 02, 2018, 11:08:32 pm »
But seriously, I don't understand your question. Is this about ship crashes? If yes, then it's hardcoded, sorry.
Yes, when the ship crashes, all aliens die and the water slowly destroys everything of value. There should be several stages leaving less and less. Is it possible to replace a crashed UFO mission with another crashed UFO mission else when it expires? Thus leaving less and less with each iteration.

And speaking of replacing. Is it possible to replace aliens? In underwater missions in XCF there are tables of what armour replaces what. Perhaps, more importantly, in TFTD some aliens replace some other aliens between a crashed terror ship and a terror mission. Is it possible to replace aliens like that in a mod?

Or what happens with dogs in underwater missions in XCF?


Meanwhile, WORLD.DAT from UFO and TFTD proved mostly incompatible — there's a total of 6 common vertices in those maps:
(0, 0) — 4 in UFO, 8 in TFTD.
(0, 2806) — 4 in each
(0, 2871) — 4 in each
(0, 56) — 4 in each
(0, 82) — 8 in each
(5, 0) — 8 in UFO, 4 in TFTD
I'll try to merge them anyway...
« Last Edit: October 03, 2018, 12:14:33 am by tkzv »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11401
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: UFO and TFTD in the single sequential campaign
« Reply #23 on: October 03, 2018, 01:42:14 am »
Sorry, armour transformations only work on X-Com units, not aliens.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #24 on: October 03, 2018, 03:01:28 am »
Sorry, armour transformations only work on X-Com units, not aliens.
What about drowning dogs? Same problem?

Anyway, I figured a quick and dirty way to add oceans. Just adding the required "rectangles" at the start of WORLD.DAT, their descriptions to globe.textures and textures to extraSprites proved enough. The rest of the world is drawn over this new terrain. 160x160 rectangles seem large enough to generate few facets (18x9=162), but small enough to avoid visible separation of land from the sea.
Spoiler:
Tested with Terrain Pack. Added the terrain as #25, because 0-24 already have textures in TEXTURES.PNG.
1. Add 32x96 bar of tetures to the right side of Terrain Pack/Resources/Geoscape/TEXTURES.PNG
2. Change TEXTURE.DAT description in Terrain Pack/Ruleset/Terrain_Pack_Sprites.rul accordingly (under extraSprites):
Code: [Select]
  - type: TEXTURE.DAT
    width: 832
    height: 96
    subX: 32
    subY: 32
    files:
      0: Resources/Geoscape/TEXTURES.PNG
3. Add to globe.textures section of Terrain Pack/Ruleset/Terrain_Pack_Geoscape.rul:
Code: [Select]
    - id: 25
      terrain:
        - name: OCEAN
          weight: 10
4. Run the following Python script to add 18x9 "rectangles", 160x160 each:
Code: [Select]
#!/usr/bin/python3
from numpy import reshape, set_printoptions, array, frombuffer, int16, concatenate

fi = '../.local/share/openxcom/mods/Terrain Pack/Resources/Geoscape/IMPROVEDGLOBE.DAT.old'
fo = '../.local/share/openxcom/mods/Terrain Pack/Resources/Geoscape/IMPROVEDGLOBE.DAT'
set_printoptions( threshold=1000000 )

bAri = open(fi,'rb').read()
ari = reshape( frombuffer( bAri, dtype=int16 ), (-1, 10) )
add = []
step = 160
for lat in range(-720, 720, step):
    for lon in range(0, 2880, step):
        add += [[lon       % 2880, lat,
                (lon+step) % 2880, lat,
                (lon+step) % 2880, lat+step,
                 lon       % 2880, lat+step, 25, 0 ]]
add = array( add, int16 )
ari = concatenate( (add, ari) )
f = open( fo, 'wb' ).write( ari.tobytes() )

So, any large body of water now allows landing of alien craft. Except that it should crash the game at this point. :)

Next step: either figuring a way to kill aliens in water, or making up rules to recover drowned craft with aliens still alive.

I wonder what can scripts do about this? I've got an event — start of a Battlescape mission on a specific terrain. I've got a value — time elapsed after the crash. I need to alter the Battlescape map accordingly.


Update: Merged the globes and lists of terrain. Attached the mod as "merged_terrains.7z".

Spoiler:
Here are the scripts:
Merging globes:
Code: [Select]
from numpy import reshape, set_printoptions, array, int16, concatenate, fromfile

f1 = '../.local/share/openxcom/UFO/GEODATA/WORLD.DAT'
f2 = '../.local/share/openxcom/TFTD/GEODATA/WORLD.DAT'
fo = 'newworld.dat'
set_printoptions( threshold=1000000 )

ar1 = fromfile( f1, dtype=int16 )
ar2 = fromfile( f2, dtype=int16 )
ar1 = reshape( ar1, (-1, 10) )
ar2 = reshape( ar2, (-1, 10) )
for e in ar2:
    e[8] += 13
aro = concatenate( (ar2, ar1) )
open( fo, 'wb' ).write( aro.tobytes() )

Merging textures, TFTD textures are converted to UFO palette.
Code: [Select]
from numpy import reshape, set_printoptions, array, frombuffer, int16, concatenate, fromfile, uint8, zeros, dot, argmin
from PIL import Image

def yccs( a1 ):
    return dot( array( ((0.299,    0.587,    0.114   ),
                        (0.168736, 0.331264, 0.5     ),
                        (0.5,      0.418688, 0.081312)) ), a1 )


f1 = '../.local/share/openxcom/UFO/GEOGRAPH/TEXTURE.DAT'
f2 = '../.local/share/openxcom/TFTD/GEOGRAPH/TEXTURE.DAT'
p1 = '../.local/share/openxcom/UFO/GEODATA/PALETTES.DAT'
p2 = '../.local/share/openxcom/TFTD/GEODATA/PALETTES.DAT'
fo = 'merged.png'
set_printoptions( threshold=1000000 )

ar1 =  fromfile( f1, dtype=uint8 )
pal1 = fromfile( p1, dtype=uint8 )
pal1 *= 4
pic1 = Image.frombuffer( 'P', (32, 13*32*3), ar1, 'raw', 'P', 0, 1 )
pic1.putpalette(pal1[0:768])

ar2 =  fromfile( f2, dtype=uint8 )
pal2 = fromfile( p2, dtype=uint8 )
pal2 *= 4
pic2 = Image.frombuffer( 'P', (32, 13*32*3), ar2, 'raw', 'P', 0, 1 )
pic2.putpalette(pal2[0:768])

cmpM = zeros( (256, 256), float )
palj1, palj2 = zeros( (256,3), float ), zeros( (256,3), float )
for c in range(0, 256):
    offs = c*3
    palj1[c] = yccs( pic1.getpalette()[offs:offs+3] )
    palj2[c] = yccs( pic2.getpalette()[offs:offs+3] )
for c1 in range(0, 256): # 768, 3):
    for c2 in range(0, 256): # 768, 3):
        cmpM[c2, c1] = sum( abs( palj2[c2] - palj1[c1] ) )
newPal  = zeros( 768, uint8 )
for c2 in range(0, 256):
    c1 = argmin( cmpM[c2] )
    newPal[c2*3:c2*3+3] = pic1.getpalette()[c1*3:c1*3+3]
pic2.putpalette(newPal)
picp = pic2.convert( mode = 'RGB' ).quantize( colors=256, palette=pic1 )

picc = Image.new( 'P', (32*13*2, 32*3) )
picc.putpalette(pal1[0:768])
for frame in range(13):
    for z in range(3):
        block = pic1.crop( (0, frame*32+z*32*13, 32, frame*32+32+z*32*13) )
        picc.paste( block, ( frame*32, z*32 ) )
        block = picp.crop( (0, frame*32+z*32*13, 32, frame*32+32+z*32*13) )
        picc.paste( block, ( 32*13+frame*32, z*32 ) )
picc.show()
picc.save( fo )

The seas look good in the daylight: see merged1.png
Not so good at night: see merged2.png, merged3.png, merged4.png

Can anybody explain how does day-night lighting work? Why do light blue colours become yellow in the shadow?
« Last Edit: October 07, 2018, 10:37:04 pm by tkzv »

Offline Yankes

  • Commander
  • *****
  • Posts: 3185
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #25 on: October 08, 2018, 05:02:40 pm »
Palette, original UFO used 32 values for ocean and your graphic probably not.
https://www.ufopaedia.org/index.php/File:1_GeoScapePal.Png
This is hardcoded:
https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Geoscape/Globe.cpp#L203

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #26 on: October 08, 2018, 11:32:56 pm »
Palette, original UFO used 32 values for ocean and your graphic probably not.
https://www.ufopaedia.org/index.php/File:1_GeoScapePal.Png
This is hardcoded:
https://github.com/Yankes/OpenXcom/blob/OpenXcomExtended/src/Geoscape/Globe.cpp#L203
Thanks for the link to the source.

As far as I can tell, the problematic textures are shaded the same way as the land textures. Land textures seem to use colours in groups of 16. That allows simple shifting to darker shades. But the new ocean textures use mainly blue colours 80-89 and 245-251, which are shifted to 90-95 and 252-255, which are yellow. Is it possible to change this palette with a YAML file?

The code has the following constants:
Globe::OCEAN_COLOR = Palette::blockOffset(12);
Globe::COUNTRY_LABEL_COLOR = 239;
Globe::LINE_COLOR = 162;
Globe::CITY_LABEL_COLOR = 138;
Globe::BASE_LABEL_COLOR = 133;

Is Globe::OCEAN_COLOR = 12*16 = 152? Is it possible to redefine the palette for 152-183 range and use it for textures? Will it still be shaded by ocean rather than land rule? (Even if yes, it would be OK.)
« Last Edit: October 09, 2018, 12:29:45 am by tkzv »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1510
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #27 on: October 09, 2018, 08:54:10 pm »
I am very interested to see how this turns out because I want to use the results for adding land to TFTD.

Offline Yankes

  • Commander
  • *****
  • Posts: 3185
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #28 on: October 09, 2018, 09:21:25 pm »
Thanks for the link to the source.

As far as I can tell, the problematic textures are shaded the same way as the land textures. Land textures seem to use colours in groups of 16. That allows simple shifting to darker shades. But the new ocean textures use mainly blue colours 80-89 and 245-251, which are shifted to 90-95 and 252-255, which are yellow. Is it possible to change this palette with a YAML file?

The code has the following constants:
Globe::OCEAN_COLOR = Palette::blockOffset(12);
Globe::COUNTRY_LABEL_COLOR = 239;
Globe::LINE_COLOR = 162;
Globe::CITY_LABEL_COLOR = 138;
Globe::BASE_LABEL_COLOR = 133;

Is Globe::OCEAN_COLOR = 12*16 = 152? Is it possible to redefine the palette for 152-183 range and use it for textures? Will it still be shaded by ocean rather than land rule? (Even if yes, it would be OK.)
Ok, I see when Warboy or SupSuper add support for TFTD they add loading of this value:
https://github.com/SupSuper/OpenXcom/blob/13049d617fe762b91893faaf7c14ddefa49e2f1d/src/Mod/RuleGlobe.cpp#L138
This mean if you change `oceanPalette` in `globe` then you can alter what color is used.

Offline tkzv

  • Commander
  • *****
  • Posts: 583
    • View Profile
Re: UFO and TFTD in the single sequential campaign
« Reply #29 on: October 10, 2018, 02:09:39 am »
Ok, I see when Warboy or SupSuper add support for TFTD they add loading of this value:
https://github.com/SupSuper/OpenXcom/blob/13049d617fe762b91893faaf7c14ddefa49e2f1d/src/Mod/RuleGlobe.cpp#L138
This mean if you change `oceanPalette` in `globe` then you can alter what color is used.
Thanks. I see that it also allows changing "countryColor", "cityColor", "baseColor" and "lineColor". How is it written in the YAML file?
Code: [Select]
globe
  data: path/to/new/WORLD.DAT
  polygons: [...]
  polylines: [...]
  textures:
    - id: 21
    - delete: 10
  countryColor: 10
  cityColor: 15
  baseColor: 25
  lineColor: 120
  oceanPalette: 180

But I was asking how to change the whole Geoscape palette.
Here is something to replace the whole GEODATA/PALETTES.DAT: https://github.com/SupSuper/OpenXcom/blob/0854dec7da01a14503f750aecaf6c624df33859a/src/Mod/Mod.cpp#L2508
Here is something to read palettes from *.rul files:
https://github.com/SupSuper/OpenXcom/blob/0854dec7da01a14503f750aecaf6c624df33859a/src/Mod/Mod.cpp#L591
https://github.com/SupSuper/OpenXcom/blob/0854dec7da01a14503f750aecaf6c624df33859a/src/Mod/Mod.cpp#L602
But what is the syntax? I can't quite figure it from the C++ code.

I am very interested to see how this turns out because I want to use the results for adding land to TFTD.
I can try it when I have time. This weekend, probably. Just swap "UFO" and "TFTD" in the paths for the 2nd script.

I still don't understand how exactly the shade is drawn. Does the engine check each pixel of the globe if it's in "ocean palette" and change its colour accordingly?


P.S. Interesting side effect. In TFTD the combined globe allows placing bases on the dry land. Considering that TFTD prohibited bases over some parts of oceans, and that UFO shouldn't build in oceans at all, it should be possible to limit that somehow. I'll need to investigate further.
« Last Edit: October 10, 2018, 02:14:27 am by tkzv »