aliens

Author Topic: OXCE (OpenXcom Extended) main thread  (Read 592897 times)

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #15 on: October 12, 2018, 09:45:35 pm »
I somehow fail to understand the examples.
For example, if a craft had fuelMax 60 and you mod it to have fuelMax 20, it won't be 80... it will just be 20.

If you can please rewrite the example with real ruleset attribute names (instead of "fuelStorage", "mod stat|fuelMax" etc. ) and real values, it would help me understand it.

Also, the formula is wrong, no matter how I look at it... aircraft's net fuelMax is just its fuelMax plus fuelMax of all its equipped "weapons".
So X = Xa + (Y1 + Y2 + Y3 + Y4), where Y1-Y4 are fuelMax of the equipped weapons.
Your variables A and B are nowhere in the formula, and I don't even know what Xb is supposed to be.

I tried to make it as clear as possible.

fuelStorage: A - this is the attribute I am suggesting be added, as I explained in previous posts
refuelRate: B - the refuelRate attribute on craft
aircraft fuelMax: Xa - the fuelMax attribute on craft
mod stat|fuelMax: Xb - the fuelMax attribute on craftWeapon
net fuelMax: X - the total fuelMax attribute used by the aircraft when you use it in-game
X = (A*B) + Xa + Xb


Code: [Select]
crafts:
  - type: STR_INTERCEPTOR
    fuelMax: 800
    refuelRate: 50
    weaponTypes:
      - 1
      - 1
      - [0, 1, 2]
    weaponStrings:
      - STR_AIR_WEAPON_SMALL
      - STR_AIR_WEAPON_SMALL
      - STR_AIR_WEAPON_MEDIUM
  - type: STR_UPGRADE_FUEL_TANKS_A
    stats:
      fuelMax: 200
    launcher: STR_UPGRADE_FUEL_TANKS_A_UG
    weaponType: 1
  - type: STR_UPGRADE_FUEL_TANKS_B
    stats:
      fuelStorage: 6
    launcher: STR_UPGRADE_FUEL_TANKS_B_UG
    weaponType: 1

The Upgrade A would add 200 to the Interceptor's fuel capacity, while the Upgrade B would add 300 to its fuel capacity (refuelRate: 50 * fuelStorage: 6).

- - - - -

EDIT:
or make the same fuel tank's capacity vary by the craft it's mounted on? It that what you're suggesting, Reaver?
My suggestion would have that effect.

I'm trying to get fuel tanks that adjust their size to the size of the fuel tanks of the craft they're being put on. To give a strong example, I have two craft which both use elerium fuel: the Firestorm and the Stalker. The Firestorm has a fuelMax of 30 and a refuelRate of 10, while the Stalker has a fuelMax of 1000 and a refuelRate of 100. If I make a fuel upgrade that increases fuel by 30, it'll double the Firestorm's fuel capacity (which will then cost +3 elerium to refuel) but the Stalker's capacity will only be increased by 3%, and it'll use only 30% of the extra 1 elerium it takes to fill it to full. But if I make a fuel upgrade that increases fuel by 300, while it will increase the Stalker's flight time by 30% and its refuel cost by 3 elerium, if applied to the Firestorm its fuel capacity would go up to 330 and it would take 33 units of elerium to refuel it.

And I can't just use a different kind of fuel tank for the two craft because I have other refuelRates on other craft:
Firestorm: 10
Heracles: 40
Assassin: 75
Stalker: 100
And more. I don't want to make a different fuel upgrade for every differing level of fuel efficiency.

- - - - -

As far as I understood his idea, he suggests changing the fuel efficiency, and not the amount of fuel itself.
I am interested in such a feature, but it wasn't my primary suggestion. I was suggesting a feature which would give an amount of fuel that is altered by the craft's fuel efficiency (specifically multiplied by its refuelRate attribute).

It would be cool to be able to change craft efficiency. Howabout a factor in which you increase refuelRate by a percentage? It would be nice to also have one which increases fuelMax by a percentage. The math on these percentage increases is easy: you add together the percentage bonuses on all the modules with the same attribute, and then increase the craft's value by the final percentage.

For example, I equip a Fuel Tank A (fuelPercent: 30) and a Fuel Tank B (fuelPercent: 50) to a craft with 500 fuelMax. You add together the two fuel tanks to get an 80% increase to the craft's fuelMax, which brings it to 900.

