what do I need to know if I want to change the definition of FVector in source code?
Due to some reason, I want to have a EXTREMELY huge map in my game. According to the docs and the source code, the map should be unlimited as long as the world bounds check is disabled. However, I happened to find out that any object could not go further than 16777216.0 on any axis. I assume the problem is due to float type, because the precision of float goes beyond 1.0 at exactly 16777216.0 (the precision of float becomes 2.0 when it is more than this value). And in Unreal Engine 4, world position is described using FVector, which is defined by three float.
I want to modify the source code to define FVector using three double, and I want to know what do I have to take care of, or is there anything I should be aware of before making this modification?
Or, is there any alternative solution? My game is basically a multiplayer game and is it possible for the session to hold multiple maps at the same time, and players are allowed to jump through those maps freely?
asked Feb 28 '16 at 04:27 PM in C++ Programming
First just try, float operates same way as double so it should build, problem is the code that operates vector with float types, they will be still limited, that might be hard to change and you would need to change that i case by case. There possibility that this might break RHI (rendering)
Float is scalable type and GPU renders in scalable fasion (size does not matter propotions do), you might try to lose precision by doing this and might not work right with everything, but this might most easiest and simplest solution: You might consider scale down all size and position varables, in other words shrink everything. Insted 1uu=1cm think 1uu=2cm and by that you will make world 4 times bigger.But again i don't know how this will work with other stuff, but it should be less broken then trying to implement double.
You might also consider level streaming with diffrent level offsetting so you move world around the player, you can always move player if needed, to keep him near center. You need to think out of the box.
Maybe UE4 is not good for what you trying to do, engine are not just graphics, in fact i don't think it's there main feature. Each of engine has it cons and pros, engines are better in one things worse in other.
Follow this question
Once you sign in you will be able to subscribe for any updates here