OpenXRay / xray-16

Improved version of the X-Ray Engine, the game engine used in the world-famous S.T.A.L.K.E.R. game series by GSC Game World. Join OpenXRay! ;)
https://discord.gg/sjRMQwv
Other
2.96k stars 454 forks source link

Increase A-Life ID limit #1638

Open MrMalikov opened 6 months ago

MrMalikov commented 6 months ago

Hello,

I am just a Stalker fan and play it in my free time. I have encountered an error id_generator.h on a MOD called "Stalker Anthology" where assigned IDs for objects are ran out. I have saw the code on "src/xrGame/id_generator.h" and was wondering to increase the ID capacity. Is it possible that we can increse the limit from 65K to 120K IDs or more?

Thank you so much

Xottab-DUTY commented 6 months ago

u32 max value is 4 294 967 295. The A-Life ID limit is not even u32, it's u16, hence the limit of 65535 (max value of u16) entities. So, increasing it to u32 will practically fill all the needs of modmakers.

That will require some work, though. We will need to find all usages of u16 related to the ID system and replace that with u32.

MrMalikov commented 6 months ago

Hi mr Sultan,

Thank you so much for answering promptly to this. Let me see what I can do with the given information and use it.

On Wed, Mar 20, 2024 at 7:48 AM Sultan Uramaev @.***> wrote:

u32 max value is 4 294 967 295. The A-Life ID limit is not even u32, it's u16, hence the limit of 65535 (max value of u16) entities. So, increasing it to u32 will practically fill all the needs of modmakers.

That will require some work, though. We will need to find all usages of u16 related to the ID system and replace that with u32.

— Reply to this email directly, view it on GitHub https://github.com/OpenXRay/xray-16/issues/1638#issuecomment-2008586338, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMRFEKY6BYTOWU6M46C3H3YZD2GLAVCNFSM6AAAAABE6VAF7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBYGU4DMMZTHA . You are receiving this because you authored the thread.Message ID: @.***>

MegaBurn commented 5 months ago

Note: This is a known chronic problem for mods with larger game worlds, especially Anomaly modded with very high "war-zone-like" or "zombie-apocalypse-like" spawn rates, such that some hours into a game it becomes unplayable due to frequent crashes. Which suggests three things, (1) if it were "low hanging fruit" of an improvement it would have been done already so it maybe more complicated than expected, (2) garbage collection/clearance is also a problem such that once the cap is raised then runaway memory usage may follow, and (3) once done this has significant value as a promotional item able to attract more community attention via demoing truly ridiculous game world populations (e.g. may encourage more help in completing Anomaly support). There maybe useful discussions on this in Anomaly and Anomaly mod forums and issue trackers. Hope that helps, sorry I can't be of more help directly.

Xottab-DUTY commented 5 months ago

(1) if it were "low hanging fruit" of an improvement it would have been done already so it maybe more complicated than expected

Yes, there are many places where u16 is used, so we need to thoroughly analyze the engine code. One person told me that game scripts also written with u16 in mind, so we need rewrite not only the engine parts, but also the Lua part.

(2) garbage collection/clearance is also a problem such that once the cap is raised then runaway memory usage may follow

The engine architectural solution for releasing objects references in Lua is very suboptimal. It triggers FPS drops -> lag spikes. So, introducing bigger ID limit is only the first step. Then, we would need to even more rewrite the engine code to make it optimized, i.e. make the game playable with the bigger number of entities.

There maybe useful discussions on this in Anomaly and Anomaly mod forums and issue trackers.

It would be great, if you or someone could hint us with the links the these discussions.

MegaBurn commented 5 months ago

Last time I read into this was early 2022 and I'm having trouble finding some stuff I remember seeing. There seems to be very little practically useful technical discussion, but bug reports thoroughly establish there is a problem and skimming over the player oriented threads helps to get a feel for the scope of the problem.

Here are two decent Reddit threads:

Here are two older Anomaly 1.5.0 threads:

I did a few searches on the Anomaly bug tracker, haven't found anything useful yet, seem to remember something useful being here.

Need to dig through other mods forums and any trackers.

Some notes on those threads and understanding the problem:

Suggestions:

Edit, added some more notes...

Related Issues:

ChristopherCapito commented 1 month ago

I feel an itch to get familiar with C++ again. But the major issue is, is that this will not be adopted will it?

Seems like everyone is running Anomaly. Isnt that based on a different engine fork?

Xottab-DUTY commented 1 month ago

Will this be adopted or not depends on the quality of the engine overall and fame/awareness about it.

Anomaly is based on Call of Chernobyl engine, which is based on 2015 version of OpenXRay, so some sort of compatibility persists. Moreover, entities and server parts in xrGame almost weren't changed in OpenXRay, so it should be possible to port this feature to any other engine. Mileage may vary, though.