Jump to content

Is it possible to run OpenJK in 320x240?


Recommended Posts

Posted

Hey, so Im currently working on a project to get OpenJK running on a device with a small screen. It appears that the smallest window resolution that is supported is 640x480, but the screen I am planning on using is only 320x240. I am guessing that I might need to turn off the Hud at a resolution that small, but I am not entirely sure if I need to modify anything in the source as well?

Posted

I think a lot of the ui elements are drawn based on a 640x480 size and then scaled up to fit the specified resolution, I don't think was built to scale down.  So my guess is it'll probably break, but you can try it.

BruceJohnJenner and Smoo like this

JKG Developer

Posted

You can try forcing it with r_customWidth and r_customHeight.  Not sure I would recommend playing at such a small screen size but heh.

Are those Cvars or command line arguments?

Posted

Well what architecture is it?

I was hoping I could get this working on my own as a surprise, but that probably isn't going to happen now  :rolleyes: 

 

The platform is a raspberry pi B+ with a 320x240 touchscreen from adafruit called a Pitft

 

rr5dVTI.jpg

 

The Pitft normally would be useless for this, as it doesnt normally have access to the GPU, but I followed the instructions here

 

https://learn.adafruit.com/running-opengl-based-games-and-emulators-on-adafruit-pitft-displays/overview

 

which basically trick the HDMI output into displaying on the Pitft. I dont know much about the specifics of how it works, but it does work with RetroPie (a RaspberryPi gaming distro) for running Quake III Arena, which you can see above.

 

I did the basic setup described in the guide, and got everything working, then cloned OpenJK. I originally tried to follow the install steps that @@capturesteve used here , but libjpeg8-dev couldnt install because of dependency issues. I figured the project was done at that point, but when I ran cmake, it appeared to find all of the dependencies that it needed (including libjpeg oddly...) I ran make -j2

, then make install, which took the better part of a day to compile.

 

I tried running it off of the command line first, which failed, not too surprising since I figure OpenJK requires SDL, which in turn needs to talk to something like the X server to create/manage windows audio, whatever. I then tried to run it from the RetroPie EmulationStation, and I get this before it segfaults,

 

 

tty]    OpenJK: v1.0.1.1 linux-arm Mar 21 2016
tty]    Initialising zone memory .....
tty]    ----- FS_Startup -----
tty]    Current search path:
tty]    /home/pi/.local/share/openjk/base
tty]    ./base/assets3.pk3 (16 files)
tty]    ./base/assets2.pk3 (62 files)
tty]    ./base/assets1.pk3 (8320 files)
tty]    ./base/assets0.pk3 (15346 files)
tty]    ./base
tty]    
tty]    ----------------------
tty]    23744 files in pk3 files
tty]    execing default.cfg
tty]    execing openjk_sp.cfg
tty]    couldn't exec autoexec_sp.cfg
tty]    Running Jedi Academy Mode
tty]    ----- Client Initialization -----
tty]    ----- Initializing Renderer ----
tty]    Trying to load "rdsp-vanilla_arm.so" from "."...
tty]    -------------------------------
tty]    ----- Client Initialization Complete -----
tty]    --- Common Initialization Complete ---
tty]    SDL using driver "RPI"
tty]    Initializing display
tty]    Display aspect: 1.333
tty]    ...setting mode 4: 800 600
tty]    Using 24 color bits, 24 depth, 8 stencil display.
tty]    Available modes: '320x240'
tty]    Initializing OpenGL extensions
tty]

The last part when it segfaults doesnt get caught by my log file for some reason, so I took a screenshot of what happens:

 

1MSgogb.jpg

Smoo, Cerez and Xycaleth like this
Posted

By default JKA will start up with r_mode 4 (and it will also try to fall-back to this mode if it can't create a window). From what I can see though, the only available mode is '320x240' which would be mode 0. Perhaps you can try setting the mode on the command line? Something like this:

./openjk.arm +set r_mode 0
I guess this is a corner case which hasn't been encountered yet.
Posted

By default JKA will start up with r_mode 4 (and it will also try to fall-back to this mode if it can't create a window). From what I can see though, the only available mode is '320x240' which would be mode 0. Perhaps you can try setting the mode on the command line? Something like this:

./openjk.arm +set r_mode 0
I guess this is a corner case which hasn't been encountered yet.

 

 

Gave that a try, it did seem to choose the correct resolution this time, but it still crashes. I think it might be an issue with the openGL extensions,

 

 

tty]    OpenJK: v1.0.1.1 linux-arm Mar 21 2016
tty]    Initialising zone memory .....
tty]    ----- FS_Startup -----
tty]    Current search path:
tty]    /home/pi/.local/share/openjk/base
tty]    ./base/assets3.pk3 (16 files)
tty]    ./base/assets2.pk3 (62 files)
tty]    ./base/assets1.pk3 (8320 files)
tty]    ./base/assets0.pk3 (15346 files)
tty]    ./base
tty]    
tty]    ----------------------
tty]    23744 files in pk3 files
tty]    execing default.cfg
tty]    execing openjk_sp.cfg
tty]    couldn't exec autoexec_sp.cfg
tty]    Running Jedi Academy Mode
tty]    ----- Client Initialization -----
tty]    ----- Initializing Renderer ----
tty]    Trying to load "rdsp-vanilla_arm.so" from "."...
tty]    -------------------------------
tty]    ----- Client Initialization Complete -----
tty]    --- Common Initialization Complete ---
tty]    SDL using driver "RPI"
tty]    Initializing display
tty]    Display aspect: 1.333
tty]    ...setting mode 0: 320 240
tty]    Using 24 color bits, 24 depth, 8 stencil display.
tty]    Available modes: '320x240'
tty]    Initializing OpenGL extensions
tty]

