Beiträge von eis_os

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


    Yeah, the construction should have the stocklist. At least my inspector shows there is a stocklist.


    But as api.engine.getComponent(<constructionentityid>, api.type.ComponentType.STOCK_LIST) returns userdata.


    Damn. So still you have to use some api.system.* functions to get meaningfull data or old game.* interfaces

    See here, I am using my API left bottom Button -> Inspector Window. Second Tab has a "Get Entities" function, we see a Construction and SIM_BUILDING



    You want the whole UG API Madness, let's do it. You have a construction entity.

    1. Get the construction component,

    2. Use the simBuilding(s) EntityId to get component SIM_BUILDING

    3. we have a list Entity Ids of Stocks => stockList

    4. use simEntityAtStockSystem to get count.


    Dump of UG Console:



    Easy? Yeah... There are tons other apis the api.engine.systems ,so it's likely there is an easier way... but with the good documentation...


    There are some industry mods out there, maybe look what apis they use to get to a easier code path...




    -edit- More madness while we are at whole thing. Let's say, we have a SIM_BUILDING and want a construction?


    api.system.streetConnectorSystem.getConstructionEntityForSimBuilding

    https://transportfever2.com/wi…ctionEntityForSimBuilding



    ConstructionRep -> Industry types (Not build constructions, the blueprint con file data)


    Any Repository => something loaded from Model or Construction.con -> these are definition of something. Not an instance of some game element.

    Any game element is represented by some entity (referenced by entityid) and it's component. All the entities are run by the systems, they get component data from entities to run the game.


    If you have an entityid you can use api.engine.getComponent(entityId, componentTypeId)


    The componentTypeId is something from api.type.ComponentType, example: api.type.ComponentType.SIM_BUILDING


    There is a stockList,

    api.engine.system.simEntityAtStockSystem.getStockEntities(<stockListId>, <num unknown to me>) -> list of cargo entities.

    api.engine.system.simEntityAtStockSystem.getStockEntities(<stockListId>, 0) (first stock, don't ask me where to get the number)


    api.engine.system.simCargoSystem.getSimCargosForSource(<stockListId>)


    Otherwise try to see if you can get the info via Advanced Statistics


    However, sometimes it is easier to use the old game apis, maybe the needed info is already in there.



    There is api.system.stockListSystem.getCargoType2stockList2sourceAndCount too..

    Kann ich gerade nicht nachvollziehen.:/


    Ich bräuchte da dann mal einen vollen Screenshot, in meine Linux Build kann ich alles groß und klein machen, verschieben, auswählen und co.


    Werde es bei Gelegenheit auf einer Windows Gurke testen. Wenn jemand das selbe Problem hat, so bitte mit Screenshot (komplettes Spiel) und stdout.txt ...

    (Und wie immer, ich kann nur etwas reparieren was kaputt ist oder ich genügend Informationen zum Debuggen bekomme)

    1.7.20211204


    CommonAPI2


    Intern wird nur noch die veränderbare UI::ModDataProvider (Quelle der UG UI Mod Listen) genutzt,

    dieses sollte bei sehr vielen Mods die Berechnungszeit halbieren, da nur noch eine Liste anstatt zwei berechnet werden müssen.


    Dies kann dazu führen, das Fehlermeldungen bezüglich Abhängigkeiten nur noch bei erweiterten Einstellungen

    (da wo man die Mod Reihenfolge ändern kann) auftauchen.


    Chill_LP und FriendlyX hatten Probleme das die Fehlermeldung zum Buildoverwrite nicht im Hauptmenü erscheint,

    nun sollte es auch mit VSync off bzw. sehr hohen Bildwiederholraten funktionieren.



    Zum Thema LINE_DESTINATION funktioniert nicht, hab ich keine weiteren Infos, dann kann ich halt auch nichts machen...

    Debugger an srandom aus libc6 gehängt via breakpoint, es wird ständig aufgerufen mit 0 als seed Parameter.


    Irgendwas in UGs Script und GUI Thread ruft math.randomseed aus lua ständig mit 0 auf:

    Das Problem hierbei, es gibt keinen Stacktrace.


    Code
    math.randomseed = function() print(debug.traceback(nil, 2)) end

    Versucht das mal via CommonAPI2 Console im CommonAPI2 Thread. Wenn ihr dort dann math.randomseed(123) aufruft, bekommt ihr main chunk ( also C code ruft einen string auf) als Ergebnis.


    In UGs Console ausgeführt und dann:

    >> math.randomseed(123)

    stack traceback:

    [string "require "serialize" print(toString(math.rando..."]:1: in main chunk


    Wenn ihr dieses num UGs GUI Thread oder Script Thread macht, läuft eure stdout.txt über ohne stacktrace...


    -> Ergebnis:

    Irgendwas stellt den seed der libc via math.randomseed immer auf 0. Da beide Threads nicht im Hauptmenü laufen bzw. noch nicht erstellt sind, gibt es mit math.random dort auch noch keine Probleme...



    -edit 2-


    PS: Dafür wäre eigentlich ein Entwickler zuständig das zu klären und nicht ich als "Endnutzer" guertlms

    Da math.random in Konstruktionen zu sehr problematischen Ereignissen führen kann,

    kann es sein das UG das Problem durch einen „statischen“ Wert ersetzt hat


    Beispiel:
    1. Konstruktionsbauplan mit math.random wird getriggert für die Vorschau.
    2. Konstruktionsbauplan mit math.random wird getriggert für den Bau.
    3. Ergebnis passt nicht mehr zusammen => Spieler unglücklich


    Noch zur Info

    This function is an interface to the simple
    pseudo-random generator function rand provided by Standard C.
    (No guarantees can be given for its statistical properties.)


    -edit-

    Man nutzt einen seed einmal, und holt sich dann mehrere Pseudo-Zufallszahlen aus dem Algorithmus.


    -edit2-

    Nur so ein Hinweis, da CommonAPI2 seine eigene LUA Runtime nutzt, kann es sein das die Nutzung meiner Konsole etwas andere Ergebnisse produzieren kann...

    Es gab da mal Probleme mit der libc Version, daher zusätzlich die Steam libc Version im LD_LIBRARY_PATH via Shellscript.


    Das kann ggf. andere Probleme nach sich ziehen, aber Steam macht das intern auch, bzw. machte es immer noch? Keine Ahnung.


    valgrind & gdb werden bei so aber auch gestartet. Damit habe ich nen Vulkan Renderoverlay für CommonAPI2 geschrieben, das sollte in der Regel so laufen...


    CommonAPI2 mach ein Reset bei einer Subshell sonst funktioniert curl nicht richtig bei Ubuntu 20.04 mit Steam wegen libc mismatch.


    Kernel selber kompilieren kann man machen, mir reichte es aber ne ganze Zeit Mesa anzupassen. Mit ner 3200G APU hab ich alles mögliche schon anstellen müssen, Kernel, Mesa und Firmware für ein Bild. Irgendwann will man halt das alles mit so wenig Mühe funktioniert wie nur möglich :)


    Zurück zu TPF2, wenn es wegen fehlender Extensions meckert, dann stimmt was nicht.

    Starte mal mit:


    CommonAPI2 Endhaltestellen Anzeige (LINE_DESTINATION)


    - CommonAPI2 Nativ geladen und funktioniert (sprich CommonAPI Menü oben links im Hauptmenü?

    - CommonAPI2 im Spielstand aktiv geladen (Links unten runder Knopf?)

    - eis_os_linedestinationpatcher geladen und aktiv?

    - Im Linenfenster kann eine Endhaltestelle gesetzt werden?

    (Siehe Screenshot aus dem Lexikon Eintrag)


    Wenn alles richtig ist und es immer noch nicht geht:

    Dann bitte ein frisches Spiel starten, einen neuen Spielstand nur mit aktiver CommonAPI2 + Line Destination Patcher starten und testen.


    Wenn es nicht geht, davon dann bitte die stdout,txt...

    Punkt 2: Du kannst TPF2 nur via Steam starten, sonst stimmen die libc Abhängigkeiten nicht

    Alternativ, Shellscript nutzen (Pfade ggf. anpassen):

    Bash
    #!/bin/sh
    export LD_LIBRARY_PATH=.:~/.steam/ubuntu12_32/steam-runtime/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
    
    ./TransportFever2


    Wenn irgendwelche extensions fehlen, scheint es einen Software Render Failback zu geben. Ergo nvidia Treiber neu installieren mit der passenden Kernel Version.


    Suspend via Nvidia binär funktioniert nicht wirklich.

    (Wenn es auf einmal doch funktioniert, scheint das System wohl mit nouveau/vesa kms oder ähnliches zu laufen)


    AMDs Kernel"Treiber" sind auch ne Sache für sich... und ab mehr als einem Monitor auch ziemlich zickig...

    CommonAPI2 deinstallieren oder neue Version mit buildoverwrite nutzen.

    CommonAPI2 nutzt gerade den Notfall Modus = nicht gut.


    Im log steht das es gerne ein Update haben möchte... (und das mehrmals)


    Zum Testen würde ich erst einmal CommonAPI2 aus der Gleichung nehmen und deinstallieren. Deine Version ist sehr alt und nicht für 34983 nutzbar


    Build: Build 34983 Windows 64-bit

    commonapi2.init 20200728

    commonapi2.init: Your TPF2 version 'steam_34983_1' isn't listed as known good version, please update CommonAPI2


    Darüber hinaus:

    WARNING: eis_os_streetpackage: Failback mode active, is commonapi2 not loaded or FlexStreets disabled?


    Das Strassenpaket hat wegen zu alter und nicht komplett geladener CommonAPI2 auch Probleme...


    -/edit-


    -edit2-

    Das da auch ne Menge Mods Fehler zeigen, macht die Ganze sache nicht besser...




    Die Änderung an der Auslagerungsdatei verschieben das Problem in der Regel nur oder machen es schlimmer.


    Beispiel:

    SSD + zu wenig Arbeitsspeicher + vergrößern Auslagerungsdatei.

    Resultat: Viel Abnutzung der SSD, weil Windows immer auf die SSD schreiben muss...

    _() Should work mostly in all states since the summer update.

    I remember a bug report about game_script and translation not working once...


    -edit-

    UGs api functionality is state dependent. Some stuff leaks into the states, so to always be sure to start a fresh exe. As soon as you completely load a savegame, api namespace / functions may support more functionality in a second run.

    Not sure how much UG fixed this until now. UGs Console didn't support translation as example.

    If api.util is not defined, then you can't use it. At that time it is very likely you won't have access to them.
    You get the error: attempt to index field 'util' (a nil value)


    This is the reason the commonapi failback ui is always in english.

    I did not found a way to get language at mod.lua loadtime... (this may have changed in the meantime)