Open dirdante2 opened 1 month ago
Hey, thanks for the interest! I've started playing Factorio v2.0 too, and I would really like to get this project to a more working state.
I suspect it will be easy to update. Kafkatorio doesn't depend on other Factorio mods, and doesn't use anything too advanced.
However, Kafkatorio is essentially an over-complicated tech demo. I'm not sure it's practical to use in real life. I think it'd be easier to remove Kafka and use SQLite instead. But that's a big refactor! Or maybe scrap everything and use Clusterio!
For now, I'll try updating the available tech bit-by-but. However, I don't have as much spare time to work on this any more, so I wouldn't expect any significant changes.
A new release of https://github.com/GlassBricks/typed-factorio is necessary for supporting Factorio 2.0.
@aSemy I've published a release at ni typed-factorio@npm:@dimava/typed-factorio@2.14.0
you may try in meanwhile
Psst! typed-factorio has just updated to factorio v2.0!
Thank you very much for the update @GlassBricks! I'm looking forward to working with your library again.
I've been tinkering with getting Kafkatorio up and running again, and it's hard work. A lot of my documentation and practices are very outdated or were dependent on system config I no longer have. It might be a while before I can get something working again.
While I'm here, I've been thinking about the implementation of Kafkatorio, and I'm wondering if anyone knows if there have been any changes in to Factorio's Lua API that might help? Is it easier to encode or decode arbitrary data to/from Json? Are there better ways to emit data in and out of a Factorio server than log messages? Maybe if there's a significant change it'd be easier to reimplement parts of Kafkatorio.
Not new stuff, but providing some comments:
table_to_json
and json_to_table
util functions. In 2.0 the functions have moved from game
to helpers
. just be aware that an empty array serializes as {}
(because lua).encode_string
and decode_string
for compression + base64.write_file
instead of log messages to output information, and have some external program monitor the files. Could be a recipe for excessive temporary files, though.Thanks!
IIRC write file will be called for all users, not just for the server, yeah, it would fill up everyone's machines with data. And while the server could clean up the files, there's no mod function to delete the old files.
Thinking out loud about other options...
I used to think that RCON could be an option, but iirc it wasn't performant, and didn't have a good way to identify or authenticate users.
One idea I haven't explored is programatically decoding the Factorio packets (https://github.com/Hornwitser/factorio-greyroom), then Kafkatorio could connect to a server as a regular user and access the data as a regular user.
I'm working through updating the mod to 2.0 now, and I have a question if you have the time to help @GlassBricks.
I want to get the x/y values of a MapPosition, but MapPosition is either an array or a struct. I'm not sure how to do this... It's been a while since I looked at TypeScript.
function collisionBox(collision_box: BoundingBoxStruct): MapBoundingBox {
return {
leftTop: Converters.entityPosition(collision_box.left_top),
rightBottom: Converters.entityPosition(collision_box.right_bottom),
}
}
function entityPosition(position: MapPosition): MapEntityPosition {
return [position.x, position.y]; // ERROR TS2339: Property x does not exist on type MapPosition
// ERROR TS2339: Property y does not exist on type MapPosition
}
EDIT: Ah, I had the wrong imports. I had imported the MapPosition
from prototypes, not runtimes. I think it's working now...
Hello
Is it possible to use the map server with Factorio version 2.0? mayby there are some fundamental changes in the base game compared to version 1.0 that could impact compatibility. Any plans to updates for making the map server work with Factorio 2.0 would be appreciated.