Get current biome of a character

I struggle to find some example of how to get a biome name or its id. The game reports the current biome of a player in a log file and to steam's rich presence system but i can't figure out what functions i should call to get that info.
Ultimately i want to get a biome not of a player but of a lizard doggo when it spawns. But i welcome any tips and suggestions on this matter.
Solution:
Never used it, but maybe try UFGMapAreaTexture::GetMapAreaForWorldLocation
Jump to solution
26 Replies
Solution
SirDigby
SirDigby•4d ago
Never used it, but maybe try UFGMapAreaTexture::GetMapAreaForWorldLocation
Robb
Robb•4d ago
I haven't used the system much, but I think there are volumes placed in the world that are used to define what map area you're in. I think we left on in ExampleLevel? you can probably check collision with those volumes to find out where you are
Rex
Rex•4d ago
There is a FGMapAreaTexture somewhere that looks like this when decompressed (the colour values came from the map area texture itself, but are only used when painting it). Each colour is a different "biome" (map area, IIRC)
No description
Rex
Rex•4d ago
Not sure what that is used for, but it seems to at least be used for rich presence and maybe some music stuff. I haven't checked if there are volumes, there's likely some
SerGreen
SerGreenOP•4d ago
Hmm, that texture is probably created at runtime from VolumeMapAreas and it's probably used by the rich presence system. Normalizing player's location and sampling this texture using UV coordinates is probably faster than iterating over every area. Not that i know how to get the areas anyways, they are placed in the level itself and i have no idea how to extract such data. GetMapAreaForWorldLocation function sounds like exactly what i'm looking for, so i'm trying to figure out how to access it. It's not exposed to blueprints and an access transformer BlueprintCallable=(Class="/Script/FactoryGame.FGMapAreaTexture", Function="GetMapAreaForWorldLocation") didn't help either. Trying to learn how to mod with C++ right now, i think i need to create a blueprint function library. However, Visual Studio doesn't seem to cooperate and it doesn't see any of the UE headers. Regenerating project files, restarting VS, updating VS didn't help, in fact it broke it even more, at first it didn't see UE includes only in my mod, but now it doesn't see them even in MAM Tips mod that i downloaded as an example (it worked fine before). Even funnier, it seems to forget V5 version of the engine exists. despite knowing about Unreal5_3 on the previous line... I hate C++. 😦
No description
No description
Rex
Rex•4d ago
It's not created at runtime
SerGreen
SerGreenOP•4d ago
Alternatively i can just import this texture and sample it myself... Where did you get it?
Rex
Rex•4d ago
It's not a texture per se, one sec Should be something along the lines of FactoryGame/Content/FactoryGame/Interface/UI/Minimap/MapAreaPersistenLevel/MapareatexturePersistentLevel
SerGreen
SerGreenOP•4d ago
Oh, this one! I saw that it was 1x1 pixel and decided it's not what i want. It didn't occur to me that it's just a stub.
No description
Rex
Rex•4d ago
It's not a texture per se It's inside the FGMapAreaTexture, stored as indexed colours
SerGreen
SerGreenOP•4d ago
wait, no, not this one
SerGreen
SerGreenOP•4d ago
this one, it doesn't have a stub in the UE project
No description
Rex
Rex•4d ago
I made this thing a while ago to dump and compare map area textures from the currently running level (to compare ExampleLevel against the game's level): https://github.com/Th3Fanbus/Th3MapAreaDumper There is a Python script that interprets the JSON I generate, but could be adapted to work with FModel Alternatively, SignpostMarv made this (which takes FModel's JSON as input): https://github.com/SignpostMarv/MapareatexturePersistentLevel.json-parser
SirDigby
SirDigby•4d ago
I'm not sure it's possible to get the map area texture for a specific location that isn't around the player. I see functions in AFGGameState and AFGPlayerController for getting current or visited areas Well, actually. You could probably get all of the subclasses and just iterate through them But that would be cpp as well
Rex
Rex•4d ago
Isn't the map area texture global? There's only one What there may be multiple of are map areas
SirDigby
SirDigby•4d ago
Ah, true Surprising there isn't some static method to just get the texture
Rex
Rex•4d ago
There has to be one because I know I've used it Ah, I think I get it through the minimap capture actor Or whatever I did here
SerGreen
SerGreenOP•4d ago
MapAreaTexture is available in BP but it doesn't have any methods or variables exposed
No description
SirDigby
SirDigby•4d ago
You might have to make a BP Function Library in C++ to use them
SerGreen
SerGreenOP•4d ago
I'm afraid so 😦
SirDigby
SirDigby•4d ago
It's not too bad once you've done it a couple times
SerGreen
SerGreenOP•4d ago
Getting area name for the player turned out to be pretty simple btw, but i need it not for the player (not sure this is the best way to get the controller)
No description
Rex
Rex•4d ago
I think you can also use the minimap capture actor for stuff
(not sure this is the best way to get the controller)
For now it should be fine
SerGreen
SerGreenOP•4d ago
Holy moly it worked.
TSubclassOf<UFGMapArea> UModRefBPLib::GetMapAreaFromWorldLocation(FVector WorldLocation, UFGMapAreaTexture* MapAreaTexture) {
return MapAreaTexture->GetMapAreaForWorldLocation(WorldLocation);
}
TSubclassOf<UFGMapArea> UModRefBPLib::GetMapAreaFromWorldLocation(FVector WorldLocation, UFGMapAreaTexture* MapAreaTexture) {
return MapAreaTexture->GetMapAreaForWorldLocation(WorldLocation);
}
No description
SerGreen
SerGreenOP•4d ago
Thank you, everyone!
SerGreen
SerGreenOP•2d ago
Extra note: it takes some time for the MapAreaTexture to start working. For about 2 seconds after loading a save it will return null for any requested coordinates. My solution is to check if returned MapArea is valid and if not then call Delay and loop back to try GetMapAreaForWorldLocation again.

Did you find this page helpful?