To make another example, I equip Fuel Efficiency Mod A (fuelEfficiency: 25) and Fuel Efficiency Mod B (fuelEfficiency: 160) to a craft with a refuelRate of 40. You add together the two mods to get a 185% increase to fuel efficiency, which brings the craft's refuelRate to 114.

Offline Stoddard

  • Colonel
  • ****
  • Posts: 485
  • in a fey mood
    • View Profile
    • Linux builds & stuff
Re: OpenXcom Extended (OXCE) main thread
« Reply #16 on: October 12, 2018, 09:55:36 pm »
My suggestion would have that effect.


Then why just not make a new attribute for the equipment item, like fuelMaxPercentage or something, exclusive with the old fuelMax attribute, which will just add that much percent of the craft's fuelMax?

i.e.

Code: [Select]
craftFinalFuelMax = craftFuelMax * ( 100 + slotA.fuelMaxPercentage + slotB.fuelMaxPercentage + ... ) / 100

This story with making it depend on refuelRate is kind of too complicated in my opinion.


EDIT: or, alternatively, express equipment fuelMax in units of refuelRate (which is the core of your suggestion I think).

But there's no reason to keep the old equipment's fuelMax around - it'll only complicate things and waste fuel
« Last Edit: October 12, 2018, 10:02:42 pm by Stoddard »

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #17 on: October 12, 2018, 10:26:10 pm »
I just want one of these things, or something to solve my dilemma.

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9075
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #18 on: October 14, 2018, 03:08:15 pm »
New OXCE version is up.

2018-10-14
 - Missions spawned by alien bases can now target different regions: https://openxcom.org/forum/index.php/topic,6557.msg104976.html#msg104976
 - Added mod switch for HK fast retarget: https://openxcom.org/forum/index.php/topic,5717.msg104986.html#msg104986
 - Added support for alien missile strikes (on Geoscape): https://openxcom.org/forum/index.php/topic,6557.msg104920.html#msg104920
 - Added support for Earth-based alien operations: https://openxcom.org/forum/index.php/topic,6557.msg104669.html#msg104669
 - Script support for post-mission soldier stat improvement: https://openxcom.org/forum/index.php/topic,6619.msg104686.html#msg104686
 - Protect Stats for Nerds "related items" that are not unlocked yet (ammo, built-in-items, ...)
 - Support for alien base upgrades (based on its age): https://openxcom.org/forum/index.php/topic,6430.msg104530.html#msg104530
 - More scaling options for very high resolutions: https://openxcom.org/forum/index.php/topic,6620.0.html

Download: https://openxcom.org/forum/index.php/topic,5258.0.html

Disclaimer: breaking change for hunt missions... please update your mods, more info: https://openxcom.org/forum/index.php/topic,5717.msg104986.html#msg104986

Offline gix

  • Sergeant
  • **
  • Posts: 46
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #19 on: November 24, 2018, 03:02:15 pm »
Since I didn't see any post mentioning a bug-dedicated thread, I'll put this here.
I noticed a weird bug (using latest GIT commits) => when selecting an item in the inventory screen, it's BIGOBS sprite doesn't follow the mouse cursor, but is stuck at (0,0) coordinates.
Changing Inventory.cpp blit:
Old
Code: [Select]
_selection->blitNShade(this, 0,0);
New
Code: [Select]
_selection->blitNShade(this, _selection->getX(), _selection->getY());
Seem to solve the issue.
Awaiting to confirm this in order to PR an OXCE-updated inventory per armor feature (see OXC PR1210)...
« Last Edit: November 24, 2018, 03:09:15 pm by gix »

Offline Yankes

  • Global Moderator
  • Commander
  • ***
  • Posts: 3345
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #20 on: November 24, 2018, 03:51:57 pm »
Yup, another side effect of my big refactor. As you already did it and test that then create pull request, I will merge it.

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9075
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #21 on: November 24, 2018, 04:38:36 pm »
Awaiting to confirm this in order to PR an OXCE-updated inventory per armor feature (see OXC PR1210)...

I've seen this in OXC and I need to have a closer look at it... but most likely I will take it into OXCE.

And after a bit of testing, it will probably be merged to OXC as well.

Offline gix

  • Sergeant
  • **
  • Posts: 46
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #22 on: November 24, 2018, 10:58:48 pm »
I've seen this in OXC and I need to have a closer look at it... but most likely I will take it into OXCE.

And after a bit of testing, it will probably be merged to OXC as well.
Adapted already for OXCE (I hope ;))... PR 20...

