aliens

Author Topic: [SUGGESTION]Custom Hangar/Craft types  (Read 10982 times)

Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #15 on: March 02, 2023, 12:47:52 am »
Ok, but its very limited, effective only two types of craft available, if I recall correctly Meridian target fro multiple hangar types, not only two.
Xcom Files could for example use submarine subpen or dedicate rocket launch bay.
I really can't see the point in many specialized hangar types, where each one can  only fit a limited range of crafts (you should destroy/build hangars every time you advance in crafts), but I suppose it could make sense for 'thematic modding'.

Perhaps giving each hangar an "id", so crafts should fit that "id" to be allocated....but you should do a lot of "id" comparisons between craft and facility vectors.
I will check if my version can be adapted this way.

Enviado desde mi Mi A2 Lite mediante Tapatalk


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #16 on: March 02, 2023, 02:55:09 am »
I really can't see the point in many specialized hangar types, where each one can  only fit a limited range of crafts (you should destroy/build hangars every time you advance in crafts), but I suppose it could make sense for 'thematic modding'.

Perhaps giving each hangar an "id", so crafts should fit that "id" to be allocated....but you should do a lot of "id" comparisons between craft and facility vectors.
I will check if my version can be adapted this way.

Enviado desde mi Mi A2 Lite mediante Tapatalk
I do not think you should spend your time on it as is very small chance it will be used, as I previously said Meridian aim for proper solution for this and we both will probably prefer one over partial solution like yours.

Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #17 on: March 02, 2023, 08:48:58 am »
Ok 👍. I hope it can be ready soon.

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #18 on: March 03, 2023, 07:44:02 pm »
For example because right now the crafts don't belong to any hangars, just to a base. After this change, they will have to belong to particular hangars.
Total space of <all hangars with given functionality> could be checked just as well… But this would only build up on top of a workaround, of course.
Facility does have association with craft used for GUI, however (via _craftForDrawing/getCraftForDrawing/setCraftForDrawing).
What more complicated would be required for a straightforward designation back and forth, at this point?
I really can't see the point in many specialized hangar types, where each one can  only fit a limited range of crafts (you should destroy/build hangars every time you advance in crafts), but I suppose it could make sense for 'thematic modding'.
In near-vanilla, maybe only basic VTOL vs spacecraft. In expanded and hybrid mods — garage for cars, hangar for aircraft, and dock for mini-subs probably should not be the same thing.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #19 on: March 03, 2023, 09:43:02 pm »
Facility does have association with craft used for GUI, however (via _craftForDrawing/getCraftForDrawing/setCraftForDrawing).

And how does that help us?
It would be even easier (not by much tho) if that (unreliable and incomplete) association didn't exist.

What more complicated would be required for a straightforward designation back and forth, at this point?

Sorry, but what exactly do you want to hear from us?

It is complicated to design, it is complicated to implement, and it is also complicated to explain what's complicated. I'm not going to write a 20-page essay about it here. I do have better things to do.

You are obviously not new to programming, if you are so puzzled by my statements, give it a try and see for yourself.

I promised I will do this feature eventually (unless I retire first), but I do need enough time and enough motivation to try again. We had already 2 failed attempts and I'm not going to start a third one before I'm confident it's going to be a successful one.

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #20 on: March 04, 2023, 04:34:23 pm »
We should let the modders vote for what they actually want from this feature. Obviously the more ambitious the feature is, the more time and commitment the devs need to spend to make it happen.

If the general modders wanting only something basic and not the more ambitious parts of the feature, then it is not necessary for the Dev to enable of something the modders don’t use.

The most basic of this hanger feature that I as a modder would want is

1x1 hanger for small general
2x2 Already exist for medium general
3x3 for large general type

1 size and 1 craft per hanger.  No specialisation or multiple craft hangers. 

Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #21 on: March 07, 2023, 05:18:30 pm »
I know some of the OXCE developers told me that this have a very small chance to be used....but I was thinking about it when getting sleep the other night and though a (not very difficult to change) solution based in my previous attempt, and decided trying to do it next day.

