It is currently 18 Jun 2019, 01:47
   
Text Size

[Proof of concept] Run mobile Forge full-screen on PC

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, friarsol, Blacksmith, KrazyTheFox, Agetian, CCGHQ Admins

[Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 22 Dec 2016, 18:45

Last Updated: Aug 14, 2017

Hi guys!
Recently I've been experimenting with making the "forge-gui-mobile-dev" project somewhat more useful for practical purposes. In particular, I disabled the window resizing since that caused nearly irreparable visual glitches until you restarted the game. More interestingly, I added a couple additional options to the configuration of this project (see the relevant Main.java) which basically allows it to operate as a full-screen desktop application, effectively serving as a form of a "back-port" of the mobile Forge app to PC (the forge-gui-mobile-dev project uses the Lwjgl wrapper for libgdx, which is available in native form for 32-bit and 64-bit Linux, Mac and Windows).

Because of this interesting and somewhat nice side effect, it's now possible to launch Forge with the mobile app interface on PC. While not necessarily fully convenient (since the program was written with a cellphone/tablet touch interface in mind), it can be quite handy to experiment with the tablet interface and to test it in a screen that is bigger than a door peephole on modern monitors, and it can even be used to play Planar Conquest on PC (for those of you without Android devices :)).

In the bottom of this post you will find an archive with the snapshot compiled this way and ready for running on your PC without any additional dependencies. Please note that this is not an official Forge beta release and it is unsupported, you can try using it at your own risk but Forge developers can't provide any support for it whatsoever if things go wrong or don't work for you.

Note that this is just a straightforward launcher/wrapper for mobile Forge. Nothing has been changed in the original mobile Forge, so the interface has a few caveats when used on a standard PC with a keyboard and a mouse:

- The following keyboard buttons work in this game: Space (or Enter) is used for the action that is on the bottom left side on the battlefield (keep hand, OK to move to the next phase, auto mana payment etc.), and Esc is used for the action that is on the bottom right side of the battlefield (skip turn, alpha strike/call back, mulligan etc.). E can be used for an explicit end of turn, and A for alpha strike. Ctrl+C concedes the match.
- To quit the game, either press Alt-F4 (which quits without confirmation) or use Esc in the main menu (which quits with confirmation).
- Left-clicking a mouse is the same as touching the tablet screen with a finger, so it's used for pretty much all actions (tapping cards, selecting things in menus, confirming actions etc.).
- To zoom in on the cards, hold LMB over the card for approximately a second (which is essentially the same as tap-holding it with a finger on a tablet or a cellphone).
- Changing the size of the cards in deck editors can be achieved via the mouse scroll wheel while holding Ctrl.
- Whenever the game asks you to "swipe" things, you can LMB-drag in the given direction (hold the left mouse button and drag) to swipe. Not very convenient, but it works.

If anyone has a touch-enabled monitor or laptop, I'm actually curious to know how well this operates with it (I'm assuming that it should work quite well with an actual touch device).

