Open Mamotromico opened 8 years ago
In theory the program is mostly portable. The application logic is written in Lua, and all the libraries are portable. The tricky part is the Lua host, SimpleGraphic.dll, which is a custom environment written by me in C++ which contains a 2D renderer and input handling. In theory it should be fairly portable but I've never actually attempted to do so, as I don't use either Linux or OSX. However if someone else is willing to try I'll hook them up with the source code.
Honestly I'd be willing to try, unless the code use a lot of system specific calls it shouldn't be that challenging considering its C++.
Btw that makes me even more impressed. This thing is amazing, kudos on the work so far.
Alright then. I'll pack the source code for the various components and send it to you, along with any information that you might need to port it. Not sure how long it'll take me to sort all that out; hopefully not too long.
No problem :D
I am also interested in this - just tried the program out in a windows VM and it's awesome!
Why don't you want to publish the SimpleGraphic source? Just curious.
Since my primary working computer is Linux and could not get any offline planner(this and emmitts) to work, I would definetly help in porting this aswell!
Can you hook me up with the sources and info too?
I could do that, but I should note that I'm seriously considering rewriting the native host program entirely, mostly likely against Qt or something similar. Aside from improving portability, it will also allow me to easily support Unicode (the lack of present support for which is causing quite a bit of grief!) So, attempting a port of the current host may not be a wise choice. I don't know when I'll get the time to work on the rewrite of the host though, as I'm quite short on time currently (as most of my free time is spent playing the game!) If anyone is willing to assist with that, or perhaps attempt it on their own, then that would be a great help though...
Not sure what you mean with native host program. You mean porting everything to C++/Qt? Or just the graphics stuff?
I thought about compiling the .dll as a .so file that it runs on linux for starters..
My first reply to this issue explained what the host program is (SimpleGraphic.dll); that's already written in C++, but uses a custom engine, which is what I would be rewriting. The Lua code is all portable though, at least in theory, and would require only minor changes to accommodate Unicode.
I had Qt in mind when I commented here. How much effort do you estimate is needed for a Qt rewrite? I'd be keen to mess around but can't promise I'll actually get anywhere with it.
I've never used Qt or any similar framework before, so I'm not too sure. Excluding the Lua interface code (which can be reused), the engine used in SimpleGraphic.dll is about 8000 lines of code; it's not really that complex, and I suspect Qt can handle most of it in some way or another. Aside from input handling and other low-level OS interaction, the Lua code really just needs access to a simple 2D renderer to render its UI; and I'm not sure how much work would be required to set that up.
Ah, I misunderstood you then. I have experience with C++/Qt and would like to help. Whatever is needed to make this program runnable on other platforms and more portable is fine for me.
I have been putting off getting serious with Qt for some time now, if you're willing to develop the new host in the open then I'd be more than happy to try to contribute some work into it too.
I'd be happy to port SimpleGraphic to linux, I would love to have PoB available without having to reboot to windows everytime I feel like theory crafting something. It seems to only use the windows api & opengl, so it should not be that hard to rewrite the windows api part to something like glfw to have a multi-platform engine. Is it possible to get the source code?
What is the current status of rewriting the SimpleGraphic Module?
I'm hoping to get it done before 3.0 is released, but I haven't been able to start work on it yet, so I'm still unsure if I can manage to get it done in time.
I've actually been doing a bit of work on this here and there. It's starting to come together: progress pics. Mouse input not working yet and I only got to the second screen by adding support for the escape key, so can't actually do anything further yet.
Maybe you could give me some tips on that Openarl? I'm calling launch:OnKeyDown and launch:OnKeyUp with key = "BUTTON" when the mouse is clicked/released, but nothing happens.
I've also had the same code running on linux to the same degree of success, for those not on OSX.
Ah, nice! So you're using Qt? Did you get a copy of the source for the current version, or are you working from scratch? I suspect the latter, as the answer to the mouse click problem is easily found in there (the key name is "LEFTBUTTON"), so here's the latest version. I think you'll want to re-use the existing Lua interface code (ui_*), as you may have a hard time reproducing some of it.
Yes it's in Qt. Yup I've just been reverse engineering it from the Lua code, that source will be a big help!
Looks really nice, hope you can continue with the Qt version :) So we can use PoB on Linux :D
noice
thanks for the effort, really looking forward to it!
OK if anyone is foolhardy enough to try building it, my latest code is attached: pobfrontend.zip.
There's a readme that I just wrote off the top of my head without actually checking that it's accurate. The code is awful. AWFUL. Proceed at your own risk.
That said, as far as I know everything works except for updating. If any brave souls do give it a go let me know of any problems you have building it or any bugs you find and I'll try to help/fix.
@philroberts Hi, I gave it a try and managed to compile it and almooost run it, I got the following error when starting (running on archlinux if that matters):
lfxgroove@krattgata $ ../build/pobfrontend
PANIC: unprotected error in call to Lua API (../PathOfBuilding/Launch.lua:38: module 'xml' not found:
no field package.preload['xml']
no file './xml.lua'
no file '/usr/share/luajit-2.0.5/xml.lua'
no file '/usr/local/share/lua/5.1/xml.lua'
no file '/usr/local/share/lua/5.1/xml/init.lua'
no file '/usr/share/lua/5.1/xml.lua'
no file '/usr/share/lua/5.1/xml/init.lua'
no file './xml.so'
no file '/usr/local/lib/lua/5.1/xml.so'
no file '/usr/lib/lua/5.1/xml.so'
no file '/usr/local/lib/lua/5.1/loadall.so')
I've tried running luarocks install xml
but that didn't seem to help unfortunately, any idea of what might be missing? Thanks in advance and thanks for doing this! Will take a look at the code later and see if it might be able to help with something there :)
Edit: It seems I'm trying to run with lua 5.1 while I've installed the xml package for lua 5.3, will take a look at updating my packages and give it a go again!
Edit 2: Tried it but now it can't find LoadXMLFile instead, any idea which library i should be using to get it? It seems that it is not given by the runtime itself as far as i can tell at least. @Openarl do you have any idea what it might be?
$ ./pobfrontend module 'xml.LoadXMLFile' not found: no field package.preload['xml.LoadXMLFile'] no file './xml/LoadXMLFile.lua' no file '/usr/share/luajit-2.0.5/xml/LoadXMLFile.lua' no file '/usr/local/share/lua/5.1/xml/LoadXMLFile.lua' no file '/usr/local/share/lua/5.1/xml/LoadXMLFile/init.lua' no file '/usr/share/lua/5.1/xml/LoadXMLFile.lua' no file '/usr/share/lua/5.1/xml/LoadXMLFile/init.lua' no file './xml/LoadXMLFile.so' no file '/usr/local/lib/lua/5.1/xml/LoadXMLFile.so' no file '/usr/lib/lua/5.1/xml/LoadXMLFile.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './xml.so' no file '/usr/local/lib/lua/5.1/xml.so' no file '/usr/lib/lua/5.1/xml.so' no file '/usr/local/lib/lua/5.1/loadall.so' PANIC: unprotected error in call to Lua API (../PathOfBuilding/Launch.lua:39: attempt to call field 'LoadXMLFile' (a nil value))
luafilesystem 1.6.3-2 (installed) - /usr/lib/luarocks/rocks-5.1
lub 1.1.0-1 (installed) - /usr/lib/luarocks/rocks-5.1
xml 1.1.3-1 (installed) - /usr/lib/luarocks/rocks-5.1
looks similar to above
edit: i dont get it from what package is xml.so supposed to be coming from?
Oh right my bad! There are three libs that come with PathOfBuilding that I hackishly copied into the base dir. If you look in runtime-win32.zip from the main PathOfBuilding repo you'll find a lua directory with xml.lua, base64.lua and sha1.lua. Copy those into your PathOfBuilding clone and try again. Sorry about that. I told you it was awful!
cool i copied the luas from the runtime zip too every possible location cause im not smart. ;p so then it complained about lua curl so. sudo luarocks-5.1 install lua-curl.
and then wooooo main screen, lookin bit funky tho.
fkin awesome gj!
edit: not sure where the font problem is, might be local for me, can someone check if they get weird font sizes and stuff?
Ah yeah that's a thing I've had too, I had a hard-coded fudge factor. Here's an update with command-line args to set the font fudge factor and the font name.
e.g.:
pobfrontend 4 # Increase all font sizes by 4 points
pobfrontend -6 DejaVuSans # Decrease fonts by 6 points, use Deja Vu Sans font.
I managed to build pobfrontend on my Mac, but when I execute it get the following error:
dyld: Library not loaded: @rpath/QtGui.framework/Versions/5/QtGui
Referenced from: /Users/mfritzsc/devel/playground/PathOfBuilding/./pobfrontend
Reason: image not found
I have never done any Qt development und and just installed Qt the open source version of 5.9.
Edit: To be able to build I had to add 'Core'
to the Qt modules in the mesos.build
file.
Hmm, how did you build it? You might be missing some linker flags to tell it where the Qt frameworks are. Something like -rpath /path/to/qt/frameworks? I'm pretty rusty on OSX development (which is why I punted to meson :)).
I added the qt bin dir to my PATH and then used meson+ninja to build just like in the read me. Never done any lua or qt dev, so it might some error in my setup
I think it's mostly that OSX does its own thing when it comes to searching for shared libraries. My guess is that the Qt frameworks you have are built differently to mine. What's the output of
otool -D /path/to/QtGui.framework/Versions/5/QtGui
?
In any case, IIRC you can workaround this for now by exporting the environment variable DYLD_FALLBACK_LIBRARY_PATH:
export DYLD_FALLBACK_LIBRARY_PATH=/path/to/qtframeworks
I'm not sure if there's some magic pixie dust I need to add to the meson.build to cover this situation, or if I'm even on the right track. :)
Hi again, tried extracting the lua files for XML etc from the PathOfBuilding repo and I now get a window when running your front end, however it is fully black :( I don't have too much experience with OpenGL but managed to check for errors and got a GL_INVALID_OPERATION
error in the implementation of DrawImageQuad::execute(), the invalid operation error is seen when the code runs glEnd();
. Any ideas on why that might be? This is the version glGetString(GL_VERSION)
reports: "4.5.0 NVIDIA 381.22" Could that be part of the problem? I used this hacky macro to check for errors around the code:
#define CHECK_ERROR \
do{ \
GLenum errCode; \
\
if ((errCode = glGetError()) != GL_NO_ERROR) { \
std::string s; \
switch (errCode) { \
case GL_INVALID_ENUM: \
s = "GL_INVALID_ENUM"; break; \
case GL_INVALID_VALUE: \
s = "GL_INVALID_VALUE"; break; \
case GL_INVALID_OPERATION: \
s = "GL_INVALID_OPERATION"; break; \
case GL_STACK_OVERFLOW: \
s = "GL_STACK_OVERFLOW"; break; \
case GL_STACK_UNDERFLOW: \
s = "GL_STACK_UNDERFLOW"; break; \
case GL_OUT_OF_MEMORY: \
s = "GL_OUT_OF_MEMORY"; break; \
default: \
s = "DONT_KNOW_ERROR"; break; \
} \
fprintf (stderr, "%d: OpenGL Error: %s\n", __LINE__, s.c_str()); \
}}while(0);
hmm the new pobfrontend.zip turned out like this
|-- claes@sexy:~/clones/pobfrontend2/PathOfBuilding (master) --| $ /home/claes/clones/pobfrontend2/build/pobfrontend
PANIC: unprotected error in call to Lua API (Classes/PassiveTree.lua:61: attempt to index local 'treeFile' (a nil value))
@lfxgroove If you have one of those CHECK_ERRORS between glBegin and glEnd then that might be the source of the error :) Doesn't answer the question of why your whole thing is black, though! Is it possible your qt is linked against a different version of the opengl library than pobfrontend?
@ccomly Hmm I don't see how anything I changed could have done that. Does the old version still work as before? That looks like lua was unable to open one of the TreeData/2_6/tree.lua or TreeData/3_0/tree.lua files.
yeah needed to unzip the tree.zip didnt remember doing that on the previous clone. gonna try the fonts now <3
Yeah you shouldn't need to, it downloads the data if it's not there. Weird! Unless pathofexile.com had a hiccup. I've had that happen before when downloading image assets for PoB. I was very confused!
Oh right! Yeah I actually flagged this as a PathOfBuilding bug in my head when it happened to me but never got around to reporting it, haha. PoB creates the TreeData directory, but not the 2_6 and 3_0 subdirectories, so when it tries to open files in those directories to download the tree data it dies. Workaround: manually created the 2_6 and 3_0 subdirs, or as you did just unzip tree.zip.
I already tried using DYLD_LIBRARY_PATH
and DYLD_FALLBACK_LIBRARY_PATH
without any success.
But the following command resolved the dyld Error:
install_name_tool -add_rpath /Users/[redacted]/devel/tools/qt/5.9.1/clang_64/lib
Then I just had to uninstall lua-5.2 in favor lua-5.1 to fix some issue with lua-curl, unzip the tree and now it works 👍
@philroberts Very good point, that seems to take care of that error, thanks!
I tried with ldd to find if they're linked against the same OpenGL libraries, it seems so at least (is that a good way of checking what they're linked against?):
$ ldd ../build/pobfrontend
linux-vdso.so.1 (0x00007ffd85ff8000)
libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007fe751f82000)
libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007fe75188d000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007fe751602000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007fe7513eb000)
libluajit-5.1.so.2 => /usr/lib/libluajit-5.1.so.2 (0x00007fe75117a000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fe750df2000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fe750ae0000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fe7508c9000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fe750523000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fe750305000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007fe7500cf000)
libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007fe74fe3b000)
libicui18n.so.59 => /usr/lib/libicui18n.so.59 (0x00007fe74f9bd000)
libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0x00007fe74f60c000)
libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007fe752854000)
libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x00007fe74f39d000)
libdouble-conversion.so.1 => /usr/lib/libdouble-conversion.so.1 (0x00007fe74f18d000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fe74ef89000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007fe74ec76000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe7526f8000)
libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007fe74ea44000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007fe74e705000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007fe74e4f3000)
libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0 (0x00007fe74e23d000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007fe74df76000)
libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007fe74dd4a000)
libicudata.so.59 => /usr/lib/libicudata.so.59 (0x00007fe74c237000)
libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fe74c021000)
libcap.so.2 => /usr/lib/libcap.so.2 (0x00007fe74be1d000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fe74bc15000)
liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007fe74b9ef000)
liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007fe74b7db000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007fe74b4cd000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007fe74b2b8000)
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007fe74b045000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007fe74ae1c000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007fe74ac0c000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007fe74aa08000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007fe74a802000)
and for /usr/lib/libQt5Gui.so:
$ ldd /usr/lib/libQt5Gui.so
linux-vdso.so.1 (0x00007ffdf9fa2000)
libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007f8079ac4000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f80798a6000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f807961b000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f80793e5000)
libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007f8079151000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f8078f3a000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f8078bb0000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f807889e000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f8078687000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f80782e1000)
libicui18n.so.59 => /usr/lib/libicui18n.so.59 (0x00007f8077e63000)
libicuuc.so.59 => /usr/lib/libicuuc.so.59 (0x00007f8077ab2000)
libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007f8077a28000)
libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x00007f80777b9000)
libdouble-conversion.so.1 => /usr/lib/libdouble-conversion.so.1 (0x00007f80775a9000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f80773a5000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f8077092000)
/usr/lib64/ld-linux-x86-64.so.2 (0x0000559bbafa2000)
libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007f8076e60000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f8076b1f000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x00007f807690d000)
libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0 (0x00007f8076657000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007f8076390000)
libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007f8076164000)
libicudata.so.59 => /usr/lib/libicudata.so.59 (0x00007f807464f000)
libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f8074439000)
libcap.so.2 => /usr/lib/libcap.so.2 (0x00007f8074235000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007f807402d000)
liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f8073e07000)
liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007f8073bf3000)
libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007f80738e3000)
libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f80736ce000)
libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007f807345b000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007f8073232000)
libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f8073022000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x00007f8072e1c000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007f8072c16000)
I can see that the libGL.so.1 is equal for both, same for the libGLX.so.0 and libGLdispatch.so.0, so at least it seems that they're linked against the same versions of the libraries? I'll try out a full system update as well and see if there might be some version mismatches that get fixed.
@lfxgroove Yep that's perfect, all looks fine. Unfortunately this means I'm stumped! I'll have a bit more of a think about what could be going on, but I'm hardly an openGL guru myself. It could just be a driver issue or something, or I could have done something bad that isn't showing up for those of us that have it working correctly.
@MxFr Brilliant, I wasn't expecting anyone to get it going on OSX so this is great news!
@philroberts Hey, an update got the window drawing stuff! I got an error about lcurl
not existing in the console window now, will fix those errors and report back soon!
Note to self: the update changed the opengl version to: OpenGL Version: 3.0 Mesa 17.1.5
.
Edit: It works! :D Thanks for the help with debugging!
pobfrontend -6 DejaVuSans
pretty legit can read everything it looks like at first glance <3
some testing later and most stuff works except importing builds it seems. it segfaulted a couple of times, and then it stopped.
now it doesnt segfault (didnt change anything) and its using 90%ish of cpu, but the import doesnt happen.
so it looks like its trying to import? idk. i let it go at it for a while maybe its just really slow
is there a way to get some debugs to console or something?
or here
Hmm are we talking character import or pastebin import? I've tested the former a fair amount but just tried hammering the latter and got a couple of crashes, it seems inconsistent. Will investigate.
OK, this is embarrassing. DON'T LOOK.
noice importing via tree/codes works. just the "import from pastebin" that didnt work for me. entering the raw codes works! yeyyyy
Import from pastebin still doesn't work with the latest version? The problem I fixed was with decompressing the code which would still have triggered if you entered the raw code, I believe? Though as I said it was intermittent (memory allocation bug).
Is there any chance to see builds for Linux / OSX?
Or add more information about the project so we can try to build/compile for another targets, not sure. Mostly curious about it.