Jump to content
Eternal Lands Official Forums
bluap

Testing client ported to SDL2

Recommended Posts

I have a new version of the client available to test that is ported to use SDL2, version 2 of the Simple Direct Media layer.  There are lots of benefits from using this never version but the port has required a lot of changes. The handling of keyboard input as been totally rewritten so could do with some good testing.  One immediate change you will notice is that the client window is now resizeable and can be maximised like any normal window (needs SDL version 2.0.5 or higher).  You can also switch between full-screen and back on Windows as well as Linux without graphic glitches (this is possible because this no longer requires destroying the graphic context and hence lots of unload/reload of textures etc).

 

There are 32-bit and 64-bit zip packages packages for Windows.  These just contain the el.exe and dll files so save your original files before extracting into an existing install.

 

The snap (edge) and flatpak (develop) packages for Linux should already be using this version.  There is not yet a Linux static build as this needs major work too, but you can of course build from source.  You will need to install libsdl2-dev, libsdl2-net-dev and libsdl2-image-dev in additional to previous libraries.  I'd suggest using the CMake file.  I'll do some Ubuntu/Debian package builds ASAP.

 

The version string should show the UK date/time of the build (20191126.2321 or similar).  Please let me know how you get on with this test version.

Edited by bluap

Share this post


Link to post
Share on other sites

Thanks bluap.

I cloned the git repository and complied on Linux.  Compilation went well and I replaced my installation's el.x86_64.linux.bin with the newly compiled binary.

 

Here are my initial observations:

 

1) padsp is no longer required to enable sound. This avoids the  "alcOpenDevice(): Error initializing sound: ALC_NO_ERROR" message.

 

2) Keyboard is definitely buggy. I'm using an IBM Model M keyboard and my OS locale is set to en_US.UTF-8.  Sometimes when I first launch the client, the keys work fine but after a few seconds I get the following. Occasionally keyboard may start to work again.

  1. Function keys don't work
  2. Alt key combinations don't work and prints a character instead. For example alt-s prints the letter s.
    1. Alt-Enter always works to enter/exit fullscreen.
  3. Most Ctl key combinations don't work and no alphabet character is printed.
    1. Some punctuation characters do print when holding Ctl such as ' ; " : . < > ,.
    2. Ctl-<up arrow> and Ctl-<down arrow> always work.
  4. Shift key combinations work fine.

I'm happy to provide any additional info you need.

 

 

Share this post


Link to post
Share on other sites

Thanks for testing.  I've tried this on several machines, on Windows and Linux but not seen variable behaviour like that.  I've tried using alternative keyboard layouts which looks OK too.  Perhaps you could enable some debug and see if that could help us understand what is happening.  There are a few debug printf() statements in events.c that could be useful if uncommented.  Here's a patch:

$ git diff events.c
diff --git a/events.c b/events.c
index 417925c7..5ffa7deb 100644
--- a/events.c
+++ b/events.c
@@ -246,8 +246,8 @@ int HandleEvent (SDL_Event *event)
                                break;  //don't have focus, so we shouldn't be getting keystrokes
                        }
                        unicode = utf8_to_unicode(event->text.text);
-                       //printf("SDL_TEXTINPUT text=[%s] len=%lu,%lu timestamp=%u\n", (unsigned char *)event->text.text, sizeof(event->text.text), strlen(event->text.text), event->key.timestamp);
-                       //printf("UTF-8 udf8=(%x,%x) unicode=%x\n", event->text.text[0], event->text.text[1], unicode);
+                       printf("SDL_TEXTINPUT text=[%s] len=%lu,%lu timestamp=%u\n", (unsigned char *)event->text.text, sizeof(event->text.text), strlen(event->text.text), event->key.timestamp);
+                       printf("UTF-8 udf8=(%x,%x) unicode=%x\n", event->text.text[0], event->text.text[1], unicode);
                        if (unicode)
                        {
                                if ((last_SDL_KEYDOWN_timestamp != event->key.timestamp) || (last_SDL_KEYDOWN_return_value == -1))
@@ -262,10 +262,10 @@ int HandleEvent (SDL_Event *event)
                        if (afk_time) 
                                last_action_time = cur_time;    // Set the latest event... Don't let the modifiers ALT, CTRL and SHIFT change the state
                        cm_post_show_check(1); /* any keypress forces any context menu to close */
-                       //printf("SDL_KEYDOWN keycode=%u,[%s] mod=%u timestamp=%u\n", event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym), event->key.keysym.mod, event->key.timestamp);
+                       printf("SDL_KEYDOWN keycode=%u,[%s] mod=%u timestamp=%u\n", event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym), event->key.keysym.mod, event->key.timestamp);
                        last_SDL_KEYDOWN_timestamp = event->key.timestamp;
                        last_SDL_KEYDOWN_return_value = keypress_in_windows (mouse_x, mouse_y, event->key.keysym.sym, 0, event->key.keysym.mod);
