• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Crash on high quality .APNG render for login screen

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,470
Solutions
27
Reaction score
844
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi again! I know this shouldn't work, but I did the try anyways. I'm doing a new desing for login screen, with an animated background in animated png format. The thing is, I had success doing it with a low-res .apng, so I thought, what if I try with high res?.

For this, I rendered a gif directly from After Effects (613 MB), then, converted it to .apng with gif2apng 1.9 converter.
apng_convert.png

The result was .apng render on 1920X1080 resolution that weights 418 MB. At this point I thought, oh, this will work? 🤔 But I replaced the background.png on my otclient folder and encountered this crash after running otclient as administrator.

Code:
== application crashed
app name: OTClient
app version:
build compiler: Visual Studio
build date: Apr  3 2021
build type:
build revision:  ()
crash date: Apr 04 2021 18:47:43
exception: Access violation (0xc0000005)
exception address: 0x91c9163e
  backtrace:
    0: C:\WINDOWS\SYSTEM32\VCRUNTIME140.dll(memcpy+0x34e) [0x0000000091C9163E]
    1: C:\otclient-master\otclient.exe(load_apng+0x74f) [0x0000000058D66B8F]
    2: C:\otclient-master\otclient.exe(TextureManager::loadTexture+0x46) [0x0000000058D79A26]
    3: C:\otclient-master\otclient.exe(TextureManager::getTexture+0x746) [0x0000000058D79756]
    4: C:\otclient-master\otclient.exe(UIWidget::setImageSource+0x38) [0x0000000058E32678]
    5: C:\otclient-master\otclient.exe(UIWidget::parseImageStyle+0x1a3) [0x0000000058E2FAF3]
    6: C:\otclient-master\otclient.exe(UIWidget::onStyleApply+0x155) [0x0000000058E27155]
    7: C:\otclient-master\otclient.exe(UIWidget::applyStyle+0xc29) [0x0000000058E21629]
    8: C:\otclient-master\otclient.exe(UIManager::createWidgetFromOTML+0x4d3) [0x0000000058E16BB3]
    9: C:\otclient-master\otclient.exe(UIManager::loadUI+0x2dd) [0x0000000058E164ED]
    10: C:\otclient-master\otclient.exe(UIManager::displayUI+0x2e) [0x0000000058D8D73E]
    11: C:\otclient-master\otclient.exe(std::_Func_impl_no_alloc<<lambda_95199f703e6230eb45fa87dfc103ab18>,stdext::shared_object_ptr<Creature> >::_Do_call+0x1c) [0x0000000058CEE3DC]
    12: C:\otclient-master\otclient.exe(<lambda_9151dcba4a0b7dd2c0429c11d8f72c8d>::operator()+0x103) [0x0000000058CC3693]
    13: C:\otclient-master\otclient.exe(LuaInterface::luaCppFunctionCallback+0x7f) [0x0000000058D8446F]
    14: C:\otclient-master\lua51.dll(vsnprintf_c_l+0x2a14) [0x0000000083F74C43]
    15: C:\otclient-master\lua51.dll(vsnprintf_c_l+0xbcc6) [0x0000000083F7DEF5]
    16: C:\otclient-master\otclient.exe(LuaInterface::safeCall+0x144) [0x0000000058D83254]
    17: C:\otclient-master\otclient.exe(Module::load+0x364) [0x0000000058D5BF64]
    18: C:\otclient-master\otclient.exe(Module::load+0x5c0) [0x0000000058D5C1C0]
    19: C:\otclient-master\otclient.exe(ModuleManager::ensureModuleLoaded+0x43) [0x0000000058D5EFF3]
    20: C:\otclient-master\otclient.exe(std::_Func_impl_no_alloc<<lambda_b5358308c973b31c20eff47c62c4f823>,int,LuaInterface *>::_Do_call+0xfe) [0x0000000058CF958E]
    21: C:\otclient-master\otclient.exe(LuaInterface::luaCppFunctionCallback+0x7f) [0x0000000058D8446F]
    22: C:\otclient-master\lua51.dll(vsnprintf_c_l+0x2a14) [0x0000000083F74C43]
    23: C:\otclient-master\lua51.dll(vsnprintf_c_l+0xbcc6) [0x0000000083F7DEF5]
    24: C:\otclient-master\otclient.exe(LuaInterface::safeCall+0x144) [0x0000000058D83254]
    25: C:\otclient-master\otclient.exe(LuaInterface::safeRunScript+0x3c) [0x0000000058D81D2C]
    26: C:\otclient-master\otclient.exe(main+0x585) [0x0000000058E3C965]
    27: C:\otclient-master\otclient.exe(__scrt_common_main_seh+0x10c) [0x0000000058E3CE54]
    28: C:\WINDOWS\System32\KERNEL32.DLL(BaseThreadInitThunk+0x14) [0x00000000A9E67034]
    29: C:\WINDOWS\SYSTEM32\ntdll.dll(RtlUserThreadStart+0x21) [0x00000000ABD62651]

I open this thread looking for help. What is this crash about? Is there a possibility to change the sources to allow this render in log-in screen?. I read you guys, and as always, thanks in advance!
 
Solution
Thanks @Gesior.pl I learned from this! Never thoguth 1920 x 1080 x NUMBER_OF_FRAMES x 4 (4 bytes per pixel). was actually the RAM ussage. I'm starting to compress, again, the .apng in this website if that one does not work i'll try another, but the best thing is to ask. What I should do with the render? Directly convert from H264 instead of GIF, compressing it more? Please guide me! You're the one who knows :cool:
Basic animation player (apng - animated PNG) included in OTClient keeps all data in RAM. It's impossible to play "movie" in client. There is no support for formats like H264 etc. which load frames over time with X seconds buffer (so it stores only next 100-150 frames of animation in RAM).
I saw 'apng'...
It is 418 MB in compressed format. How much it takes as pure images? 1920 x 1080 x NUMBER_OF_FRAMES x 4 (4 bytes per pixel).
Maybe it takes 3 or 5 GB ram and crashes because of 'not enough RAM' or you use 32 bit OTClient with 2.6 GB RAM allocation limit.
 