So here it is. Now you can assign a "type" to hangars and crafts, so only crafts with the same "type id" than hangars can be allocated there.
I maintened some of the former features: having more than 1 craft per hangar; giving coordinates to draw crafts over hangar sprite (mandatory only if more than 1 craft), and select different crafts at the same hangar in Baseescape.

Backward Compatibiity is obtained giving a default type id (-1) to hangars and crafts, so they can be allocated as in vanilla.

https://www.youtube.com/watch?v=VfurPl50nHs
(also in discord: https://discordapp.com/channels/292085473890009088/330653502693179394/1082046483538399392)

https://www.youtube.com/watch?v=pC5SpVJSljQ
(also in discord: https://discordapp.com/channels/292085473890009088/330653502693179394/1082361576146882570)

In final version, hangar info in UFOPEDIA entries can be des/activated via an Advanced Option. I've added hangar type info in "Stats for Nerds" in both crafts and facilities.

(example of new rules entries)

Code: [Select]
  - type: STR_UPGRADED_HANGAR
    spriteShape: 534
    spriteFacility: 538
    size: 2
    buildCost: 1000
    buildTime: 1
    monthlyCost: 37500
    hangarType: 1     
    crafts: 2
    craftSlots: # mandatory if crafts > 1; optional otherwise
      - [11, -11, 0]  # Distance to the
      - [-11, 11, 0]  # central point   
    mapName: XBUH_01
    workshops: 10
    storage: 50
    aliens: 20
    prisonType: 4
    listOrder: 7261
    canBeBuiltOver: true
    buildOverFacilities:
      - STR_HANGAR
Code: [Select]
crafts: # Modify default XCom Files rules with just an hangarType
        # Not modified crafts have a default "-1" hangarType
  - type: STR_OPSCAR
    hangarType: 0
  - type: STR_VAN
    hangarType: 0 
  - type: STR_HUMMER
    hangarType: 1   
  - type: STR_CIVILIAN_CAR         
    hangarType: 0
  - type: STR_LUXURY_CAR 
    hangarType: 0   
  - type: STR_DRAGONFLY
    hangarType: 2   
   

I didn't test facility (hangar) destruction yet. I need an enough advanced save for strong aliens retaliation with missile attack.

If anyone wants to peek changes I've done, they're at this public repository:

https://github.com/NHerreroReder/OpenXcomPruebas/tree/Basescape-hangars-reworked

(if you find errors/bad-implemented things, please let me know! ;) )

And if it finally neither goes anywhere nor is useful for anybody....well it was fun and let me learn a lot about OXCE source code.
« Last Edit: March 19, 2023, 11:54:48 pm by Nacho_HR »

Offline mutantlord

  • Colonel
  • ****
  • Posts: 136
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #22 on: March 12, 2023, 06:09:25 pm »
If voting is allowed for the solution propose in the prior post, I will put mine in. If it fully works and is simple to meet the requirement.

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #23 on: March 17, 2023, 06:39:40 pm »
So here it is. Now you can assign a "type" to hangars and crafts, so only crafts with the same "type id" than hangars can be allocated there.
I maintened some of the former features: having more than 1 craft per hangar; giving coordinates to draw crafts over hangar sprite (mandatory only if more than 1 craft), and select different crafts at the same hangar in Baseescape.

Nice work (although I judge only demo video, as I have not looked through the code yet)!

The minor issue with that is a base info state with only one bar for crafts, the player would not be able to know how many slots of what type he or she has used/free. Btw, the same problem with prison type. But I don't have a solution here except overhauling base info state UI, so just saying.

Offline MaxMahem

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #24 on: March 17, 2023, 07:45:03 pm »
Btw, the same problem with prison type. But I don't have a solution here except overhauling base info state UI, so just saying.

I have an idea for this (clicking on the name to cycle the prison type) or maybe something else but I haven't had a chance to poke at it yet.

Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #25 on: March 17, 2023, 11:40:35 pm »
Nice work (although I judge only demo video, as I have not looked through the code yet)!

The minor issue with that is a base info state with only one bar for crafts, the player would not be able to know how many slots of what type he or she has used/free. Btw, the same problem with prison type. But I don't have a solution here except overhauling base info state UI, so just saying.
In order to follow the "rules" of pul-request, I want to separate both features:
- the one for different types of hangars with just 1 craft each.
- and the one to have more than 1 craft in the only type of hangar in vanilla, allowing to give coordinates to show all crafts in Basescape -and selecting each craft with the mouse-

At current  version if you consider more than one craft in the hangar :
1. Only one craft is shown over hangar at baseEscape view.
2. If hangar is destroyed, I think that only the shown craft is destroyed, as it uses a single pointer to Craft class to manage which craft is affected by destruction.
So, for now only 1 craft per hangar works right

Finally, I think that combining both features gives the most flexibility for modders regarding crafts/hangars management.

Enviado desde mi Mi A2 Lite mediante Tapatalk


Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #26 on: March 17, 2023, 11:42:47 pm »
I have an idea for this (clicking on the name to cycle the prison type) or maybe something else but I haven't had a chance to poke at it yet.
That sounds good
I was considering also use different colors for different hangar types/slots at the hangars bar. Perhaps giving another "yaml" entry to hangar definitions.

Enviado desde mi Mi A2 Lite mediante Tapatalk


Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #27 on: March 19, 2023, 06:24:01 pm »
I know some of the OXCE developers told me that this have a very small chance to be used....but I was thinking about it when getting sleep the other night and though a (not very difficult to change) solution based in my previous attempt, and decided trying to do it next day

....



In order to follow the "new features pull-request rules", I've separated the two main novelties at my attempt related to hangar and crafts management:

1. Many Crafts in just one (type of) Hangar.
Thought you can define more than one craft for an hangar facilities, current behavior at OXCE+ is somehow broken:  1)you cannot show/select more than one craft in basescape; 2) and management for hangar with more than 1 craft is not totally working (I think it only considers the craft shown at basescape when destroying an hangar facility, for example)