-                       //printf("SDL_KEYDOWN result=%d\n", last_SDL_KEYDOWN_return_value);
+                       printf("SDL_KEYDOWN result=%d\n", last_SDL_KEYDOWN_return_value);
                        break;
 
                case SDL_QUIT:

 

Edited by bluap

Share this post


Link to post
Share on other sites

Here is the output from the following sequence of keypresses:

a - prints "a" to console
alt-s - prints "s" to console
f1 4 times - toggled console, worked fine this time.
ctl-e
shift-a -  prints "A" to console
ctl-H

alt-x  - game didn't exit


SDL_KEYDOWN keycode=97,[A] mod=4096 timestamp=10848
SDL_KEYDOWN result=-1
SDL_TEXTINPUT text=[a] len=32,1 timestamp=10848
UTF-8 udf8=(61,0) unicode=61
SDL_KEYDOWN keycode=1073742050,[Left Alt] mod=4352 timestamp=18768
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=115, mod=4352 timestamp=19135
SDL_KEYDOWN result=-1
SDL_TEXTINPUT text= len=32,1 timestamp=19135
UTF-8 udf8=(73,0) unicode=73
SDL_KEYDOWN keycode=1073741882,[F1] mod=0 timestamp=32640
SDL_KEYDOWN result=1
SDL_KEYDOWN keycode=1073741882,[F1] mod=0 timestamp=35152
SDL_KEYDOWN result=2
SDL_KEYDOWN keycode=1073741882,[F1] mod=0 timestamp=36495
SDL_KEYDOWN result=1
SDL_KEYDOWN keycode=1073741882,[F1] mod=0 timestamp=36982
SDL_KEYDOWN result=2
SDL_KEYDOWN keycode=101,[E] mod=0 timestamp=91375
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=1073742049,[Left Shift] mod=4097 timestamp=179504
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=97,[A] mod=4097 timestamp=180000
SDL_KEYDOWN result=-1
SDL_TEXTINPUT text=[A] len=32,1 timestamp=180000
UTF-8 udf8=(41,0) unicode=41
SDL_KEYDOWN keycode=1073742048,[Left Ctrl] mod=64 timestamp=193472
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=104,[H] mod=64 timestamp=193760
SDL_KEYDOWN result=1

SDL_KEYDOWN keycode=1073742050,[Left Alt] mod=4352 timestamp=371520
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=115, mod=4352 timestamp=371792
SDL_KEYDOWN result=-1
SDL_TEXTINPUT text= len=32,1 timestamp=371792
UTF-8 udf8=(73,0) unicode=73

SDL_KEYDOWN keycode=1073742050,[Left Alt] mod=4352 timestamp=440239
SDL_KEYDOWN result=-1
SDL_KEYDOWN keycode=120,[X] mod=4352 timestamp=440817
SDL_KEYDOWN result=-1
SDL_TEXTINPUT text=[x] len=32,1 timestamp=440817
UTF-8 udf8=(78,0) unicode=78

Edited by Nogrod

Share this post


Link to post
Share on other sites

Noticing that I have mod=4096 (Numlock) on in most of my output, I disabled Numlock.  Everything works well with Numlock off.

 

I also noticed that when Numlock is ON but keyboard combinations are working, 0x1000 (4096) is not part of my key.keysym.mod value.

Share this post


Link to post
Share on other sites

That's really useful, thank you Nogrod.  It looks like numlock is the issue an I can reproduce the problem with my own set-up too.  During development, I checked that it worked as a numlock but do not have it enabled normally.  I'll take a look and produce a new build with a fix which.  This will not be until the weekend unfortunately due to work commitments.  If it's possible to continue using the current version with numlock off until then, great.  Thanks again.

Share this post


Link to post
Share on other sites

I've committed a fix to git for the num lock issue.  The same problem also happened for caps lock so that's fixed too.  I've also fixed a problem with the password manger not moving/resizing when its open and the main window is resized. I've updated the windows zip packages (at the same link) with new builds and rebuilt the flatpak and snap packages.  The later in progress as I type this.  The version number will be dated 20191129.23xx.  If you are testing then please download and update, carry on testing and let me know how you get on.  Thanks.

