Page 1 of 1
Factsim - A Factorio combinator simulator
Posted: Tue May 02, 2017 6:05 pm
by cid0rz
Hello guys. I was just wiring too much in Factorio ^^, after doing my train delivery system and testing it under many circumstances i wanted to improve it in some ways. The problem is developing complex systems in Factorio directly has some inconveniences. So as I have some basic skills in python programming I came up (yes, i know) with the crazy idea of doing a simulator where you can test the circuits and debug your systems. So Then I started to work, reading, thinking etc. I came across really nice information. I was able to decode a blueprint string with the old format (I'm struggling with the new one still) and then i found a library for creating flowcharts (pyDrawing) that was old but looked good. Then I came here for the blueprint string code after asking DaveMc. I saw some things I didn't know about, I was not aware of this subforum, I should have checked before ^^.
Now that the intro is done, what do you think about the idea? This would be my first open source project so be patient with me
but I was just watching if it was possible and playing with the idea. I think It won't be easy but it can be fun, I'd like to learn better programming so that's what I was doing this for originally. In the pyDrawing library there is an example editor program that I'm using as base. I changed the left toolbar and customized the created entities (just the text for now) and here you can see an screenshot:
So for now none of the behavior (that has been extended in 0.15) has been implemented. In fact now I was planning to change the connections since the library has some way of connecting entitites and keeping them connected but not enough control to implement green and red wire and signal transfer etc. The idea is to once drawn or imported, the circuit can be run tick by tick, getting the output in certain points. I don't know how far will I be able to go with my poor skills but it would be nice to have something flexible and easy to use. A configuration window for the entitites is needed and maybe also a new entity, called network or circuit to store and propagate the signals.
If you have comments, suggestions, if you want to help or even to lead this project, you are welcomed as long as I can bother you a bit xD. For now as I say alsoo one of may main concerns is not being able to decode the blueprints. I'm trying since the error says incorrect padding for the base64 encoding to pad it but doesn't work.
Re: Factsim - A Factorio combinator simulator
Posted: Mon May 29, 2017 7:13 pm
by cid0rz
Hello all, after trying a bit I spent too much time learning stuff about GUI's and at some point I got a bit bored since it was not my main objective for this project. Also using a library that is not mantained or updated is not a good idea. I found some bugs on the library and i didn't finally liked how it all worked. Also I'm quite noob programmer as stated so I decided to star programming the simulator and just make like a command line old style program
My plan is to ddevelop a bit the interface just by pure scripting and printing or with some tool like urwid or a command line suite.
For now I've tested it with simple circuits and there is a lot I have to test with special cases.
first one is a simple clock a constant combinator outputting 1 signal A and a decider looped that will output A<20
second one is sort of a special switch that stores negative values from a constant combinator but only one tick and untill you turn off the constant combinator the cell will be blocked. I added the upmost decider to make a backwards counter
You can find the outputs as .txt attached. You'll need notepad++ or similar to be able to see until tick 30. Notepad cuts it at 19 or so.
I'm very happy so far to have something that at least works xD. My idea is to put it on github soon
Re: Factsim - A Factorio combinator simulator
Posted: Wed Jul 19, 2017 7:22 pm
by cid0rz
So here is the github link that the factsimguru gave me:
https://github.com/Factsimguru/Factsim
Re: Factsim - A Factorio combinator simulator
Posted: Fri Jun 08, 2018 7:24 am
by provet
interesting idea, too bad it hasn't got much attention
Re: Factsim - A Factorio combinator simulator
Posted: Mon Aug 27, 2018 10:33 am
by cid0rz
Hey I got some interest from another player on PM, would you also be interested in doing/improving this? ^^
Re: Factsim - A Factorio combinator simulator
Posted: Sun Mar 13, 2022 1:19 am
by cid0rz
Some improvements have been made and now it actaully works
. I would be glad if somebody can test it and give some feedback.
Re: Factsim - A Factorio combinator simulator
Posted: Sat Mar 26, 2022 12:05 pm
by Qon
I'm considering making some sort of text language that compiles to combinators, and a HDL maybe. Might never happen at this rate, but maybe.
But I appreciate the effort in adjacent areas, even if it's not quite what I'm looking for. Seems like a great and impressive project. I might try it out some time if need arises, but anyways hope you get good use of it and continue to share further developments on the tool!
Re: Factsim - A Factorio combinator simulator
Posted: Tue May 17, 2022 12:20 pm
by Aquilo
What am I doing wrong?
python-3.8.0-embed-win32\python.exe FactSim.py
Code: Select all
Traceback (most recent call last):
File "factsim.py", line 30, in <module>
import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'
Re: Factsim - A Factorio combinator simulator
Posted: Tue May 17, 2022 11:21 pm
by Silari
You don't have the tkinter module installed in your python environment. It was included by default on Windows but that may have changed, and can depend on how you installed python. Look up how to install python modules for your setup and install the tkinter module.
Re: Factsim - A Factorio combinator simulator
Posted: Tue Feb 07, 2023 6:16 pm
by spacedestructor
I may have done some errors on my end since i dont have any previous python experience but i did install python to test this out and its always either giving out errors or just not doing anything at all.
So im simply just posting the error thats related to the project it self and not python. dont know if im missing any dependencies and if yes how i would get those.
The Error is as follows:
Code: Select all
opening: L:/Tools/Factorio/Factsim/Factsim-master/FactSim.py from filedialog
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\base64.py", line 37, in _bytes_from_decode_data
return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\u2265' in position 9615: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "L:\Tools\Factorio\Factsim\Factsim-master\FactSim.py", line 1046, in <module>
f = Factsimcmd()
File "L:\Tools\Factorio\Factsim\Factsim-master\FactSim.py", line 665, in __init__
self.blueprint = open_blueprint(filename=filename)
File "L:\Tools\Factorio\Factsim\Factsim-master\FactSim.py", line 74, in open_blueprint
jsonstringdata = base64.b64decode(jsonstring64)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\base64.py", line 80, in b64decode
s = _bytes_from_decode_data(s)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\base64.py", line 39, in _bytes_from_decode_data
raise ValueError('string argument should contain only ASCII characters')
ValueError: string argument should contain only ASCII characters
Re: Factsim - A Factorio combinator simulator
Posted: Fri Sep 29, 2023 6:21 pm
by PostmodernPrometheus
It looks like you're trying to import a blueprint with a non-ascii character in it, it's complaining that the 9615'th character is not a valid ascii character ('\u2265' is apparently a non-ascii greater-than-equals character -
ref).
Factorio blueprints are all base64 encoded. Base64 encodes everything to ascii-only characters, so you shouldn't be getting non-ascii characters.
I'd guess you saved the blueprint in a Microsoft product that does autocorrect (like Outlook or Word) and it automatically changed two ascii characters ">=" into a single unicode character "≥".
If you can, just copy-paste directly from Factorio into python. Or if you need to save a blueprint to a file you can use something like Notepad++ that will treat ascii text as plain-old text.
Re: Factsim - A Factorio combinator simulator
Posted: Fri Sep 29, 2023 10:00 pm
by spacedestructor
PostmodernPrometheus wrote: ↑Fri Sep 29, 2023 6:21 pm
It looks like you're trying to import a blueprint with a non-ascii character in it, it's complaining that the 9615'th character is not a valid ascii character ('\u2265' is apparently a non-ascii greater-than-equals character -
ref).
Factorio blueprints are all base64 encoded. Base64 encodes everything to ascii-only characters, so you shouldn't be getting non-ascii characters.
I'd guess you saved the blueprint in a Microsoft product that does autocorrect (like Outlook or Word) and it automatically changed two ascii characters ">=" into a single unicode character "≥".
If you can, just copy-paste directly from Factorio into python. Or if you need to save a blueprint to a file you can use something like Notepad++ that will treat ascii text as plain-old text.
What i did was saving it to a text file using visual studio code since thats my default text editor and i know it doesnt auto correct anything. so im confused how a non modified factorio string straight from the game can generate an error.
Re: Factsim - A Factorio combinator simulator
Posted: Tue Oct 03, 2023 2:21 am
by PostmodernPrometheus
spacedestructor wrote: ↑Fri Sep 29, 2023 10:00 pm
[What i did was saving it to a text file using visual studio code since thats my default text editor and i know it doesnt auto correct anything. so im confused how a non modified factorio string straight from the game can generate an error.
Yeah that's weird, I can't explain that. I f don't know if you've seen/used this web encoder/decoder but it might give you a second opinion:
https://factorio.tmin10.ru/