You can see a video of the new suggested feature here:
https://youtu.be/0wmmdvmLTJE

I've uploaded a branch of my OXCE+ fork with this feature in this public respository:
https://github.com/FlaubertNHR/OpenXcomPruebas/tree/MultipleCraftsxHangar

2. Different classes of hangars with just one craft each (but you can choose also that different classes of crafts could be allocated in the same hangar type if you want)

Video testing this feature: https://youtu.be/hahxQA6T-nM

Branch with the code for this feature: https://github.com/FlaubertNHR/OpenXcomPruebas/tree/Multiple-Hangar-Types

At now I'm revorking another branch with both features at the same time, as I think these would give the most flexibility to modders and users, while mods which don't want to use them will continue working.
(so the URL to github repository at the former message is not valid; the new URL is
https://github.com/FlaubertNHR/OpenXcomPruebas/tree/Basescape-hangars-reworked )

Hope this would be considered enough interesting to be add at main repository. I will try to send a pull-request for these and see what happens.

Any suggestion or error found at the code or the feature is welcome!!  :D
« Last Edit: March 29, 2023, 11:19:20 pm by Flaubert »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #28 on: March 19, 2023, 06:39:15 pm »
I have already said in this thread that I don't need help with the implementation of this feature.

Reviewing your code, learning how it works, changing it to my liking and testing it will take me longer than doing everything myself.

It's a valiant effort, but this is a critical feature that I want to do right and want to understand every detail so that I can support it long-term.

Please don't send pull-requests, they will just be closed.

Offline Flaubert

  • Sergeant
  • **
  • Posts: 40
    • View Profile
Re: [SUGGESTION]Custom Hangar/Craft types
« Reply #29 on: March 19, 2023, 07:29:40 pm »
Ok. Hope you can have it done soon.