It is 418 MB in compressed format. How much it takes as pure images? 1920 x 1080 x NUMBER_OF_FRAMES x 4 (4 bytes per pixel).
Maybe it takes 3 or 5 GB ram and crashes because of 'not enough RAM' or you use 32 bit OTClient with 2.6 GB RAM allocation limit.

Thanks @Gesior.pl I learned from this! Never thoguth 1920 x 1080 x NUMBER_OF_FRAMES x 4 (4 bytes per pixel). was actually the RAM ussage. I'm starting to compress, again, the .apng in this website if that one does not work i'll try another, but the best thing is to ask. What I should do with the render? Directly convert from H264 instead of GIF, compressing it more? Please guide me! You're the one who knows :cool:

Also, is resolution and FPS a problem? How many FPS does the image should have to run the more smooth as possible, and which resolution is recommended considering I tested an run the client in a 1920X1080 monitor?
 
Thanks @Gesior.pl I learned from this! Never thoguth 1920 x 1080 x NUMBER_OF_FRAMES x 4 (4 bytes per pixel). was actually the RAM ussage. I'm starting to compress, again, the .apng in this website if that one does not work i'll try another, but the best thing is to ask. What I should do with the render? Directly convert from H264 instead of GIF, compressing it more? Please guide me! You're the one who knows :cool:
Basic animation player (apng - animated PNG) included in OTClient keeps all data in RAM. It's impossible to play "movie" in client. There is no support for formats like H264 etc. which load frames over time with X seconds buffer (so it stores only next 100-150 frames of animation in RAM).
I saw 'apng' library in code, but I didn't even know it's possible to use APNG in client. I though it only loads PNG images using that library.
Also, is resolution and FPS a problem? How many FPS does the image should have to run the more smooth as possible, and which resolution is recommended considering I tested an run the client in a 1920X1080 monitor?
ONE HD1080 frame is 8MB of RAM. To make animation smooth, you need 15-25 FPS.. 120-200MB RAM per second of animation. Animation must be short (1-2 seconds) or has low resolution like 64x64 px. OTClient was not designed to play movies. Many game clients (like LoL) has functions to play movies (H263/H264) with low RAM usage (keep only few frames in RAM), but OTC does not.
 
Last edited:
Solution
It's impossible to play "movie" in client. There is no support for formats like H264 etc. which load frames over time with X seconds buffer (so it stores only next 100-150 frames of animation in RAM).
Many game clients (like LoL) has functions to play movies (H263/H264) with low RAM usage (keep only few frames in RAM), but OTC does not.
This is very intresting I would love to know more about this and eventually do it 🙄
ONE HD1080 frame is 8MB of RAM. To make animation smooth, you need 15-25 FPS.. 120-200MB RAM per second of animation. Animation must be short (1-2 seconds) or has low resolution like 64x64 px.
This solves the thread! @Gesior.pl once again, thanks a lot!. Maybe this is the key to calculate a successfull render 120-200MB RAM per second of animation. A last question before marking this thread as solved. There's a chance to loop the .apng animation with source edition? With this I mean, make the .apng go backwards after reaching the end, to have less frames involved in the render?
 
This is very intresting I would love to know more about this and eventually do it 🙄
It's probably not super-hard to implement (there should be many libraries to add this), but you need someone with experience in C++ movie/H26x libraries.
With this I mean, make the .apng go backwards after reaching the end, to have less frames involved in the render?
I don't know, how you add that PNG to OTUI. There is 'loop' code for .spr/.dat images. I'm not sure, if it's compatible with OTUI.
 
I don't know, how you add that PNG to OTUI. There is 'loop' code for .spr/.dat images. I'm not sure, if it's compatible with OTUI.
Yes it is probably compatible, because it is made on Unity. With a quick search, something like this or this (I remember looping menus on Unity on class when I was studying):
Code:
GameObject[] gameStar;
int someIntValue;

void Update()
{
  for (int i = 0; i < gameStar.Length; i++)           
  {
    gameStar[i].SetActive(i < someIntValue);
  }
}
But I have no idea how to run OTUI, or even use it. Still too noob to do the gap.
Gesior.pl said:
It's probably not super-hard to implement (there should be many libraries to add this), but you need someone with experience in C++ movie/H26x libraries.
I was wondering if it was possible with C++ :(. Anyways, i'll be searching for this, just learned, but gotta do the effort.
Gesior.pl said:
I saw 'apng' library in code, but I didn't even know it's possible to use APNG in client.
If you can tell me where in the sources you found those libraries to use as reference will be great ;p
As I know this is the library cisco/openh264 (https://github.com/cisco/openh264) but I need to know how to run it with vcpkg

Any tips you can give me, i'll be happy to hear!
I leave you my discord felipe23#1113

One more time, thanks a lot @Gesior.pl, thread solved 😁
 
Last edited:
If you can tell me where in the sources you found those libraries to use as reference will be great ;p
That's code that allocates milion MB ram:

and you need to create some totally custom code, that will keep files on HDD and load frames one by one from HDD like youtube.
OTClient was designed to play movies (animated items with 2-30 frames * 64x64 frames) as smooth as it can. Smoothest way is to keep all in RAM to make it render as fast as possible, but it fails with HD movies.
 
Back
Top