Offline TheDeparted

  • Sergeant
  • **
  • Posts: 33
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #23 on: November 27, 2018, 11:46:12 pm »
Dear Meridian,

Can you please teach me/us how to "steal" some mods from the truly amazing megamods out there? For example, I would just like sniper rifles addes to the vanilla, or maybe a gym.

Thank you for your patience and dedication!

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1512
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #24 on: November 28, 2018, 05:51:22 am »
Can you please teach me/us how to "steal" some mods from the truly amazing megamods out there? For example, I would just like sniper rifles addes to the vanilla, or maybe a gym.
Below I have attached an example mod containing the .308 Sniper Rifle from The X-Com Files total conversion mod. Download it, install it, and pop open the ruleset in notepad++ so you can follow along as I explain how I built it.

You can just copy the code into a separate ruleset file and place it in its own mod directory. To figure out how to do that, look at other small mods as examples. Then just copy the relevant data from the large mod into your mod in the same format as it is in the small mod. Lastly, make sure you test it thoroughly!

Here's an example for the sniper rifle, which I copied from the items ruleset in X-Com Files. You want to take out some unnecessary elements. The original sniper rifle code from X-Com Files has a lot of excess data that we don't need. The simpler it is, the easier it is to handle. I removed the categories and research requirement, because our mod doesn't have the category list or research projects from X-Com Files. The rest of the fluff I'll just leave in place, but most of it could be removed without problem. To know which to leave and which to take out, check the OXC ruleset reference. Anything not listed there you can do without and it won't break the mod, though it might detract from the quality of the mod.

The next part is to figure out all the extra parts we need. The most generic components other than the item entry are the graphics, sounds, and language entries. All of the lines which call for a sprite or sound file you'll notice have a number next to them, for example: bigSprite: 609. This means that the Sniper Rifle is calling for #609 from the bigSprite list. We'll want to grab these things from the extraSprites and extraSounds files. The bigSprite, floorSprite, handSprite, bulletSprite, and hitAnimation come from the BIGOBS.PCK, FLOOROB.PCK, HANDOB.PCK, Projectiles, and SMOKE.PCK sections of the extraSprites ruleset, respectively. (sic) We will not need entries from Projectiles or SMOKE.PCK because the numbers given for those on our Sniper Rifle (2, 26) are vanilla numbers which do not need resources. Usually when the number is very small, it is a vanilla resource. Mods typically use numbers that are 3 digits and up.

I copied the BIGOBS.PCK, FLOOROB.PCK, and HANDOBS.PCK sections over, carrying only one or two entries each (one for the rifle, one for the clip). Note the following data in the HANDOB.PCK entry:
    height: 40
    width: 256
    subX: 32
    subY: 40
This indicates that the entire image is 256x40 pixels and is subdivided into units of 32x40 pixels. All entries in HANDOBS.PCK should use the same value, but it is important to match the dimensions to the image file you're using. If you call the wrong size image, the game will crash on loading. If you call the right size, but the subdivisions are wrong, the textures will be fragmented and out of place. But we are just copying data from a different mod which presumably got the numbers correct so we should be fine.

Next we need the actual graphics files. The data we just copied over lists the file path, starting in your mod's main folder. For example, the bigObs #609 is to be found in {mod folder}/Resources/Weapons_Compilation/ClassicWeapons/bigob_SniperRifle.gif. Since we don't have those folders, we must either create them or change the file path. I choose to make a resources folder and delete all other folders from all file paths. So our final path is changed to Resources/bigob_SniperRifle.gif. So I created a folder called [Resources] and then searched for each graphics file we need in X-Com Files and copied them into my [Resources] folder, then I removed the extraneous folders from the file paths in extraSprites.

Now we need the sound files in extraSounds, from the BATTLE.CAT section. It's fireSound: 76 and hitSound:77 so we find those entries and copy them over just like with extraSprites. Then we copy the sound file over (and repair the file path).

Now we just want the language file and we should be done. We don't need to do anything more than copy it over. The game automatically reads all string values (such as STR_SNIPER_RIFLE) and checks your current language file for a corresponding entry. And it's also okay to not have the language file. If it doesn't find it, it'll just call the weapon STR_SNIPER_RIFLE instead of calling it Sniper Rifle. We get the language file from the extraStrings section corresponding to our chosen language--I'll go with en-US. Now if you've found STR_SNIPER_RIFLE in the language file, you'll notice there is a language entry for a UFOPedia topic on the rifle included in there as well. We can use that to add the UFOPedia project, but I'm not going to cover that at this stage. You can search X-Com Files and try to add it yourself if you like. You will need to find its entry in the ufopaedia section, and make sure you remove the research requirement from the ufopedia entry like we did with the item, unless you intend to instead copy the research project into the mod.

