PadWorld-Entertainment / worldofpadman

World of PADMAN game repository
https://worldofpadman.net
Other
39 stars 9 forks source link

Code: Flickering entities - pushing the entities limit #29

Closed kai-li-wop closed 10 months ago

kai-li-wop commented 3 years ago

There seems to be a hardcoded limit of drawn entities at the same time. This effects usually big maps filled with a lot of items and other entities. But also when using BOASTER not all of the foam puddles are drawn when there are a lot of player online at the same time. So this already affects especially the current TrashMap. The effect on the items are best visible in this video by 3aTmE! When I remember correct @seldomU already tried to have a look at the issue back in 2011, but WoP v1.6 was too close to release date, there was not enough time to implement a solution.

robo9k commented 3 years ago

AFAIK bumping the entity limit would also mean a change in netcode, i.e. actual new protocol version and make our engine incompatible with ioq3 clients. This is not an official use case, but WoP maps designed for a higher entity limit would also not work in other ioq3 engines anymore. If it's just about the entities being drawn instead of the harcoded limit that's another story and upstream ioq3 would probably also be interested in a bugfix.

mgerhardy commented 3 years ago

To raise the limit we would have to bump the protocol version yes - I suppose we should raise it from 1024 to 4096 - this is what I've seen in other q3 engines - from 10 to 12 bits.

kai-li-wop commented 3 years ago

I know that @robo9k doesn't like to break with ioquake3 but this limit is really crucial to certain maps and if not raised, I don't see a chance to release TrashMap CTL, which lingers on my hard disc since 10 years. Also, some of the custom maps reached this limit, like shown in the video. So, I would say, go for it with WoP v1.7.

robo9k commented 3 years ago

This'll also break compatibility with demo files, i.e. even our engine couldn't load old demos anymore nor would tools such as Q3MME work. This also means we need to maintain our engine fork forever, since those changes will not get upstreamed.

Before we do that I'd at least like a rundown of what those >1024 entities are. Does anyone have counts of e.g. players, projectiles, items?

Also not entirely convinced that there aren't e.g. unused high bits somewhere that could be abused instead.

zturtleman commented 10 months ago

Entities popping in and out of view may be MAX_SNAPSHOT_ENTITIES (256). It's not the game entity limit MAX_GENTITIES (1024) as walking around doesn't automatically remove/add items like in the video.

Wolfenstien: Enemy Territory and Spearmint use MAX_SNAPSHOT_ENTITIES 512. This is a network compatibility break. I don't think it requires any other changes than the define.

Though Quake 3 just doesn't handle large open maps well. Maybe it's possible to use areaportals(?) on the maps to help split the PVS (potentially visible set) to reduce entities sent to clients. (I don't know the mapping side well.)

q3map2 has global fog support for Wolf:ET that automatically splits the map into chunks with limited view range. It might be possible to add a q3map2 feature (if it does not exist) to only apply this to entities so far away entities aren't sent to clients. (Though again, I don't know this area well.)

kai-li-wop commented 10 months ago

With 6b997baf4c3114f3ebc130476f7718ee8cdc4f2b I raised MAX_SNAPSHOT_ENTITIES to 512. Would be good to get some feedback from @3aTmE if this helps to solve the issue.

mgerhardy commented 10 months ago

maybe we should bump the protocol version, too

kai-li-wop commented 10 months ago

It already is. Due to repacking all the pk3 files we already changed PROTOCOL_VERSION to 72. WoP 1.6 has 71 afair.

3aTmE commented 10 months ago

Just tested it on my end locally with a test map containing 512 entities in total.

Unfortunately, it seems that only half of the entities will still be rendered.

3aTmE commented 10 months ago

@kai-li-wop Like requested here is the compiled test map I've used :

ENT-TEST BSP.zip

kai-li-wop commented 10 months ago

Console spams: "CL_GetSnapshot: truncated 510 entities to 256". This leads me to MAX_ENTITIES_IN_SNAPSHOT and not MAX_SNAPSHOT_ENTITIES. I raised MAX_ENTITIES_IN_SNAPSHOT to 512. Looks like all entities are drawn now. No errors as far as I can see.

@zturtleman: Spearmint uses "MAX_SNAPSHOT_ENTITIES 512" and "MAX_ENTITIES_IN_SNAPSHOT 256 * MAX_SPLITVIEW while MAX_SPLITVIEW is set to 4. I guess it would be safe then to set MAX_ENTITIES_IN_SNAPSHOT at least to 512, same like MAX_SNAPSHOT_ENTITIES. What do you think?

shot0000

kai-li-wop commented 10 months ago

a17e767e5afba5df9c435c0dfa8c82aeba508567 raises MAX_ENTITIES_IN_SNAPSHOT to 512.

zturtleman commented 10 months ago

Yeah, that makes sense.

3aTmE commented 7 months ago

Just tested it with my ent_test.bsp map and can confirm that all 512 entities of this map are displayed properly! 👍