Skip to content

Conversation

@MrChuse
Copy link
Contributor

@MrChuse MrChuse commented Dec 20, 2024

Implements #259.

Changes include moving from constant mapBiomes consiting of mMapD * mMapD tiles to a SimpleVector of chunks each of which is of size mMapD * mMapD.

This PR only covers Biomes (and not objects or other things, not even floors which are quite similar). But still it greatly enhances immersion because it removes white noisy background and provides the game with a fog of unknownness of some sort (tiles are still white if the player didn't go there)

Also have in mind that I am not a C programmer and I may not know know best (or even better) practices or style.

I also didn't test changes of performance with these additions. My game didn't lag and the number of drawn tiles is probably the same as before (although there are some new calculations of chunk positions and linear lookup in the array)

Pics:
screen00013
screen00012

@MrChuse
Copy link
Contributor Author

MrChuse commented Dec 29, 2024

I've discovered a bug in this PR.
screen00017
Sometimes patches of tiles are drawn of another neighboring biome.
However, when X is pressed, the correct biome tiles are suddenly drawn.
screen00018

@MrChuse
Copy link
Contributor Author

MrChuse commented Dec 29, 2024

screen00019
New commit fixed this.

@risvh
Copy link
Contributor

risvh commented Feb 25, 2025

I think it is an achievement to come this far tho I have one bug report and a few concerns over this feature.

The bug report is that your (0, 0) gets reset after flight (and same after VOG jump and teleport). The saved biome map should be cleared.

And the concerns: 1) some players report frame rate drop when they zoom out, especially in "developed" area. This is because of the sprites count. Having to draw the biome of all these extra tiles will contribute to this problem. 2) It is mildly confusing as to whether an empty area is really empty or out-of-range since the range doesn't necessarily center on the character/or even rectangular at all. I can see a "mist of war" kind of grey overlay may mitigate this.

I will keep this PR open and up to date to see what I can do with it. Thank you for the work!

@MrChuse
Copy link
Contributor Author

MrChuse commented Mar 3, 2025

The bug report is that your (0, 0) gets reset after flight (and same after VOG jump and teleport). The saved biome map should be cleared.

I put some clearing code into LivingLifePage::clearMap(). I think those things should call this function (or not? i'm not sure)

  1. some players report frame rate drop when they zoom out, especially in "developed" area. This is because of the sprites count. Having to draw the biome of all these extra tiles will contribute to this problem.

Actually, I don't think this will be an issue. The blank tiles were also drawn each frame. I think the number of draw calls will be pretty similar in both cases though I haven't measured it nor know how to do it. Slow downs might appear due to looking for the correct chunk each frame (linear search in the array) but I think this operation is relatively fast.

  1. It is mildly confusing as to whether an empty area is really empty or out-of-range since the range doesn't necessarily center on the character/or even rectangular at all. I can see a "mist of war" kind of grey overlay may mitigate this.

Yeah, I agree with this.

Thank you for the work!

The pleasure is mine. Being able to contribute to the game is great and rewarding. Thank you for your time testing and reviewing.
I've been playing with this change for a couple of months now, and the fact that this game is open source (and allows such client-side shenanigans) is wonderful.

@MrChuse
Copy link
Contributor Author

MrChuse commented Mar 26, 2025

I've hopefully fixed the flight bug. I don't know if the fix is good enough or not. As far as I tested, it resets the map after flights.
For Fog overlay I suggest to copy lines 8741-8787 but with a dark blend, something like setDrawColor( 0.1, 0.1, 0.1, 1 );. I couldn't make it pretty (I tried to make it follow the loaded chunk, failed)

@risvh
Copy link
Contributor

risvh commented Apr 12, 2025

If you have an initial idea of how the fog should work, maybe put it in first for testing and tweaking. There are a few more issues I noticed during my tests:

@risvh
Copy link
Contributor

risvh commented Apr 12, 2025

Sometimes the edge of loaded area stops to blend in softly with the white background, but becomes a sharp edge, see the right-edge at the end of the video.

23.mp4

Steps to reproduce:

  1. Walk left and right in turn like in the video to load-in the area on the right hand side a few tiles at a time.
  2. When you walk to (16, 0), the right-edge of the loaded area becomes a sharp line.

@risvh
Copy link
Contributor

risvh commented Apr 12, 2025

While the fix for resetting the remembered tiles after flight works, it is also triggered in other cases in normal gameplay. I don't have a way to consistently reproduce it but only a way via VOG.

  1. Stand at (0, 0), enter VOG
  2. Scroll around to load the map
  3. When you exit VOG, the remembered tiles are cleared although it isn't flight or teleport.

@risvh
Copy link
Contributor

risvh commented Apr 12, 2025

Performance-wise, the game becomes laggy as the number of remembered tiles grows. Please consider the improvement below.

If I'm understanding it correctly, for each remembered tile, you are saving mMapD * mMapD array of int* but only using one element of that inchunkBiome[mapC]. You also mentioned you wanted to avoid looping through all remembered tiles in the comments in findChunkByCoords(). May I suggest to use a HashTable to save the tiles? You can take a look at how townPlannerMapSavedPos works in LivingLifePage.cpp.

@risvh
Copy link
Contributor

risvh commented Apr 12, 2025

On the setting of eveStartingAge, there is already a forceEveAge.ini for a similar purpose.

@Defalt36
Copy link
Contributor

Thank you for trying to solve such an annoying problem. It really bothered me those white things.

However, I think maybe that's not the most efficient way to solve the problem. You propose a way for the game to remember the tiles the player saw, but only the biomes.

As you are caring only about the biomes a change in the server code so it would be possible to send to the client a bigger portion of the biome wouldn't be more interesting? You'd still not load it, it would not load the objects or players (preserving server resources) and you could even keep the white effect as instead a transparent black overlay that darkens it to show that portion of the map is not actually loaded.

@MrChuse
Copy link
Contributor Author

MrChuse commented Apr 20, 2025

but only the biomes

Yes, I am aware. Remembering other things (like floors, which are quite similar) would require more changes from me, I just didn't bother to do it yet. I mentioned this in my original pr message.

a change in the server code so it would be possible to send to the client a bigger portion of the biome wouldn't be more interesting?

No, I think a client-side solution is good enough. I just need to implement a hashmap storage instead of a vector. It'll be faster, I think.

You'd still not load it, it would not load the objects or players (preserving server resources) and you could even keep the white effect as instead a transparent black overlay that darkens it to show that portion of the map is not actually loaded.

I didn't understand this. I don't quite understand how the server would send the boimes but the client wouldn't load them.

@connorhsm
Copy link
Member

Avoiding a change to the protocol in this case would be preferred. If this feature is implemented, the client having to discover the regions would be sufficient.


delete [] mMap;
delete [] mMapBiomes;
for(int i = 0; i<mRememberedChunkCoordinates.size(); i++){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need a way to iterate through values of a HashTable. Didn't find anything appropriate in HashTable.h and didn't bother writing it myself. Ability to iterate could enable us to get rid of mRememberedChunkCoordinates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants