Author Topic: [DONE][Suggestion] Can items generated from geoscape events appear instantly?  (Read 12318 times)

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
When a random event creates items, those items are currently set to transfer to the base arriving at the next hour.

I think this is a bit confusing, and sometimes annoying and frustrating. It's confusing because many things could happen in between the event and when the item arrive on the next hour - which might make it harder for the player to connect the two ideas. Immediately after the event, the player might wonder where the items are. And when they arrive, the player might be confused about what the items are for or where they came from. It can also be annoying / frustrating if the items take up a lot of storage space - triggering the base-overfull forced sell screen. This is bad because the forced-sell screen is set to appear immediately after the event. The space requirements of the new items are counted, but those items haven't arrived yet - and so they cannot be sold / transferred on the force-sell screen.


In my opinion it would be much better if the new items arrived immediately after the event, rather than at the usual 1-hour for items transferred. A secondary less-good option would be to just remove the immediate storage space check on the event screen - leaving only the normal 1-hour storage after the items actually arrive.
« Last Edit: April 22, 2023, 06:08:43 pm by Meridian »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #1 on: January 20, 2023, 11:04:13 am »
There were side effects when I used 0 hours transfer time... endless loop or something, I don't remember anymore. I think I saw modders mentioning in the event description that the items are "on the way and will arrive shortly".

As for not making a check immediately after the event... I did the check because it was explicitly required and even reported as a bug several times.

Offline Mathel

  • Colonel
  • ****
  • Posts: 326
  • Do not mistake Muton for mutton.
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #2 on: January 20, 2023, 07:06:29 pm »
Interestingly, the event items can be sold instantly if there is not enough storage space possible. That is if, for example, 300 boulders are being sent to a base with only an access lift.

Yeah, I did check that because I was checking whether it would result in a softlock. It did not.

But my suggestion is to include a sell manager in events themselves, similar to missions. So you could sell items from the event (and only the event) immediately. Then there would be storage check, from only the items not sold.

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #3 on: January 20, 2023, 08:08:00 pm »
Interestingly, the event items can be sold instantly if there is not enough storage space possible.
...
Being able to sell "in tranfser" originates from OXC (perhaps even original, not sure though). Probably to prevent base overflow situations due to excessive amount of transfers.
That is also the reason items in transfer count toward base stores.

Think of it this way:
 At time of acquire you allocate/reserve the space they are going to take up the moment those items arrive at base.
 When you no longer wish those in-transfer items, you just undo the reservation and return back to sender anything that arrives at the base.


Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #4 on: January 21, 2023, 01:43:28 am »
Ok. Lets put aside the idea of delaying the storage check - because that kind of just shifts the problem somewhere else (which may look better to me, but look like a bug to someone else).

But I still think it is ... awkward and 'ungood' that the new items arrive one-hour later - mostly because of the storage issue. If I get an event like "someone just dumped 100 units of rubbish in your base", I shouldn't have to clear out 100 units of my high quality valuable gear to make room for that rubbish to arrive. The idea of a option to sell the stuff from the event screen itself would work; but the items aren't currently listed on the event screen anyway. I still think the best solution is if the items arrive immediately after the event screen; and *then* do the storage check. That way players could sell any combination of new and old stuff they like to make it work.

I've been bothered by this event storage thing for awhile now - and I have glanced at the relevant bits of the code in the past and concluded this isn't going to easy to fix...    so I'm not surprised that there was some kind of problem in a previous implementation. I still think it's worth another look though. Or am I basically the only one who cares about this? If there was a patch that changed it to arrive instantly, is that something we'd want in the main OXCE?  (I don't intend to work on it right now - but if it's something people actually want, then I might do it sometime in the future.)

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #5 on: January 21, 2023, 01:51:37 am »
If there was a patch that changed it to arrive instantly, is that something we'd want in the main OXCE?  (I don't intend to work on it right now - but if it's something people actually want, then I might do it sometime in the future.)

If that patch was good enough to not make it even worse than today, I'd not be against it.

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #6 on: January 28, 2023, 01:27:08 am »
Base over-stuffing is a problem either way. If you need to check storage space both to add the items right away and to reserve place for “transfer”, what’s the difference?
Adjustable parameters are always better, unless the modders can chain the event to a separate delay. I’m not sure when setting the delay explicitly would make sense, however. Maybe “delivery” at a set speed to base from an arbitrary point (which defaults to the base, but could be a mission site, coordinates of a city or whatever)? But then, maybe add a boolean to allow the player selection of the base (or rather initiate Transfer immediately) or use the default (first) base?
If some minimum is needed, maybe 5 seconds tick would do?

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #7 on: January 28, 2023, 02:59:26 am »
I've made the changes so that the items arrive instantly. I'll guess I'll post it as a pull-request in a few days after I've done a bit more testing to make sure there's no glitches. (My first attempt looked like it was working, but actually had the items not arrive at all! So I also made a couple of tweaks reduce the risk of coding errors like that in the future.)

While I'm looking at it though, is there any special reason why soldiers, scientists, and engineers are all given a 24 hour arrival time from events (whereas everything else was 1 hour)? I don't really care much about the 24 hour arrival time for people. It's not relevant to the thing I'm trying to fix; but it just seems a bit odd to me, so I wondered if there was a reason for it.

--
(@TBeholder - the difference is that if the items don't arrive straight away, then you can't get rid of them when you run out of space.)

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #8 on: January 28, 2023, 11:12:59 pm »
...
(@TBeholder - the difference is that if the items don't arrive straight away, then you can't get rid of them when you run out of space.)
Are you sure about this one? To me it looks like the code allows sale of in-transfer items if the sell screen is opened from the base menu.

...
If some minimum is needed, maybe 5 seconds tick would do?
Currently the code only checks base storage limits at the one-hour mark (as part of production updates). Not sure if moving such a check to every 5s-mark is something that is wanted (performance wise).

Offline Mathel

  • Colonel
  • ****
  • Posts: 326
  • Do not mistake Muton for mutton.
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #9 on: January 29, 2023, 10:12:03 am »
Currently the code only checks base storage limits at the one-hour mark (as part of production updates). Not sure if moving such a check to every 5s-mark is something that is wanted (performance wise).
It checks base storage limits after every transaction that has a chance of exceeding them (mission or event), as well as every hour.

Are you sure about this one? To me it looks like the code allows sale of in-transfer items if the sell screen is opened from the base menu.
And since the limits are checked immediately after the event, it forces you to sell stuff right away, so you do not open the sell screen from the base menu.

Offline TBeholder

  • Sergeant
  • **
  • Posts: 41
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #10 on: January 29, 2023, 09:17:59 pm »
Currently the code only checks base storage limits at the one-hour mark (as part of production updates). Not sure if moving such a check to every 5s-mark is something that is wanted (performance wise).
I mean transfer time, if zero created some problems.
The check should be forced when space reservation for the transfer is done, either way.

While I'm looking at it though, is there any special reason why soldiers, scientists, and engineers are all given a 24 hour arrival time from events (whereas everything else was 1 hour)? I don't really care much about the 24 hour arrival time for people. It's not relevant to the thing I'm trying to fix; but it just seems a bit odd to me, so I wondered if there was a reason for it.
IMO a single mechanism is always preferable, to minimize spaghetti code and chance of hard-to-catch intermittent bugs.
It looks like the most universal and least-contorted way to do this would be to treat all transactions where anything or anyone moves to the base as Transfers from a temporary “storage place”. Also applicable to vanilla style purchases/hires/etc — so the items or personnel could move from the current mission site, nearest large city, randomly generated site within given range of an existing site, whatever.
So if the people you hire are supposed to come from the present (i.e. large) city nearest to the base hiring them, transfer time would be not arbitrary and constant, but derived from range and “transfer speed”. Speed is set for each terrain; perhaps somewhat randomized around the average value, so mean speed and maximal deviation.

…I’m starting to see why Apocalypse developers chose to do things the way they did. :D  They also had dynamic background, however, so just pass the route to transport activity tracker and boom, it’s a fully modeled process.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #11 on: March 19, 2023, 11:11:56 am »
I have reviewed PR #110, but unfortunately it is "too invasive" for me.

I will keep the suggestion open and look for different solutions.

Offline karadoc

  • Colonel
  • ****
  • Posts: 232
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #12 on: April 11, 2023, 03:24:58 pm »
Fair enough. There was a bit of code shuffling to get it right, and it isn't all pretty either. So its understandable that you aren't comfortable with it.

I'm really enjoying the benefits though, so its unfortunate that the code is a bit messy. You probably saw my description on github as to why the messiness is required; so if there are any compromises that you'd be willing to make, I'll leave that to you. For example, it could be changed so that items arrive immediately but the popup screen announcing the arrival was delayed. Compared to the version in the pull request, that would obviously be worse in terms of game experience - but it would allow for neater and less invasive code. (And it would solve the issue of being unable to sell unwanted items.)

In any case, I guess I'll just keep the patch as a feature I maintain on my own version until some other solution is decided on. Now that I have it, I don't want to go back to the way it was!

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Can items generated from geoscape events appear instantly
« Reply #13 on: April 11, 2023, 05:12:32 pm »
The most likely solution (at the moment) is that I will stop using the Transfers for this purpose.

Instead I will generate the items directly when the event pops up and inform the player also directly within the same popup.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Items from geoscape events now appear instantly.

Players can see them directly in the event GUI.


PS: test event for my needs in the future:

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    eventWeights:
      0:
        STR_TEST_EVENT1: 100
    firstMonth: 0
    lastMonth: 12
    executionOdds: 100

events:
  - name: STR_TEST_EVENT1
    description: STR_TEST_DESCRIPTION1
    background: BACK13.SCR
    regionList: [STR_NORTH_AMERICA, STR_EUROPE]
    city: true
    points: 2000
    funds: 100000000
    everyItemList: [STR_LASER_PISTOL, STR_LASER_RIFLE, STR_LASER_RIFLE]
    timer: 1700
    timerRandom: 60

extraStrings:
   - type: en-US
     strings:
       STR_TEST_EVENT1: "Political assassination in {0}"
       STR_TEST_DESCRIPTION1: "This is a description of my event. Btw. player you are getting also 1 laser pistol and 2 laser rifles."


EDIT: In OXCE 7.9.1, added as an option in options.cfg (oxceGeoscapeEventsInstantDelivery: true), default true
« Last Edit: May 06, 2023, 04:29:10 pm by Meridian »