Edited by bluap

Share this post


Link to post
Share on other sites

The arrows to move camera right left, up and down has a delay. In older version, if you push an arrow from keyboard, it directly makes camera moving and keeps moving as long as you hold. But in the new version, it moves a little bit, delays, and then keeps moving.

 

This is the only difference so far I've found.

 

Kaddy

Share this post


Link to post
Share on other sites
2 hours ago, Kaddy said:

The arrows to move camera right left, up and down has a delay. In older version, if you push an arrow from keyboard, it directly makes camera moving and keeps moving as long as you hold. But in the new version, it moves a little bit, delays, and then keeps moving.

 

This is the only difference so far I've found.

 

Kaddy

The function to modify the keyboard repeat rate has been removed from SDL2, instead, as far as I can tell, it uses the OS set rate.  I've tried this on my Linux/Gnome desktop and it has the desired effect in the client.  I'm not sure how else to reproduce the previous behaviour.

 

The other items you mentioned in-game.  I've not see any random game freezes so that's going to be hard to investigate.  I've looked at the old/new behaviour for switching windows and clicks/key-presses being actioned and I cannot see any differences.  I've lost the chat we had as my chat log was set read-only (from some time ago when I was help debug a problem someone else was having - probably need a visible warning about that), so perhaps you can give more more details on what you are seeing. P.S. Thanks again for testing.

Edited by bluap

Share this post


Link to post
Share on other sites

The active client thing.

 

Let's say I have 2 clients open, 1 is active the other one can be still seen in the desktop view. When I click to some places to move in secondary client, I have to click twice - first for making the client active, then to walk I guess...

 

For people who uses a few clients at the same time, it makes you lose some time and click. I tank with 1 char and have FA with the other client, when the fa is destroyed, I have to click fire arrow 3 times, 1- to make client active, and then double click to wear.

 

I hope it was helpful to make you understand.

 

if it's still not clear, I'll make a video showing the difference.

 

I updated my graphic card today after our chat and switched back to september build (the used item counter one). Arrow thing is much faster (as you said, it's OS-rate at new client  I guess, I don't know how to change tho), and click thing is as I mentioned above. I will check the freezing, delay thing and let you know.

 

Kaddy

Share this post


Link to post
Share on other sites
8 hours ago, Kaddy said:

The active client thing.

Thanks, that make perfect sense.  This behaviour is already enabled for my Linux desktop but not for my Windows test machine.  However, adding use of SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH does the trick so I'll include that with the next build.  Note that this HINT is only available for SLD 2.0.5 and above so if the window resizing does not work for someone, this will not work either.  From what I remember of of our in-game chat Kaddy, you should be fine.

Share this post


Link to post
Share on other sites

All the builds have been updated and should now show a version date of 20191201.02xx .  There are now Detian and Ubuntu packages available in addition to Snap and Flatpak.  The click through behaviour should work and I've added some error trapping and reporting to help debug elsewhere.

Edited by bluap

Share this post


Link to post
Share on other sites
4 hours ago, bluap said:

Thanks, that make perfect sense.  This behaviour is already enabled for my Linux desktop but not for my Windows test machine.  However, adding use of SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH does the trick so I'll include that with the next build.  Note that this HINT is only available for SLD 2.0.5 and above so if the window resizing does not work for someone, this will not work either.  From what I remember of of our in-game chat Kaddy, you should be fine.

 

It works perfectly fine now, thanks!

 

And I have figured out that the delays are because of my connection. Those happened with older builds aswell so I'm sure it's not something related with the new one.

 

Kaddy

Share this post


Link to post
Share on other sites
7 hours ago, Kaddy said:

 

It works perfectly fine now, thanks!

 

And I have figured out that the delays are because of my connection. Those happened with older builds aswell so I'm sure it's not something related with the new one.

 

Kaddy

Good news, thanks Kaddy.

Share this post


Link to post
Share on other sites

Another build with all the packages updated.  Mainly updating to get the map editor working again but also adding use of the keypad Enter key anywhere the normal RETURN key can be used.  Thanks shadowgate for testing and letting me know of the issue.

Share this post


Link to post
Share on other sites

Updated builds.  Window is now resizeable on all versions of SDL2.  Not related to this port, I also fixed a possible crash and definite memory leak in the handling of AFK messages.

Share this post


Link to post
Share on other sites

Updated builds again.  Fixed scene not redrawing after window resize.  Fixed some errors during initial windows creation and added lots more checking and reporting of errors.  Lots of code clean-ups.

Share this post


Link to post
Share on other sites

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

×