FixAkaTheFix / Tower-Pixel-Dungeon

4 stars 1 forks source link

Adding multi threading optimization #4

Open zay448345045 opened 5 days ago

zay448345045 commented 5 days ago

Hello developers.I would like to ask if the game has considered adding multi threading optimization. There are many monsters placed on the SPD based sandbox dungeon, but it runs very slow. Upon checking the CPU usage of the phone, it was found that only one core is in use, while the other cores are not.

zay448345045 commented 5 days ago

The tower defense dungeons is even more severe, with thousands of monsters and items falling on the interface, causing fps to drop to single digits and severe lag. For large modules, parallel optimization is required.

FixAkaTheFix commented 5 days ago

Hi, Short answer: Sorry, I don't think that adding multithread is possible, with most pd modders being starting spare-time programmers and introducing multithreading being very effort and time-consuming Long answer: ShPD is not a big game and it's engine does not usually need multi-threading The case with sandbox is towers working slowly is that actorthread is overloaded - most of the game, it seems to me, already runs on a couple of threads with one of them being an actor thread. This would be really hard to make mobs split into several threads of working in parallel, while the whole game works on a "turn priority" system, which almost must include all mobs being in one row, or thread, so they could be iterated in order by their act priority. Also note: some of this game was inspired on soul knight's horde mode (if you know this game), and even those professional progs who made that game couldn't handle the sheer amount of mobs and projectiles being both effectively working and being in several threads without INSANE lag Overall, this is a problem a bit too complex for an average indie programmer to solve, but I am working on a new version and I'll consider removing 300-rat waves from it)

FixAkaTheFix commented 5 days ago

Also, wanted to ask, what is your device and how much enemies, approximately, needed for the game to start lagging, mildly and severely

zay448345045 commented 5 days ago

Also, wanted to ask, what is your device and how much enemies, approximately, needed for the game to start lagging, mildly and severely

Processor is snapdragon8+gen1. When about a thousand mobs appear. Tower dungeon doesn't have lag. There is a dungeon called the Too Cruel Dungeon. Some of the challenge options can increase the number of mobs, but after opening it, the game lags more seriously. I think it's fun to challenge a large number of monsters, and the visual effects are very exciting!

Screenshot_2024-06-25-23-56-13-675_ua dreamfools toocruelpixeldungeon dew

https://github.com/FixAkaTheFix/Tower-Pixel-Dungeon/assets/22346235/df884d5e-9bb5-44be-b754-2bbef109a464

FixAkaTheFix commented 5 days ago

Hi again!

First, the approaching infinity/ more mobs with more rooms challenge is... well... It will lag even on pc's, whatever the core quality is. Trust me, I played it. (And even multicore won't save you from the sheer amount of enemies you will see) Second, glad that Towers doesn't lag! To mention, I am the dev of pixel towers only, the dev of cruel pd is a user named Juh, he has his github, like every pd mod has it's own dev, and we mostly don't communicate About Cruel pd you have problems with, as far as I know, it has stopped being developed quite a time ago, and optimization was never a thing anyone cosidered adding, as those million-mob more-roomed dungeon challenges, like too cruel's approaching infinity, were almost a joke from the start, which is mentioned in the game

Good luck completing ApInf. You'll need it) Tpd developer, TheFix

zay448345045 commented 5 days ago

Also, wanted to ask, what is your device and how much enemies, approximately, needed for the game to start lagging, mildly and severely

How about introducing the transifex framework for multilingual translation of game mods? Because through this simplified framework, community enthusiasts can participate in translation. If not, developers who understand PR usually provide game files containing translated text directly, which is very dependent on fate.

FixAkaTheFix commented 5 days ago

First, it is already done, without transifex. If anybody wanted to translate it, they would just need to write to me, and this is done. JDSALing translated Pixel Towers for Chinese, for example. . Also transifex is not free. As I said, I am an indie programmer and though I am trying to make the game of highest quality possible, I won't be using any external networks as this is again, a bit complex, time-consuming, and not necessary for such small (relatively to the original ShPD even) projects. Also transifex in particular is not free.

zay448345045 commented 5 days ago

First, it is already done, without transifex. If anybody wanted to translate it, they would just need to write to me, and this is done. JDSALing translated Pixel Towers for Chinese, for example. . Also transifex is not free. As I said, I am an indie programmer and though I am trying to make the game of highest quality possible, I won't be using any external networks as this is again, a bit complex, time-consuming, and not necessary for such small (relatively to the original ShPD even) projects. Also transifex in particular is not free.

Thank you for your reply! It's like this. Transifex mainly promotes a paid plan, but there are also free plan. The provided framework can complete basic translation, which can be completed slowly, or it can be merged by community enthusiasts submitting PR. Also, I think adding a large map and more tower and mobs challenge options to the tower dungeon would enhance the fun of the game and make the visual effect more impactful.