PathOfBuilding icon indicating copy to clipboard operation
PathOfBuilding copied to clipboard

Builds for other platforms?

Open Mamotromico opened this issue 9 years ago • 148 comments

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.

Mamotromico avatar Sep 27 '16 23:09 Mamotromico

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.

Openarl avatar Sep 28 '16 02:09 Openarl

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.

Mamotromico avatar Sep 28 '16 03:09 Mamotromico

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.

Openarl avatar Sep 28 '16 03:09 Openarl

No problem :D

Mamotromico avatar Sep 28 '16 03:09 Mamotromico

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.

philroberts avatar Oct 03 '16 07:10 philroberts

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?

berserkingyadis avatar Mar 13 '17 11:03 berserkingyadis

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...

Openarl avatar Mar 15 '17 14:03 Openarl

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..

berserkingyadis avatar Mar 15 '17 19:03 berserkingyadis

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.

Openarl avatar Mar 16 '17 06:03 Openarl

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.

philroberts avatar Mar 16 '17 06:03 philroberts

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.

Openarl avatar Mar 16 '17 07:03 Openarl

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.

berserkingyadis avatar Mar 16 '17 07:03 berserkingyadis

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.

AlpacaRotorvator avatar Mar 16 '17 16:03 AlpacaRotorvator

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?

jbigalet avatar Apr 19 '17 21:04 jbigalet

What is the current status of rewriting the SimpleGraphic Module?

Rai4n avatar Jul 20 '17 16:07 Rai4n

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.

Openarl avatar Jul 21 '17 05:07 Openarl

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.

philroberts avatar Jul 21 '17 11:07 philroberts

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.

Openarl avatar Jul 22 '17 08:07 Openarl

Yes it's in Qt. Yup I've just been reverse engineering it from the Lua code, that source will be a big help!

philroberts avatar Jul 22 '17 08:07 philroberts

Looks really nice, hope you can continue with the Qt version :) So we can use PoB on Linux :D

Rai4n avatar Jul 22 '17 20:07 Rai4n

noice

ccomly avatar Jul 28 '17 18:07 ccomly

thanks for the effort, really looking forward to it!

berserkingyadis avatar Jul 29 '17 14:07 berserkingyadis

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 avatar Aug 02 '17 15:08 philroberts

@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?

lfxgroove avatar Aug 02 '17 18:08 lfxgroove

$ ./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))

Installed rocks:

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?

ccomly avatar Aug 02 '17 21:08 ccomly

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!

philroberts avatar Aug 02 '17 23:08 philroberts

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.

untitled

screenshot at 2017-08-03 09-33-55

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?

ccomly avatar Aug 03 '17 07:08 ccomly

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.

pobfrontend.zip

e.g.:

pobfrontend 4 # Increase all font sizes by 4 points
pobfrontend -6 DejaVuSans # Decrease fonts by 6 points, use Deja Vu Sans font.

philroberts avatar Aug 03 '17 08:08 philroberts

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.

MxFr avatar Aug 03 '17 09:08 MxFr

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 :)).

philroberts avatar Aug 03 '17 10:08 philroberts