The following issues are also known and I'm currently not sure how to resolve them:
- The game was only tested in three different resolutions: 1920x1080, 1366x768 and 1680x1050. It will most likely work well with any 16:10 or 16:9 resolution, but it may fail to work on some of them or on some other aspect ratios (some issues in certain 4:3 modes were reported, but some 4:3 modes were reported to work well, such as 800x600). The game is rather picky about how things are placed according to the aspect ratio that is used, so if the game screen is garbled for you, probably the game does not like your display resolution for one reason or another. Please switch to another resolution (preferably with the 16:10 or 16:9 ratio) if at all possible. Alternatively you can create the file "screen_resolution.ini" in your game folder (the same where the .jar file resides) and specify the desired resolution inside in the WxHxFS format, where FS is either "1" for fullscreen or 0 for windowed (e.g. 1920x1080x1 will run the game in 1920x1080 full screen, and 1280x800x0 will run the game in 1280x800 windowed). Then the game will try to switch the monitor to that resolution when launched.
- You can set the game to use the same card pictures and stuff as your desktop Forge uses. For that you can either try using the folder selector in Forge preferences or, if that fails (for some reason it crashed on the Windows 10 system when my friend tried it and I haven't yet investigated that), just hand-edit forge.profile.preferences in the game folder and set the cacheDir parameter manually.

Also, note the following:
- The game was only tested on Linux Mint 18.2, Windows 10, and macOS, but it should work on any other recent Linux distro or any other recent version of Windows. Feedback is welcome as to whether this worked on your system or not (please include your OS and your monitor resolution for information).

To run this game:
If you have a system that understands Bash scripts (Linux, BSD, Windows 10 which now has bash, probably macOS), you can try running the forge-mobile.sh file and see if that works for you.

If that doesn't work for you or your system doesn't understand Bash, you can use this command to run the game manually (you can create a .cmd file on Windows with the following contents if you're using, for example, Windows 7 or 8/8.1):
java -Xmx1024m -jar forge-mobile.jar

If .jar files are associated with Java on your system, double-clicking forge-mobile.jar should probably work too.

Good luck if you'd like to tinker with this hack :)
Remember that it's purely experimental though!

DOWNLOAD LINK: https://www.dropbox.com/s/ymfy0978mimsq ... ar.gz?dl=0

- Agetian
Last edited by Agetian on 04 May 2017, 06:58, edited 9 times in total.
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 24 Dec 2016, 15:08

I updated the snapshot for anyone interested. Now it's possible to specify the desired fullscreen resolution by creating a text file "fullscreen_resolution.ini" in the game folder and writing the desired resolution inside, e.g. 1920x1080. Also, some landscape mode visual glitches were fixed (related to tab headers and the Chaos Wheel), which also benefits the actual mobile Forge ran on Android devices. Also, the game no longer hangs when the player gets an achievement.

On Mac devices, a special HiDPI mode will be enabled (note that you may have to set the screen resolution to the actual hi-res, e.g. 2560x1600, before this becomes noticeable).

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 19 Jan 2017, 21:36

Great test!
I tried it and it works great
Paradoxically, the interface is much lighter and certainly it will work better when I try with the projector at 800x600.
This thing could come in handy for the tablet without Android

P.s. where I can find snapshot version?
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 20 Jan 2017, 04:58

Thanks for your interest, vinnie! I'll update the build to the current snapshot later today since there is someone interested in it :) Glad to hear it's working well for you, and indeed, it'd be nice to hear how it works on non-Android tablets with standard Java implementations (I don't know, possibly Windows tablets? :/ )

EDIT: updated the first post to January 20, 2017 snapshot.

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 20 Jan 2017, 21:56

Ok, i have only 2 problems, and imho is both caused by unity of ubuntu and not from forge.
1) the game does not start in full screen (in this way the game started only twice, but I was not able to replicate this).
I tried to set the rules of the window as suggested on this page http://askubuntu.com/a/142493 (with class=Forge) but does not seem to work. The top bar of unity does not hide and the forge window remains too low, out of the screen. I try also with this solution http://askubuntu.com/a/823915 but even this did not work (but it works for other software).
2) I tried the configuration file that you mentioned in the second post, but this seems really do not cause changes:
Code: Select all
$ cat ./MTG-Forge-Mobile-Backport-20-jan-2017/fullscreen_resolution.ini
1280x700
I have a convertible notebook (x201 tablet by lenovo), unfortunately in ubuntu 16.04 works only the wacom digitizer, I will test this version of Forge on the old xubuntu 14.04, I am sure everything will work on it
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 21 Jan 2017, 04:20

@ vinnie: Umm I'm not sure if 1280x700 is a valid resolution, can you try 1280x720 or 1280x800 instead? (those are the closest 16:9/16:10 resolutions that I'm aware of in that range). It could, of course, also be Unity shenanigans, yeah. For what it's worth, it works fine on Linux Mint 18.1 Cinnamon, Xubuntu 16.04 and Manjaro Xfce (current rolling release). :)

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 21 Jan 2017, 15:54

ok, I tried it on Xubuntu 14.04 and unfortunately I have same problem (forge is started only once in full screen), the only thing in common between the two ubunti is compiz (yes, I have also compiz on xfce), so perhaps is it the responsible.

However, unlike unity, I don't have a bar above which can not be covered, so doing a little changes on "windows rules" I managed to center the forge window, and this is the result:
IMG_20170121_162423.jpg

Yes, it is forge through a projector at 800x600 and is playable, so, great work Agetian =D>

I hope that this problem with the full screen can be resolved (another small problem is that with two monitors this version of forge does not start but crashes with an error), but also have this alternative is really a great opportunity to play at lower resolutions.

P.s. uhm, fullscreen_resolution.ini accept only valid resolution? later I try with standard resolutions, and also try the experience with touchscreen. Thanks again :)
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 21 Jan 2017, 16:34

vinnie wrote:P.s. uhm, fullscreen_resolution.ini accept only valid resolution? later I try with standard resolutions, and also try the experience with touchscreen. Thanks again :)
Yep, you should only specify valid fullscreen resolutions there, custom resolutions will not work. I'm pretty sure that's why it won't start in full screen for you, please try a standard resolution. Also, on a dual monitor setup, you can also specify a resolution which is a valid fullscreen resolution for your primary monitor, and it'll then correctly start full-screen visualized on that monitor. ;)

Glad to hear it's working for you via a projection device, looks cool! :)

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 22 Jan 2017, 13:22

Ok, I just tried to start the game by setting the ini content to 800x600 (This resolution surely works because I tried it yesterday)
Code: Select all
$ cat ./MTG-Forge-Mobile-Backport-20-jan-2017/fullscreen_resolution.ini
800x600
But the game always starts in a window with the current screen resolution (1280x800), it seems that the content of that file do not take effect.
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 22 Jan 2017, 13:49

