libsdl-org / sdl12-compat

An SDL-1.2 compatibility layer that uses SDL 2.0 behind the scenes.
Other
196 stars 40 forks source link

Alpha Centauri - Animation performance issue #277

Open vv221 opened 1 year ago

vv221 commented 1 year ago

Alpha Centauri used to be provided with a native engine developed by Loki, that can still be used with ./play.it (using the game build sold on GOG as a basis): https://www.dotslashplay.it/en/games/alpha-centauri

One of the differences I noticed when using the sdl12-compat wrapper instead of real SDL 1.2 is that the initial animation of the pod landing is very sluggish, while it is smooth with the old SDL 1.2 library.

Since this would require access to a commercial game for investigating the issue, I would be OK to buy a gift code to someone willing to work on this issue but does not own a copy of the game yet.

I am of course willing to provide more information, but since I’m quite new to anything related to SDL I would need step-by-step instructions on how to debug the issue.

icculus commented 1 year ago

I have a copy of Loki's Alpha Centauri somewhere, so I can look into this.

vv221 commented 1 year ago

The build I tested has a slight difference with the out-of-the-box Loki version: to avoid the requirement on old compatibility libraries, a small shim is preloaded that allows it to run on top of current libraries.

The game is run from the dynamic binaries (smac.dynamic), not the static ones,

Here is a copy of the shim:

#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>

void *__builtin_new(size_t size)
{
    return malloc(size);
}

void __builtin_delete(void *ptr)
{
    free(ptr);
}

void *__builtin_vec_new(size_t size)
{
    return malloc(size);
}

void __builtin_vec_delete(void *ptr)
{
    free(ptr);
}

And its source: https://github.com/ZeroPointEnergy/smacshim

vv221 commented 1 year ago

Extra detail that might be useful: I am running the game on an up-to-date Debian Sid, providing sdl12-compat 1.2.60 and SDL 2 2.26.0.

icculus commented 1 year ago

Did this get fixed by #278 or #279?

vv221 commented 1 year ago

Did this get fixed by https://github.com/libsdl-org/sdl12-compat/issues/278 or https://github.com/libsdl-org/sdl12-compat/issues/279?

No, I still get sluggish animation for the initial pod landing when building from the current HEAD of main (commit b2f7b7736b4adaba2805e5d2979c51676ee950ce).

I suspect it might be an issue with all animations, but is noticeable only with this one because other animations in this game are very short.