Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error run in linux OS,No X11 DISPLAY variable was set #42

Open
makexiao113 opened this issue May 18, 2023 · 2 comments
Open

error run in linux OS,No X11 DISPLAY variable was set #42

makexiao113 opened this issue May 18, 2023 · 2 comments

Comments

@makexiao113
Copy link

image

what should i do?
i add export DISPLAY=0.0 in /etc/profile but not working

i run java -jar desktop-1.0.jar
image
How can i fix this? thanks

@Retera
Copy link
Owner

Retera commented May 18, 2023

I am guessing this is not a WarsmashModEngine specific issue, but rather an issue with the Java configuration on your specific platform. According to something from StackOverflow (https://stackoverflow.com/questions/5362512/unable-to-run-java-gui-programs-with-ubuntu):

Ubuntu has the option to install a headless Java -- this means without graphics libraries.

When we use java for the WarsmashModEngine, it is necessary to install a version of java that does have the graphics libraries.

Last time I used Ubuntu, the OpenJDK version 17 that is installed by the apt package manager was a broken version that did not work properly -- even after switching from the headless version that you have (which will never work because it has no graphics support) to one that supports graphics. So I manually downloaded some other version to a folder and had to do a bunch of setup. It seems like this was all much easier on Java 8, because the off-the-shelf Java on version linux distros for Java 8 might have been better supported, but about a year ago someone convinced me to move to Java 17 instead. Almost nothing in Warsmash actually requires Java 17 other than the build logic, so it is potentially conceivable that you could change the build logic back to Java 8 and try that if you really wanted to, although it would be a pain.

So, anyway, Warsmash in 2020-2021 worked better on linux because it was on Java 8. Maybe you could use git to checkout an older version of Warsmash and try that as a starting point.

@Retera
Copy link
Owner

Retera commented May 18, 2023

Thinking back on it, the last time I played Warsmash on Linux was in January, and here was what I used:

  • Hardware:
    • a $25 surplus HP computer tower from a surplus store that had no graphics card, only Intel Integrated Graphics

    • A 4k samsung monitor but in order to get 60 fps smooth gameplay without a GPU, I adjusted the resolution to 1920x1080

  • Software:
    • An installation of CentOS 7 on a spinning disk hard drive (not an SSD)
    • For Java, the package manager java was having problems so I used an Eclipse Temurin build (https://projects.eclipse.org/projects/adoptium.temurin/downloads). The reason I had to use the Temurin build was probably LWJGL2. If you go and create a new LibGDX game today using the LibGDX project generator (which is how Warsmash started) then today it will generate with LWJGL3 probably. But Warsmash is a little older now and uses LWJGL2. Between LWJGL2 and the Java installations from the normal linux package manager, there is a conflict. This conflict causes some non-Java error at the C level, like a segmentation violation that is difficult to track down the cause for, if I recall, because LWJGL is not pure Java and includes C++ bindings to talk to OpenGL (that's its main purpose). So that's why although ideally Java is an open standard and we could use any Java runtime for this, I was only having success with Eclipse Temurin lately because they somehow play nicely with the older LWJGL2. At some point if someone ports Warsmash to LWJGL3 then this problem might go away.
    • To run Warsmash after cloning this repo, I used something like JAVA_HOME=~/Downloads/myTemurinFolder/jdk17/bin or something as a prefix to the gradle command, so the full command line was like JAVA_HOME=~/Downloads/myTemurinFolder/jdk17/bin ./gradlew runGame
    • If you run the above command, you're going to see some nondescript Java exception from Warsmash about not finding Warcraft III or its files, probably. So then this is where I would vim ./core/assets/warsmash.ini in the Warsmash repo that you're trying to run gradlew from, and edit the warsmash.ini to update it. The one in the repo is bad and is missing some stuff, so you want to have the following in there (assuming you have Warcraft3 downloaded to ~/Games/Warcraft3 ):
[DataSources]
Count=7
Type00=MPQ
Path00="~/Games/Warcraft3/war3.mpq"
Type01=MPQ
Path01="~/Games/Warcraft3/War3x.mpq"
Type02=MPQ
Path02="~/Games/Warcraft3/War3xlocal.mpq"
Type03=MPQ
Path03="~/Games/Warcraft3/War3Patch.mpq"
Type04=Folder
Path04="../../resources"
Type05=Folder
Path05="~/Games/Warcraft3/Maps"
Type06=Folder
Path06="~/Games/Warcraft3/"

[GamingNetwork]
Server=warsmash.net

[Emulator]
// Player settings: use 28 for the "24 player" patches,
// and use 16 for the "12 player" patches, because
// this constant includes Neutrals
MaxPlayers=16

// Game version:
//  0: RoC (not well supported)
//  1: TFT (very supported)
//  2: some code comment says this could be used for mods, but don't for now
GameVersion=0

// Catch cursor -- eventually this should probably be decided based on windowed mode
CatchCursor=1

// My tileset loader is "always on top", even for local files. This is different
// from some MPQ loader engines that would use
// load index as a numeric value and could be changed. For now, I have this
// workaround to fix it if you need the local files
// to take priority over built-ins for tilesets.
FixFlatFilesTilesetLoading=0

EnableMusic=1

// This setting, if turned back on, might cause us to load
// ingame units based on the map editor data instead of loading
// based on the map script. It is not well tested, and is always
// left off lately.
LoadUnitsFromWorldEditData=0

// Does nothing for now
CrashOnIncompatible132Features=0

// Hotkey mode:
//  0: hotkey data from the map editor or game units
//  1: hotkey is forced to use QWER/ASDF/ZXCV grid
InputHotkeyMode=1

// If you need the model loader to accept RoC Beta assets, you can use this,
// however this only changes MDX parsing and not BLP0 parsing so the BLP0 parsing
// would most likely fail unless you're using flat files. So in practice, I was
// using RoC Beta MDX assets with TFT format converted textures while activating
// this setting, meaning that it probably won't work for you unless you know
// what you're doing.
ParseReignOfChaosBetaModelsInstead=0

The above INI file should probably work for Warcraft III patch 1.22 up through 1.28. If you are using Warcraft III patch 1.29 or afterward, once the Reforged team started to substantially move around game files, you will need to tweak the settings. Info on that can be found elsewhere, but as a general rule:

  • Patch 1.29: remove the war3patch.mpq entry from the list of data sources, and change max players from 16 to 28 (adds 12 players)
  • Patch 1.30 or 1.31: use a folder data source instead of MPQ, and extract everything first using CascView because Warsmash can't process the older CASC data from these patches (also change players to 28 for this version as well)
  • Patch 1.32.6ish or below: same as above
  • Patch 1.32 newer versions, like 1.32.10: for these you can use CASC directly, as described on Hive Workshop on the Warsmash forum setup page (https://www.hiveworkshop.com/threads/overview-and-setup.331776/). Also, these need 28 players also
  • Patch 1.33, 1.34, 1.35, or 1.36: These are not supported by Warsmash at this time. If you want to use them, you would have to do a code change by going to twilac's fork of Retera Model Studio where she has probably updated the MDX parser there to load data from these patches, and that parser code was originally copied from the Warsmash parser so you can probably copy it back into Warsmash again to instantly gain the upgrade, even though I didn't feel like doing that yet and didn't do that yet in this repo here.

By following all of these steps, I was able to play Warsmash and build a Night Elf base on the CentOS 7 machine with no graphics card, and I was getting close to 60 FPS on the Intel Integrated Graphics with a smooth looking visual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants