Re:Dragonica
Skip

Major Graphics and Performance Update: Lighting Enhancements, System Optimizations, new Patcher and Bug Fixes!

Patchnote 0.914.418 - 443

Important note before we dive into the update log: we need to announce that the new update has been delayed. While the update is ready and the files have already been uploaded to the server and game client (which is why the update is so large and takes up significant space), we’re holding off on releasing it just yet. We want to make sure that the patcher and the new game engine work smoothly on everyone’s computer. Additionally, we want to confirm that our crash fixes are functioning as expected.

The new expansion, much like Red Fox Delta, is a "hot" area prone to crashes, so we would greatly appreciate it if you continue sending crash reports as you have been. These reports are incredibly valuable and help us fix the issues more effectively. Thank you again for your patience.

 

It's been a while since our last patch, but fret not, we've been working extremely hard and are proud to announce the results of our efforts.

Our work can be categorized into three main areas: lighting enhancements, game optimizations, and the creation of a new patcher from scratch.

Lighting Enhancements

Dynamic Shadowing system

The most noticeable improvement is the addition of dynamic shadowing. Now, anything that is animated will cast shadows as it should. Before this patch, all shadows in the game were static.

We had attempted to implement a similar feature in the past (as shown in the screenshots below), but it wasn’t viable for two main reasons. Firstly, performance was severely impacted, causing the game to struggle at around 30 FPS. Secondly, the quality of the shadows was poor. The comparison below shows the old implementation in its best-case scenario, which still required 5 times more resources and looked less detailed.

Old method, notice how blurry the shadow is.

 

New method, notice how sharper the shadow is

 

We've worked extremely hard to ensure that the new shadow system is both performant and visually appealing. In fact, it looks so good that even low-resolution shadow maps appear incredibly detailed compared to the static shadow maps. And as we'll discuss later, the performance impact is minimal!

 

Light Interactions improvements

The interactions with various lights within the game have been significantly improved. Your character will now be properly illuminated by environmental light sources, instead of being ignored. Please take a look at the screenshots below to see the difference

Before

After

Similarly, shadows now affect the characters within the game. For instance, if a player goes under the shade of a tree, they will appear darkened.

Notice how the player gets darkened when under the shade.

While this enhancement does add some overhead to the rendering engine, translating to additional workload and slightly reduced performance, we've determined through extensive profiling that the impact is minimal.

 

Cel Shading

Initially, characters were rendered with consistent brightness regardless of their surroundings, giving the game an anime-style appearance. However, with the addition of dynamic lighting, characters began to look plasticky when near light sources. To maintain the desired aesthetic, we've added cel shading to give characters a more "anime" look. Please refer to the screenshots below to see the improvement.

 

Without cel shading

Cel shading enabled

 

As you might have noticed, when cel shading is disabled, characters can appear overbrightened. This occurs because the game does not limit the maximum lighting an object can receive. Consequently, in some areas (such as the one shown), objects may look ugly when affected by surrounding lights.

To address this, disabling the "New Character Shading" option will also turn off dynamic lighting, preventing these issues from occurring. Additionally, we’ve added outlining to complement the cel shading, which is included in the "New Character Shading" option. Unlike cel shading, outlining has a performance impact because it requires the model to be rendered twice (this is a common practice even in modern games; while you could use post-processing, it wouldn't achieve the same quality). As a result, the entire setting (Dynamic Lighting, Cel Shading, Rim Lighting, Outlining, and Tone Mapping), typically reduces FPS by about 10-15% on average, though this can vary depending on the number of players and monsters on screen.

 

Cel shading, Rim Lighting and Outlining working together!

 

 

New antialiasing methods for Vulkan users (MSAA)

We’ve added new antialiasing methods specifically for Vulkan users. When the antialiasing setting is set to low while using the Vulkan API, the game will enable MSAA2x. When set to high, it will enable MSAA4x. Remarkably, the performance impact of MSAA4x is lower than the previous lowest preset, FXAA. This means you’ll experience excellent antialiasing quality with even better performance than before. Please take a look at the screenshots below to see the differences between the various presets.

No antialiasing

FXAA

SMAA

MSAA2x

MSAA4x

 

Shadow additions to many maps that didn't had any prior

Many maps that previously lacked shadows, especially night maps and dungeon maps such as Paris, now feature shadows. Shadows were not added before due to lighting issues that would arise, but we have developed a system that automatically detects and addresses these situations. This ensures the game looks as good as possible with the added shadows. Please refer to the pictures below to see the differences.

 

This is how it was prior to this patch: no shadows and bugged lighting

 

 

When adding shadows, it made the issue even more apparent

 

 

Finally, here’s how it looks after we added the algorithm that checks for these situations and fixes them

 

These kinds of issues appeared extremely often on night maps and dungeon maps. That's why we decided not to add shadows to these maps, even though it didn't make sense since the other times of day would have shadows. That is, until now. We finally have a solution for these situations. The same applies to Paris and many other maps. While the end result isn't 100% perfect, it's good enough that we can add it to the game.

 

Game engine optimizations

Here’s the part most of you have been looking for: the engine optimizations. As you might have guessed, dynamic shadowing adds a small amount of overhead to the game (mostly on the GPU, but some on the CPU as well). Since the game was barely running on some devices, optimizations were required to ensure smooth performance for everyone.

We profiled the game to determine which parts of the code weren’t running smoothly and which could be optimized. This turned out to be a bigger project than anticipated, as many parts of the game were originally coded to be just good enough to work without wasting too much time on optimization. As a result, we had to remove these parts of the code completely and write our own implementations, which took a significant amount of time.

Here’s what we did:

  1. PhysX Engine Enhancements: The developers of Dragonica were not using PhysX optimally, and many parts of the code were deprecated and replaced with more efficient functions. The PhysX scene is created in parallel with the normal scene, so we have developed a system to automatically optimize the objects that will be added to the PhysX scene to minimize the calculations done by the PhysX engine.
  2.  
  3. Animation System Enhancements: The animation system has been greatly enhanced, leading to lesser lagspikes and better performance.
  4.  
  5. Texture Loading Fixes: Bugs in the texture loading system were fixed which also improved the frametimes.
  6.  
  7. Dynamic Object Optimization: Objects added to the game (mobs/players) are now optimized on the fly, reducing the workload on the CPU when doing skinning operations on them.
  8.  
  9. Multithreading Enhancements: Many of you might already be aware, but the game only used a single core of your CPU. A lesser-known fact is that the main bottleneck in Dragonica is draw calls. To address this, we rewrote parts of the engine to allow draw calls to be sent from two threads instead of one. This resulted in massive performance enhancements, with up to a twofold increase in areas that consist of heavy drawing tasks, such as the login screen.
  10.  
  11. Boot Time Improvements: Speaking of login screen, the boot time from launching the game to entering the login screen has also been substantially improved. You can expect around a 10-second reduction in boot time!

Unfortunately, we can't disclose many details about the inner workings of these optimizations, but the improvements have been substantial. These changes have resulted in a smoother, more responsive game, even on devices that previously struggled.

 

Performance Comparison

Let's now discuss the results.

In this comparison, the "before" refers to the last client version of Re:Dragonica currently in use prior to this update, while the "after" refers to the new client version included in this update.

Both versions of the game run at uncapped frame rates, using the "classic" preset. In the "before" version, the shadow setting is set to "Low," whereas in the "after" version, the shadow setting is set to "Off." This difference exists because the "before" version didn't have the option to toggle off shadows, and the newer version doesn't have an option to toggle off dynamic shadows. Other than these differences, the two versions are identical in every other regard.

For a comprehensive analysis, we will also show the performance of the game using the "High" shadow setting in the third tab of the table. This demonstrates how well the game runs despite the extra workload, particularly since the new version does not support static shadowing unlike the previous one.

Please note that the game is running on a very powerful CPU, which is the main bottleneck of the game. While you may not achieve the same FPS, you should experience a similar proportional FPS boost as observed in our testing!

 

Areas / Settings New client shadow OFF Old client static shadow LOW New client dynamic shadow HIGH
Login Screen 1543 FPS 711 FPS 1261 FPS
Char Select Screen 406 FPS 217 FPS 406 FPS
Libra 541 FPS 222 FPS 374 FPS
Port of the Winds 395 FPS 192 FPS 260 FPS
Windia Plains 1631 FPS 790 FPS 1055 FPS
Fungoid Village 530 FPS 262 FPS 360 FPS
Dragon Valley 912 FPS 432 FPS 704 FPS
Salvalon 509 FPS 345 FPS 473 FPS

 

On average, when using the new client with the shadow setting set to "Off," you can expect a 103% FPS increase, essentially doubling the FPS. With the shadow settings left unchanged, you can still expect a 55% FPS increase. This means you now get more FPS with dynamic shadowing than before with only static shadowing, thanks to the significant optimizations implemented!

Additionally, note that the new client includes new graphical enhancements that are always enabled, such as cel shading and dynamic lighting on players and monsters. All tests were conducted using the Vulkan backend, which provides around 30% better performance compared to DirectX9. It should always be used if supported, but if your GPU doesn't support Vulkan, don't worry, you will still experience a substantial performance boost regardless of the API you're using!

Systeme usage information window

To assist players in understanding which settings consume the most resources, we have added a small window showing which computer components are being used for each option. Please note that CPU and GPU usage are relative to other settings. They indicate how much each setting uses that component compared to other resources.

In other words, if the bar is halfway full and your GPU is running at 20%, it means that if the bar is full, your GPU will run at 40% of its capacity. Similarly, if your GPU is running at 50% when the bar is only 15% full, this means if the bar is 30% full, you will be GPU bottlenecked. This is why you might be able to run the game with the GPU bar being full at 1024x768 resolution but not be able to run it with the bar being 30% full at 4K resolution since the workload is much higher.

Finally, the VRAM indicator simply shows how much of your VRAM the game is consuming with the current settings.

 

Bug fixes

- The blinking of some objects on the login screen and the character select screen has been fixed. While we don't know the root cause of the issue, we identified that it was resolved after rewriting a significant portion of the game engine and replacing some nonsensical code. We expect this fix to address other weird bugs as well.

- A bug where the twins would remain locked in an A pose if the player launched a spell right after unfusing has been fixed. Players no longer need to wait before attacking with their twin.

- A bug where Sorcerers would summon multiple demons when using Magma Piston has been fixed. The issue where the spell gets canceled has also been addressed. We are aware that this fix makes the spell less efficient, so it will be reworked at a later date if we notice that Sorcerers aren't powerful enough.

- A bug where monsters would move and attack players while they were lying down after being launched mid-air has been fixed.

- The bug where holding X wouldn't perform the proper chain combo for Archer-based classes when having too much attack speed has been fixed.

- Various lighting issues have been resolved, such as characters having their faces darkened but not the rest of their bodies, characters appearing dark in the character select screen, and issues on the user equipment information tab.

- A bug where targets would receive the attack effect twice (e.g., being thrown twice as high as normal) in the Battlesquare mode has been fixed.

- Various issues regarding rendering on Intel Iris Xe devices have been solved. You will need to toggle the DX12 option in the patcher to fix these issues. Note that DX12 is only recommended for Intel Iris Xe graphics devices and shouldn't be used otherwise, as it will offer lesser performance than even DX9.

Settings menu in the patcher, this is where you can enable DX12 mode

Important: Do not use this mode unless you are running an Intel Iris Xe device experiencing graphical glitches!

Crash fixes

We’ve also developed a bot that automatically plays the game in our dev server, mimicking a normal player, but at 20-30 times the speed! (This often caused the server to struggle and crash, which was quite amusing.) The bot's purpose is to identify and fix crashes, especially those that cause the game to close without letting you submit a crash report.

To track down these crashes, we used special tools to generate detailed crash reports. These reports can be massive, with size being at least over 1GB, making them impractical for players to send. With these bots, we let them run repeatedly until a crash occurred, then we attempted a fix and ran the test again, continuing this process until the game either stopped crashing or took much longer to do so.

Initially, when we ran four of these bots, one would crash in about 20 minutes, usually in Red Fox Delta. Now, it’s stable enough that they can run for over two hours without crashing. While we can’t guarantee that the game won’t crash or that this will noticeably improve your experience, we do expect the game to be much more stable overall, at least that's what we noticed in our testing.

 

 

Patcher rework

Many players had trouble downloading new patches. We have been aware of these issues for a long time and decided to start the development of a new patcher.

The patcher server was based in Europe, which caused problems for Asian and North American users who either couldn't access the server or experienced corrupted patches after download. Without checksum verification after download, users could end up with corrupted .dat files after an update, and sometimes even worse, corrupt their entire .dat file.

To address this main problem, we sought out solutions, and the best solution was to develop a new file format that could be easily updated and repaired. The first step was to find an effective way to distribute patches globally. The best method was to use a Content Delivery Network (CDN), so we began our search for the best CDN available and chose Cloudflare.

Cloudflare has a vast network of servers worldwide, enabling high-speed downloads if the Cloudflare server has the patch file cached.

The next step was to improve the update speed. To achieve this, the update process was multithreaded, allowing it to download files and cache them in memory until the writer thread is ready to write files to the archive.

Of course, the other goal besides updating was repairing. We developed a repair function that can check and repair files. The repair speed will depend on how many files need to be repaired.

Over time and development, new ideas and concepts have been integrated into the patcher:

  • A new UI design that can be easily modified, eliminating the need for CEF (Chromium Embedded Framework), which was too heavy for its purpose.
  • A more portable replacement for CEF.
  • Reworking the Dragonica Vanilla archive files to achieve better performance than the current .dat format.

Besides this, we have also developed tools that automatically compare the current version of the game with the new one. This means it is no longer necessary to remember every modification that has been made or to manually pick the files to create a patch. This process is now automated, which ultimately means we will not need to create several small updates when we forget a file or two since this will no longer happen.

 

The new patcher design

 

Why did it take so long ?

For those who only wanted to know about what was upcoming in this patch, this is about it, this section is dedicated to some of those who kept complaining about why it took so long for the patch to come, however, thankfully, some were very understanding and supporting, and to those of you, thank you very much, those words are what pushes us to continue to strive to give you the best experience possible!

Performance issues

In order to enhance the game's graphic rendering, we aimed to add shadows. Static shadows are great, they don't consume many resources and look good but they can appear odd, especially with moving objects like windmills. So, we sought to do better.

Initially, we made everything cast shadows each frame. This turned out to be a terrible idea because performance suffered significantly, as even static objects had to render their shadows each frame.

Shadow quality issues

The next logical step was to render shadows each frame only for animated objects such as windmills, trees, and players. While this seemed like a great idea, the results were less than ideal.

As shown in the image below, static shadows overlapped with dynamic ones, making them appear much darker. This overlap meant that whenever a dynamic shadow intersected with a static one, it would darken compared to the rest, standing out and looking quite terrible.

The overlap issues is shown here, notice how dark are the shadows below the tree

To fix this, we had to change how Gamebryo (Dragonica's rendering engine) handled shadows to achieve the desired look.

Easier said than done, right? Those are only a small amount of the issues we encountered along the way.

 

Performance issues (again)

When we managed to finally pull it off, this has dramatically improved performance, but it was still not acceptable. Instead of reducing performance fivefold compared to static shadows, it "only" made it 2-3 times slower depending on the area. While a great improvement, it still wasn't enough.

We then decided to cull the shadows and only add shadows to visible parts. This seemed obvious and was considered initially. However, Gamebryo isn't designed for this. Changing the items that cast shadows mid-frame requires regenerating the whole shadow map, which is extremely slow. The game would momentarily run at 80 FPS during this operation before returning to 400 FPS, making it worse than rendering everything in the first place, even objects not visible to the camera.

At this point, we considered giving up the whole shadowing project. However, since we were already one month late and because you, the players, expected results, we had to do something. So, we decided to delve deeper into the game engine, searching for parts where we could replace the old unoptimized code with better alternatives.

The initial results were extremely promising. We managed to avoid performance loss by using the same shadow map instead of regenerating it, but this approach caused frequent crashes.

 

Each spike you see here represents a lag spike

 

This is how the game should run outside these lag spikes (281 FPS instead of 54 FPS)

 

This is how the game ran with the initial fix: a very smooth line indicating no lag spikes

 

This proved to us that there was indeed a way to get the game running smoothly with dynamic shadows, even if the shadow maps changed each frame. We continued to dig further, rebuilding even more parts of the shadowing system in Gamebryo. Ultimately, we achieved nearly the same result (with slightly lower FPS compared to the crashing version) but without any stability issues!

 

Shadow quality issues AGAIN

Now that the shadows are performant enough and stable enough, this should be over, right? RIGHT?

No, far from it actually. This is where the real pain begins. Because Dragonica wasn't made with shadows in mind, the original developers could get away with doing things the lazy way or the incorrect way since it wouldn't be shown anyway.

First, we encountered issues with some monsters and NPCs; they would show "auras" as if they were solid objects:

Thankfully, most of these issues could be solved with a significant amount of code. The good news is that they didn't require manually editing the models.

Unfortunately, the same can't be said about the next problem. It involved many new costumes added to the game. When adding shadows to a player wearing them, the shadows would go totally crazy, as seen in the screenshots below.

This issue is caused by the laziness of the artist who made them. Let's take a deep dive into the model file of "Aphrodite's Top (F)" to see where the issue lies.

At first sight, this looks fine, but let's make every part of the costume visible by adding colors to the whole texture...

Now, with coloring added, we can precisely see what's going on. The game renders all the parts that are transparent, even when shadows are toggled off. Since there are no shadows, this isn't an issue (although it does use some extra resources for no reason). However, when shadows are added, this becomes a significant problem.

To fix this issue, we had to painstakingly do what the artist hadn't done: properly cut the model file to avoid wasting resources and to make the shadows look as intended. Obviously, this is easier said than done, it can take up to two hours depending on the complexity of the model. Now, consider that there are over 300 models to take care of, Male, Female, Dragonkin Male, and Dragonkin Female, (because yes, of course, not just the top had that issue, every part of the costume was made that way), which totals up to about five weeks of work for this task alone.

We considered removing these costumes, but it would have been a huge hassle to explain to you, the players, why it had to be done. Besides, we would have to provide compensations for the costume loss. So, we quickly realized that there was no way around it but to treat each of these costumes one by one.

 

Notice how some parts are purple, those are the areas that weren't properly cut (they are not visible in-game). Still, this is a massive improvement over the original version. Besides making the shadows look much better, this has the additional benefit of using less RAM (2.5MB reduced to 170KB) and fewer GPU resources (around a 20x reduction in polygon count).

Besides those costumes, other elements within the game had issues regarding shadow rendering, even if they were much less severe.

Many of these issues had to be fixed manually as well. From our testing, all of them should be resolved. As you might have guessed, this took a lot of time, requiring us to navigate through each map and check shadows on every animated object.

Finally, some coding oversights by the developers also caused issues with shadows. Instead of removing the objects, the devs would just make them hidden. This not only consumed resources but also created shadows for elements that shouldn't be shown. Take a look at this screenshot and notice how the twin's shadow is apparent while her body isn't visible.

Did you notice how the headlights and the jet engine fire look weird? This is also another issue related to the shadowing.

Quite frankly, there is a lot more to discuss regarding the shadow issues, this is only the tip of the iceberg. Our goal isn't to explain exactly how it works or how to implement it. However, we decided to provide some details to explain why it took so long.

 

Cel shading issues

Remember, this patch wasn't just about shadows, but also cel shading and significant optimizations. For optimizations, it's tricky to show the issues since the main problems we encountered were crashes and instability. The noteworthy part is that we managed an additional 20% optimization that isn't included in this patch because it could cause crashes from time to time (once every 3-4 hours). Once we can fix that, we will add it.

As for cel shading, the issues were just as annoying and painful as the shadowing ones. I'll show some screenshots of the issues encountered without going into further detail, as it would make this write-up too long (if it isn't already).

 

Those are just some of the issues we encountered. To make the cel shading look good, we had to work just as hard as we did for the shadowing. Not only did it have to look good in "normal" circumstances, but it also had to look good under shadows, various light sources, at dawn, day, dusk, and night. You get the idea. We ended up creating a cel shading shader for each of these situations to achieve the final result.

 

Final words

Now, if you're still wondering why it took so long, even after all this explanation, allow me to ask you a question: How many games do you know that have added dynamic shadowing when there was none previously and are using the Gamebryo engine? How many games do you know that managed to optimize their performance twofold, and most importantly, how many of those accomplished all of that this fast?

None. Unofficially, some Bethesda games had dynamic shadows added through mods (Fallout: New Vegas and Oblivion come to mind), but those are either done in screen space or are horribly inefficient, running at 20 FPS on an RTX 4060 when using 2048x2048 shadow maps. With the same shadow map resolution, you can easily run the game above 1000 FPS assuming your CPU is fast enough.

As for optimization, we are aware that some games have achieved better results (Sodium in Minecraft comes to mind), but these weren't done this quickly

Finally, for cel shading, while it wasn't particularly hard to build (it's just some simple math), making it look good is another kettle of fish.

All of this was done while creating a new file system for the game and a new patcher to make downloading and repairing the game faster and easier than before.

Thank you for reading, and stay tuned for the next patch, it’s coming sooner than you might expect! :^)

 

 

3 Comments

Tonetfal
Tonetfal
October 4, 2024 at 6:01 PM

As a technical artist I can say that you have done A LOT! Keep up the hard work!

Pikaqiu
Pikaqiu
August 16, 2024 at 7:10 AM

First of all, thank you for your hard work!

I do not know that players in other regions, but Chinese players have really been looking forward to the update of the new version. This article makes me feel your seriousness and responsibility for the game. We are proud to be part of this game. I hope we keep going.

Thank you again for your hard work(^o^)

moonbyul
moonbyul
August 15, 2024 at 6:48 PM

SUPERB!

You must be logged in to leave a comment.