Git Product home page Git Product logo

dv-persistent-jobs's People

Contributors

fauxnik avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

dv-persistent-jobs's Issues

No Logistical Haul generation for jobless train cars

Hey Faux,
I have noticed, that player spawned (Hopper) cars don't have jobs generated for them at the Steelmill.
I have made a couple of tests on this problem:

Test1:
I have F'd myself from the Steelmill to the Sawmill and shunted there for about 10 min. afterwards i F'd myself back to the Steelmill, to find that the cars sitting at the Steelmill had other jobs then before, but the player spawned hoppers were still without jobs.

Test2:
Using Teleport had the whole yard regenerated

log excerp of failure
[PersistentJobsMod] [Error] Exception thrown during UnusedTrainCarDeleter.InstantConditionalDeleteOfUnusedCars prefix patch:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) [0x000ff] in <567df3e0919241ba98db88bec4c6696f>:0 
at System.String.FormatHelper (System.IFormatProvider provider, System.String format, System.ParamsArray args) [0x00023] in <567df3e0919241ba98db88bec4c6696f>:0 
at System.String.Format (System.String format, System.Object arg0) [0x00008] in <567df3e0919241ba98db88bec4c6696f>:0 
at PersistentJobsMod.Main+UnusedTrainCarDeleter_InstantConditionalDeleteOfUnusedCars_Patch.Prefix (UnusedTrainCarDeleter __instance, System.Collections.Generic.List`1[T] ___unusedTrainCarsMarkedForDelete, System.Collections.Generic.Dictionary`2[TKey,TValue] ___carVisitCheckersMap) [0x001c9] in <533eab387b5849239aaf47c91b80a7b5>:0 
[PersistentJobsMod] Restored game coroutine.
[PersistentJobsMod] Inactive.
[PersistentJobsMod] [Critical] Deactivating mod PersistentJobs due to critical failure!
[PersistentJobsMod] [Warning] You can reactivate PersistentJobs by restarting the game, but this failure type likely indicates an incompatibility between the mod and a recent game update. Please search the mod's Github issue tracker for a relevant report. If none is found, please open one. Include the exception message printed above and your game's current build number.

Test3:
Loaded the Hoppers with the cargo load tool, moved to Sawmill, waited 5 min, moved back to Steelmill.

Result: one of two cuts of Hoppers has a Job for it

Mod Only Assigns Shunting Load Jobs To Jobless Train Cars

The mod currently only attempts to assign shunting load jobs for train cars that do not have a job associated with them. However, in some cases, train cars with loaded cargo are denied job chain continuation, resulting in a jarring player experience when a shunting load job is created for an already loaded train set.

One potential fix for this is to generate different job types based on the currently loaded cargo at the time of job generation.

Mod crash: Exception thrown during TrainCarsCreateJobOrDeleteCheck job info selection

Latest version of Persistent Jobs, build 90 of DV.

[PersistentJobsMod] [Error] Exception thrown during TrainCarsCreateJobOrDeleteCheck job info selection:
System.ArgumentNullException: Value cannot be null.
Parameter name: key
  at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00008] in <567df3e0919241ba98db88bec4c6696f>:0 
  at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) [0x00000] in <567df3e0919241ba98db88bec4c6696f>:0 
  at PersistentJobsMod.ShuntingLoadJobProceduralGenerator.ComputeJobInfosFromCargoGroupsPerTrainCarSetPerStation (System.Collections.Generic.Dictionary`2[TKey,TValue] cgsPerTcsPerSc, System.Random rng) [0x00266] in <d19a7138391b4c21b7379b84837b1998>:0 
  at PersistentJobsMod.UnusedTrainCarDeleterPatch+<TrainCarsCreateJobOrDeleteCheck>d__1.MoveNext () [0x00624] in <d19a7138391b4c21b7379b84837b1998>:0 

Log: Player.zip

Relevant lines of code:
https://github.com/fauxnik/DerailValleyPersistentJobsMod/blob/4c9f35e06a18bb65f9f8aa60a7c3e6f8516478b5/PersistentJobsMod/UnusedTrainCarDeleterPatch.cs#L281
https://github.com/fauxnik/DerailValleyPersistentJobsMod/blob/4c9f35e06a18bb65f9f8aa60a7c3e6f8516478b5/PersistentJobsMod/Main.cs#L103

Thoughts On Train Car Spawn Balancing

The problem with persistent jobs

Newly spawned train cars quickly fill up some station yards, preventing job generation at other stations. To mitigate this, I propose the following changes:

  • stations only spawn cars once
    • a list of which stations have spawned cars is saved to the save file
    • deactivating the mod wipes the list
    • particular tracks are excepted from this rule (but follow other rules, see below)
  • train cars never despawn, even if no job can currently be generated for them
    • locomotives are excepted from this rule
    • particular tracks are excepted from this rule (the same tracks from above that allow spawning)

Train car turn over

Particular storage tracks allow ongoing spawning and despawning of train cars. These tracks are:

  • all storage tracks in Harbor Yard D
  • all storage tracks in Machine Factory Yard C? (the yard with the loading track)
  • City South West storage track A-3-S (the track in the service depot)
  • all storage tracks in the Harbor and Machine Factory military bases

Allowing some amount of turn over keeps things lively in the Valley. Restricting this turn over to locations where train cars would be built, shipped, or repaired enhances the game's sense of realism.

Multiple Jobs Target The Same Destination Track

I think there are two things at play here:

  1. Using Environment.TickCount to seed the random number generator in the YardTracksOrganizer.GetTrackThatHasEnoughFreeSpace patch is causing it to select the same track for all jobs with matching available track lists.
  2. Skipping track reservation upfront results in multiple jobs being assigned to a track that doesn't have enough room to store the train cars from all the jobs

I think the best way to solve this will be to:

  1. During the JobValidator.ProcessJobOverview patch, the mod attempts to reserve track space. If the mod takes over more control of this action, it can determine the success or failure of the attempt. If the attempt fails, this means there is not enough space remaining, and the mod can attempt to find a new track.
  2. When loading a saved game, track space needs to be reserved for active jobs, but it is currently being skipped.
  3. Seed the RNG with a different source to get truly random results.

Chainjob Bug: FF-GF can spawn shunting jobs too long for unloading on B1L

I done a job that had 18 cars that let me freight goods from Food Factory and Town, to Goods Factory and Town. and successfully completed it. Uppon completing the Freight Haul the appropriate Shunting Task appeared in the Office, the task however is incompletable as the Loading track wasn't long enough thus leaving the loader/unloader unable to operate. Splitting the train would make the (un)loader display the message that all cars must be on the track.
This isn't a gamebreaking bug, easy to circumvent and manually correct (deleting the job and cars or ignoring FH jobs that have too many cars for the destination to handle.) It just hurts the emersion a littlebit.

Bug? Destination Track is Unload Track at Harbor

This is the only mod I have installed. Doing a couple of shunting jobs at Harbor and they all seem to terminate on D7L, the unloading/loading track. Naturally I can't leave them there. I believe this is a bug as they should be taken to Output tracks.

Edit: It seems to be more than just Harbor. Shunting jobs in Food Factory and Town are doing the same thing. Cars are said to be left on the loading/unloading track.

Steam train bug

Using 2.0.1 today I noticed that steam trains seem to be bugged with this mod. I was looking for one and found a DE2 instead, with the coal tender attached to it. The mod seems to be causing the steam engine to be replaced with the DE2. I disabled the mod and was able to find a normal steam train.

Have not tried with 2.1

Any plan to update?

Or to fix the issue of Shunting jobs leaving loads on the loading platform and not an Outbound platform?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.