Common API
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
-
-
Hallo
Ich musste den Fehler erst mal reproduzieren, ich denke ich hab jetzt eine Ahnung warum es passiert:
In deinem Spielstand (Modliste) hast du die CommonAPI nicht geladen.
Es gibt technisch mehrere LUA Instanzen:
Die eigene CommonAPI LUA Instanz. Links neben der Eingabe in der Konsole mit ___ gekennzeichnet, während man im Hauptmenü ist, oder keine andere Instanz aktiv ist.Dann gibt es auch noch LUA Spiel Instanzen, diese sind zu erkennen, das die Konsole >>> anzeigt.
Zurzeit wird durch das Laden der CommonAPI eine neue LUA Instanz gefunden, daher bekommt der CommonAPI Code nicht mit, das da gerade eine andere LUA Instanz läuft und CommonAPI Lua hat kein game Interface.
-
Alles klar, jetzt klappts, danke.
-
Für unsere experimentierfreudigen:
1.8.20190902-dev (Windows only release)
- new partial console autocomplete via tab (won't work with array [] syntax)
- add new experimental feature: Disable country street to city street convert
- add new experimental feature: Randomized vehicle animationAnimationsnamen können mit _1 bis _20 erweitert werden. Ein Eintrag hat eine Chance von 5%, sollte diese Animationen nicht vorhanden sein, wird die normale Animation genutzt:
Beispiel:
open_all_doors_6
Wenn open_all_doors_6 nicht vorhanden ist, wird open_all_doors genutzt. Sollte bei allen Fahrzeugen funktionieren.-edit-
Die "normale" Animation muss immer definiert werden, es gibt auch die Länge der Animation zum Beispiel für die Wartezeitberechnung vor. -
Für die experimentierfreudigen gibt es hier mal die Avenio mit zufälligen Türanimationen zum Testen des neuen Features (CommonAPI)
Dazu muss ingame im CommonAPI Menü bei Experimental auf random animations geklickt werden und das Pop Up bestätigt werden.Sobald das Feature fertig integriert und evtl. um weitere Funktionen ergänzt wurde, gibts die dann auch in der Webdisk.
-
Ich habe Problem mit dem Import der Modlisten. Die Exportierten Dateien 365 stimmen jedoch mit dem Import 362 überein.
Mein PÜroblem ist jedoch das ich das savegame nach dem Import nicht mehr starten kann.Hier die stdout.txt - eventuell das mir jemand mit Rat und Tat behilflich sein könnte
BR146 MOD FILE LOADER v1.0 WARNING Loading failed, but ignored:
cannot open C:/Games/Steam/steamapps/workshop/content/446800/1156778662/config/coffee.lua: No such file or directory
BR146 MOD FILE LOADER v1.0 WARNING Loading failed, but ignored:
cannot open C:/Games/Steam/steamapps/workshop/content/446800/1156778662/config/licence.lua: No such file or directoryIch verstehe den Ablauf und anfängliches in LUA hier jedoch bin ich überfordert.
Lob gib es allemal von dieser Seite - die Diskussionen sind sehr Informativ, wenn auch hin und wieder für den professionellen Entwickler "Chefe"
oft ein Graus.LG cadpool >> xpivot1
Modlist Import .....bin einfach noch zu jung im Game bei zuviel Glatteis -
-
Neue Testversion.
Der neue Animationscode ist nun immer aktiviert, eine Linux Version gibt es nun auch.Der Animations Code führt nun eine Check durch, sollte die letzte Animationen eine open_??_<zahl> sein, wird die Zahl nun auch für die close_???_<zahl> Animation genutzt.
Der Animationsslider im Experimente Menü kann jetzt auch auf -1 gestellt werden, dann werden die TPF Default Versionen genutzt.
1.8.20190914-dev
- new: make conditional code patching possible (settings.lua)
- new: randomized vehicle animation switchable by settings.lua enablenewanimations (default enabled)
- experimental menu: allow selecting default animation via random animation slider
- sync open & close random vehicle animation (except trains)
- add linux support for random animation -
Hey there, trying to do the mod import but its not working. What are the dos and don'ts of using the mod list exporter / importer? Everytime I try to import a mod list it crashes the game. It only crashes when I fire up the load or try to activate or deactivate any mod. It freezes then crashes after 3 seconds
I get this error in the stdout: c:\build\transport_fever\steam\transport_fever_release\src\game\ui\table\moddataprovider.cpp:281: int __cdecl UI::GetNumActiveMods(const class std::vector<int,class std::allocator<int> > &): Assertion `std::count_if(modsActive.begin(), modsActive.end(), [modCount] (int n) { return n >= modCount; }) == 0' failed.
here's the file if you need more in depth details.
-
@themeatballhero
Currently I can only say, it seems to be a problem with duplicate mods but I still have no clue why this happens internally.[line][/line]
Animation, Animation, Animation
Warum auf UG und TPF2 warten?! Mehr Animationsvariatioen für alle:Neue Dev Version, Animationen werden nun via lua abgewickelt, d.h. Mod Autoren können ihr eigenes Schema entwickeln.
Code: Beispiel.mdl
Alles anzeigenlocal function AnimationCallback(data, index) -- commonapi.dmp(data) -- for testing incoming data local veh = data.vehicles[index] if (veh.opennum ~= nil) then veh.event = veh.event .."_".. veh.opennum else veh.event = veh.event .."_".. math.random(1, 20) end end function data() if (commonapi ~= nil) then if (commonapi.vehanimations ~= nil) then commonapi.vehanimations.add("vehicle/tram/Beispiel.mdl", AnimationCallback) end end
Für close Animation erhält ihr mit opennum, die letzten zwei Ziffern einer vorherigen open Animation. D.h. Damit ist es möglich Tür Animationen zu syncen. Auch könnte man theoretisch für Zugverbände nach anderen Teilen im Verband suchen und eine Animation auswählen.
1.8.20190920-dev (Windows only release)
- new: randomized vehicle animation now controlled by lua
- new: new commonapi.vehanimations.add(mdlname, fn) interface with vehicle animations enabledUm die LUA Runtime zu testen, bitte ich euch diese Version und eine ältere Version mit vielen Fahrzeugen zu testen, ob alles schnell genug läuft.
-
Okay so if i uninstall the duplicates it should work?
-
I do think so, but as said I am not sure where my code and tpfs code disagree. If it works when no duplicate mods are in your list, it would be nice to know how you resolved the problem so I can take another look at the code.
-
Most definitely will look into it. With almost 800 mods it would certainly be a nice feature!
-
Die neuste Version ist in der Webdisk, viel Spaß.
1.9.20190922
- added entityId to vehicle animation data
- new: randomized vehicle animation for linux -
@themeatballhero
Currently I can only say, it seems to be a problem with duplicate mods but I still have no clue why this happens internally.Most definitely will look into it. With almost 800 mods it would certainly be a nice feature!
Please excuse me if I meddle
I also had the problem with the 3 seconds and freeze the mods that have led to the crash of the game.I have solved the problem as follows: save game start normally in pause mode insert the modlist, save the savegame and then restart. it works for me
Since then I keep this principle for the modlist - because I prefer the Lua listing to the TPFMM, where I should say that I am still studying the TPFMM and its possibilities of the modlist.
LG
-
Eine Dev Version mit mehr Callback Möglichkeiten. Nun kann an jeder Station das Logo eines Fahrzeugs geändert werden.
Siehe dazu auch:
CommonAPI Fahrzeug Animationscallback1.11.20191002-dev
- new: color attribute in animation callback
- new: logo string attribute in animation callback (let you change logo texture on PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO material by vehicle)
- braking changes: entityId -> id to be compatible with game.interface.getEntity
- new: line and stopIndex in animation callbackBeispiel Callback für ein UG Fahrzeug: be4_6mirage,mdl (es müssen genügend Logos geladen sein, sonst das math.random(0, 18) ändern.
Lua
Alles anzeigenlocal strclose = "close" local function MirageCallback(data, index) local veh = data.vehicles[index] if (veh.event:sub(1, #strclose) == strclose) then local idx = math.random(1, 3) veh.color[1] = 0 veh.color[2] = 0 veh.color[3] = 0 veh.color[idx] = (math.random(0, 20) * 0.1) local logoidx = math.random(0, 18) veh.logo = "logo/logo_"..logoidx..".tga" end end if (commonapi ~= nil) then if (commonapi.vehanimations ~= nil) then commonapi.vehanimations.add("vehicle/tram/be4_6mirage.mdl", MirageCallback) end end
Bitte beachtet: callback data.line oder ähnliches sind nicht immer verfügbar, zum Beispiel wenn das Fahrzeug in ein Depot kommt. Es kann auch -1 annehmen für keine Linie! Solltet Ihr -1 oder nil an game.interface.getEntity geben, so gibt es einen Crash.
-
Da ist doch ein paar Versionen vorher, das Verhindern der Strassenumwandlung Stadt/Land eingebaut worden. Ich weiß aber nicht was ich da einstellen muss, damit das aktiviert ist.
Bitte Hilfe. Danke
-
Ja im Menü bei Experimental den Haken entfernen.
Wird nach neustart aber noch nicht gespeichert, also beim erneuten Laden immer wieder den Haken wegmachen.
-
Danke danke. Den Punkt hatte ich irgendwie nicht drin... obwohl die neuere Version schon installiert. Hab jetzt nochmal die .Zip in TPFMM gezogen. Da wars am meckern das eine sdl2..-Datei fehlt. Aber nu isses trotzdem in TPF einstellbar...
Aber gut zu wissen,daß man das immer wieder anklicken muss.--> -->
-
Und wer sich fragt, was ich so am machen bin:
Was nun geht:
- Verzeichnis Auslesen um eine 3D Textur zu erzeugen,
- Neue Texturmap in map_logo via CommonAPI definieren.
- Laden einer 3D Textur im Texturmanager mit Referenzzählung (Garbage Collection)
- Binden der Textur an openGL / Mesh
Was noch fehlt C++ seitig:
- Mapping zwischen Dateinamen und Shader Aufruf beim Modell an einer Haltestelle
- Mapping Cache entladen beim neu laden
- Steam Version
- Linux Version
Die Texturen müssen als PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO gerendert werden. Für TPF lohnt es nicht noch den Texturrenderer umzuschreiben.
Was fehlt noch in LUA:
- Sinnvolles Mapping zwischen Stationsnamen, Liniennamen, Position des Zuges und einem Dateinamen (Ideen gerne Willkommen)
-
Wer mag kann schon mal herumspielen mit Zugzielanzeigen oder anderen Sachen für TPF:
1.11.20191015-dev (Windows only)
- new: 3d texture support for material PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO: map_logo = "commonapi-3d/<path in texturesdirectory>/"
(default.tga in directory is required)
- new: garbage collecting material commonapi-3d
- new: with vehicle mapping code for logo textures
- new vehanimations.getLineName(data) to get current line data (temporary until better code is written)Animationscallback Beispiel:
Code: irgendwas.mdl
Alles anzeigenlocal strclose = "close" local function testcallback(data, index) local veh = data.vehicles[index] if (veh.event:sub(1, #strclose) == strclose) then local linename = commonapi.vehanimations.getLineName(data) veh.logo = "zzatest/linie-"..linename..".tga" end end function data() if (commonapi ~= nil) then if (commonapi.vehanimations ~= nil) then commonapi.vehanimations.add("vehicle/train/irgendwas.mdl", testcallback) end end
Die Zugzielanzeige braucht ein PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO Material. (d.h. dirt und co müssen auch definiert werden)Code: zugzielanzeige.mtl... map_logo = "commonapi-3d/zzatest/", }, type = "PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO"
Wenn man nicht Blender an werfen möchte kann man die Mesh Datei auch einfach editieren um die uv0 Daten in eine uv1 zu klonen: Einfach count und offset Daten kopieren:
Code: zugzielanzeige.msh
Alles anzeigensubMeshes = { ... uv0 = { count = 120, offset = 900, }, uv1 = { count = 120, offset = 900, }, materials = { "vehicle/train/zugzielanzeige.mtl", }, vertexAttr = { ... uv0 = { count = 144, numComp = 2, offset = 396, }, uv1 = { count = 144, numComp = 2, offset = 396, }, ...