Ah, OK, there was actually a bug with it not working correctly outside of a development environment, can you please retest with the current (reuploaded) version? It should work fine now (for fullscreen_resolution.ini resolution setup).

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 22 Jan 2017, 14:19

ok it works now, the resolution changes (only with standard, otherwise error).
If I put a lower resolution than my default, forge works full-screen even if the top bar of ubuntu always remains above, if I leave my resolution (1280x800) the behavior is always the same, with the forge window that remains off screen.

I ask if the next versions you compress better? I have an internet connection with limited volume :P
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 22 Jan 2017, 14:24

vinnie wrote:ok it works now, the resolution changes (only with standard, otherwise error).
If I put a lower resolution than my default, forge works full-screen even if the top bar of ubuntu always remains above, if I leave my resolution (1280x800) the behavior is always the same, with the forge window that remains off screen.

I ask if the next versions you compress better? I have an internet connection with limited volume :P
Yeah, it has to be a standard resolution supported by both your video card and your monitor, otherwise Forge will not be able to switch to it and will show you an error.

I'm not sure about the top bar and not sure why Forge remains off-screen at the default config though, most likely it's related to the way Unity handles things?.. Have you tried this new build on Xfce?

(For the record, I have no problem with this on both Cinnamon and Xfce).

And I can use .tar.xz for compression, yeah :) Not sure how much it'll change things though since the biggest files in Forge builds are music files which do not really compress well, if at all :/

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby vinnie » 22 Jan 2017, 15:20

Agetian wrote:I'm not sure about the top bar and not sure why Forge remains off-screen at the default config though, most likely it's related to the way Unity handles things?.. Have you tried this new build on Xfce?
I have not tried with xfce because it is on another hd, but xfce does not have a fixed bar on top as unity, then the behavior should always be the usual:
- for the same resolution of my desktop, a 1280x800 window positioned lower due to the presence of the decorator to his head that I have time to hide when forge loading (thanks to the "Window rules" of compiz that denies the minimization of the window)
- for lower resolution in .ini, full screen should work well without the window decorator on his head

Agetian wrote:(For the record, I have no problem with this on both Cinnamon and Xfce).
This is why at this point I think it is the fault of compiz which usually is not installed with xfce (which has its own composite manager), I don't know Cinnamon.

Agetian wrote:And I can use .tar.xz for compression, yeah :) Not sure how much it'll change things though since the biggest files in Forge builds are music files which do not really compress well, if at all :/
Then you could ship without music? I tried to compress with xz but the result is very similar (104 MB)


P.s. I tried another method that worked only partially:
1) I killed the X server with sudo service lightdm stop
2) I start forge with startx ./forge-mobile.sh
It works full-screen but no pointer appears and It does not work either the touch (not even the wacom digitizer) so I can only use keyboard commands.
I'm looking for some startx parameter to show a cursor but I can't find (damned scattered documentation)

P.P.s. ok I found the right argoument: "startx ./forge-mobile.sh -- -retro" :
1) man pages of startx says:
Code: Select all
"...The  special  argument  '--'  marks  the  end  of client arguments and the beginning of server options. ...consult the manual page for your X server to determine which arguments are legal..."
2)This is the command /usr/bin/startx starts, where $serverargs are the server arguments:
Code: Select all
xinit "$client" $clientargs -- "$server" $display $serverargs
3) In this page I found the involved argument https://x.cygwin.com/docs/man1/Xserver.1.html :
Code: Select all
-retro starts the server with the classic stipple and cursor visible. The default is to start with a black root window, and to suppress display of the cursor until the first time an application calls XDefineCursor(). For kdrive servers, this implies -zap.
it's not the best way to start forge-mobile in full screen, but for now is a good workaround
User avatar
vinnie
 
Posts: 104
Joined: 21 Dec 2015, 14:03
Has thanked: 23 times
Been thanked: 6 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 22 Jan 2017, 17:32

This is very interesting to know, thanks for the info! :) And sure thing, I'll create a separate package without music files as well then :)

As for Cinnamon, I think it uses a custom window manager called Muffin or something like that, so it doesn't utilize compiz. :)

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Re: [Proof of concept] Run mobile Forge full-screen on PC

Postby Agetian » 30 Jan 2017, 14:01

UPDATE (01/30/2017): For anyone interested in running Forge with mobile interface on desktop PCs (or non-Android Java-capable tablets, or touch-enabled laptops, etc.), I have updated the package in the first post to SVN r33503 (January 30, 2017 build). There's now also a separate package which is smaller but does not contain the "music" or most of the skins (except the default), you can unpack this package and copy the "music" and "skins" folders from your previous installation if you want to avoid downloading a bigger file.

- Agetian
Agetian
Programmer
 
Posts: 3336
Joined: 14 Mar 2011, 05:58
Has thanked: 638 times
Been thanked: 495 times

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 7 guests


Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 7 guests

Login Form