- - - - -

If you wish to try your hand at adding a gym from a big mod: find one in the facilities section of its ruleset and copy it over. You'll want to get the spriteFacility from BASEBITS.PCK in the extraSprites section. You will also want to copy over the corresponding map file from the MAPS folder, the routes file from the ROUTES folder, and any terrain files it uses from the TERRAIN folder. Make sure your mod has these folders just like this. The entry in facilities tells its MAPS/ROUTES/TERRAIN data at mapName, where it links to an entry in the terrains section. You'll probably find the facility map in the section called XBASE or something similar. You'll need to copy over the full mapDataSets entry, any mapBlocks that are used in your facilities, and all terrain files (from the TERRAIN folder) that are listed in the mapDataSets entry. If the mod doesn't contain one of the terrain files, it's probably a vanilla file which you won't need, such as BLANKS.

- - - - -

Once you feel like you're done, or at a good stopping point, you should test everything you added to your mod. We just added a sniper rifle, so we want to run the mod, start up a random battle, load the sniper rifle and ammo onto our ship, and try using and firing the weapon at an alien or two. If everything works out, then we have probably copied the mod correctly. If there are any unexpected errors, you can ask for help from the community either here on the forums (ideally in a new post in the Work in Progress subsection) or on our Discord channel. Please don't post any replies to this message here in this thread. If you make a new thread in Work in Progress, I will see it and visit it.
« Last Edit: November 28, 2018, 06:04:52 am by The Reaver of Darkness »

Offline TheDeparted

  • Sergeant
  • **
  • Posts: 33
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #25 on: November 28, 2018, 11:02:40 pm »
Thank you, Reaver for your clear and detailed response! Much obliged, kind sir.

Offline krautbernd

  • Commander
  • *****
  • Posts: 1108
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #26 on: November 29, 2018, 09:58:06 pm »
I'm having trouble adding (i.e. running it together, loading last) Biggieboy82's Large Workshop to an existing mod (xcomfiles in this case). It keeps messing up base defense terrains:
Quote
terrains:
  - name: XBASE
    addOnly: true
    mapDataSets:
      - BLANKS
      - XBASE1
      - XBASE2
      - XBASE3
      - BATHWALL
      - BATHBITZ
    mapBlocks:
      - name: XBLW_01
        width: 10
        length: 10
      - name: XBLW_02
        width: 10
        length: 10
      - name: XBLW_03
        width: 10
        length: 10
      - name: XBLW_04
        width: 10
        length: 10

In particular, i couldn't find any documentation for the "addOnly" switch. As far as i can tell it doesn't work as intended, as it overwrites the map datasets when it's supposed to add them the list. This is xcomfiles terrain definition:
Quote
  - name: XBASE
    mapDataSets:
      - BLANKS
      - XBASE1
      - XBASE2
      - XCOMWALL
      - XCOMBITS

As far as i can tell the mod is only supposed to add the missing datasets - instead it overwrites them and deletes those not on the list, messing up existing blocks. The only way i can get it to work is by deleting the datasets line alltogether, but of course it then fails to load on a base defense that includes the large workshop. Any hints on how i can get this to work?

EDIT:
Nevermind, works fine without the mapDataSets.
« Last Edit: November 29, 2018, 10:15:15 pm by krautbernd »

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #27 on: December 09, 2018, 11:32:48 pm »
Quote
OpenXcom is supporting only 8bit graphic

Since when? Maybe we should go back to the way it was? In version 5.0 such mess was not.

Online Meridian

  • Global Moderator
  • Commander
  • ***
  • Posts: 9075
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #28 on: December 09, 2018, 11:36:49 pm »
Since when? Maybe we should go back to the way it was? In version 5.0 such mess was not.

Since the beginning!

When you got lucky, some 24bit images may have loaded... but not always and not for everyone. They are also not supported in OpenXcom, and they never were.

Offline Ethereal

  • Commander
  • *****
  • Posts: 684
    • View Profile
Re: OpenXcom Extended (OXCE) main thread
« Reply #29 on: December 09, 2018, 11:48:10 pm »
I mean, it would be nice to undo all the changes in image support that have been made since version 5.0.