Does it support Open Gl?  I know by default it isn't turned on for Raspberry Pi.

I just checked that, yeah, I think you're right. I ran raspi-config and tried to initialize OpenGL, but the dialogue told me it was only available on the pi2 (and up now :) ). I guess the native Quake III port that comes with RetroPie must rely on OpenGL ES that the Pi was originally equipped with. Next step, I guess I'll have to retrieve my Pi2 from home and work through the whole damn process again.

 

The thing that was odd though (and might be worth a look for you) cmake did not see any issue with finding OpenGL, I saved the output of cmake .. to a text file:

 

 

-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
-- Found JPEG: /usr/lib/arm-linux-gnueabihf/libjpeg.so  
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.8") 
-- Found PNG: /usr/lib/arm-linux-gnueabihf/libpng.so (found version "1.2.50") 
-- Looking for XOpenDisplay in /usr/lib/arm-linux-gnueabihf/libX11.so;/usr/lib/arm-linux-gnueabihf/libXext.so
-- Looking for XOpenDisplay in /usr/lib/arm-linux-gnueabihf/libX11.so;/usr/lib/arm-linux-gnueabihf/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/arm-linux-gnueabihf/libX11.so
-- Found OpenGL: /usr/lib/arm-linux-gnueabihf/libGL.so  
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found SDL2: /usr/lib/arm-linux-gnueabihf/libSDL2main.a;/usr/lib/arm-linux-gnueabihf/libSDL2.so;-lpthread  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/dev/OpenJK/buildcheck

Which seemed really weird that apt wouldn't allow me to install dependencies like libjpeg8-dev, but cmake thinks everything is A-OK for compilation?

  • 2 weeks later...
Posted

 

 

The thing that was odd though (and might be worth a look for you) cmake did not see any issue with finding OpenGL, I saved the output of cmake .. to a text file:

Sorry I don't know a ton of stuff about the Raspberry Pi, but just as a haphazardly guess, possibly opengl is installed, but not enabled?

BruceJohnJenner likes this

JKG Developer

Posted

Sorry I don't know a ton of stuff about the Raspberry Pi, but just as a haphazardly guess, possibly opengl is installed, but not enabled?

 

I did the whole thing all over again from scratch on the Pi 2, unfortunately it looks like the drivers for the new (experimental) OpenGL support might conflict with the device tree that adafruit installs to make the PiTFT screen work. Im not 100% sure on that, but I doubt I'll be able to make it work with this screen. As far as I can tell, OpenJK is looking at the library for OpenGL ES (/usr/lib/arm-linux-gnueabihf/libGL.so) and thinking that its a full OpenGL when its not, hence the crashes.

 

 

On the bright side, I can confirm that openjkded server does run properly on the Raspberry Pi 2. I connected the Pi to a router, connected a desktop to the network, scanned for the Pis IP, then connected using connect [iP], and mp/ffa1 worked flawlessly. @@capturesteve, maybe give the repo another pull, and try again?

 

 

I did a bit more digging and realized that the Quake3 port they have running (https://github.com/raspberrypi/quake3) was specifically ported for the RaspberryPi (I think they set a bounty for it a few years ago), and it almost undoubtedly uses OpenGL ES (presumably with some features ripped out of the renderer to accommodate this). @@mrwonko, I know writing that ES renderer isnt a top priority, but if you can ever get it done, I would really be excited for the chance to get this running.

 

 

Posted

Raspberry Pi Master Race !

 

r_mode -1

r_customWidth 320

r_customHeight 240

doesnot work ?

The resolution itself isnt the problem, when I run it without those commands the program correctly detects that it needs to run in 320x240 resolution (I can see it in the console output). The real issue is that the Raspberry Pi only really has proper support for OpenGL ES (a reduced version of OpenGL for embedded systems). OpenJK does not yet have an OpenGL ES renderer, although it is possible to create one, it probably wont happen any time soon.

 

The most recent version of Raspbian can apparently use full OpenGL on the Raspberry Pi 2, but the driver is said to be very buggy and unstable, and it doesnt work on my system at any rate.

Posted

Well, I cant believe it, but it almost works:

JS1jlcS.jpg

huMO7SW.jpg

8x73DEF.jpg


iKgIy8t.jpg

 

I converted the existing system with OpenJK running properly to the Pitft touchscreen, but the OpenGL support does not work quite right (verified by glxgears and this). The menu and the game overall are super laggy, probably something like 2-3 fps at best, but I was able to load mp/ffa5 and run around a bit. As mentioned, the game runs super slow, but its just fast enough that I can navigate through the map and explore somewhat. You can see in the final screenshot that the skybox doesnt render at all, instead we just see what we get when we look into the void. (ie out of a visually leaked wall in the map)

Most of the settings are as low as they will go, but I was wondering if theres any way to squeeze just a few more fps up to 10 to make this barely playable?
 

Raz0r, Futuza and Exmirai like this

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...