Indeed and from death message seems like i fall from big height. So only solution to this is to wait some more time after arrival at destination without move horse before dismounting it. This usually fix too another bug with horse: horse teleport back in position where you mounted it ... but wait time before dismount not always fix bugs.
Posts by Bamse
-
-
-
-
Hi.
So i remade my plugin to export some raw data from chunks to use as source data for a map. I need a quick way to navigate in middle of sectors. So i write a custom command /tps x, z who teleport me in middle of sector at surface level.
And now things get started to get strange...
In almost all sector, if not all (well for 0,0 usually i find water here) is a strange cave generated in middle of sector who is big vertically hole around 30 blocks (in some sectors i found hole at few blocks under surface, but usually hole is open). After vertical part cave continue horizontally some blocks to south and after come a very very big vertical section ("death hole") as can see in a few images from different sectors
So here is some strange in generation of cave for this particular position from sector (middle of it). But real problem come when used functionn chunk.getLODSurfaceLevel(bx,bz) to calculate elevation of terrain. getLODSurfaceLevel return Y as cave is non existent. And when i move player in this position, i fall around 30 blocks on first vertical section of cave...
As you see in next image, here i got teleported (over hole, and height i calculated from chunk.getLODSurfaceLevel(bx,bz) ).
I think function getLODSurfaceLevel return wrong result for this case when i go in middle of sector and find this strange generated cave.
As reference this is function to calculate Y height of surface:
JavaPS:
I search other cave (regular one not the one with big vertical entrance) and teleported over it using Y calculated by getLODSurfaceLevel and seems i got at surface of terrain as cave was not here. So i think cave are ignored by this function.
Thx red51
-
The story
In my plugin i haves need to calculate block position in chunk to use latter with chunk.getLODSurfaceLevel(bx,bz);
For some values with negative values, i get error:
This is legit error because block position can have value between 0 and 31 and function called with 32!
But block position are calculated with methods from ChunkUtils.getBlockPositionX / Z / Y !
So i suspect here is something wrong.
Research
One of values who game me error are (X,Z): -32,-32
I go in game, activate debug view (F3) and noted some coordinates for reference:
goto -31.9999 95 -31.9999
- in game (via F3): Chunk -1 1 -1, Block 0 31 0
goto -32 95 -32
- in game (via F3): Chunk -2 1 -2, Block 31 31 31
goto -32.0001 95 -32.001
- in game (via F3): Chunk -2 1 -2, Block 31 31 31
After i go back to coding i wrote and run a method in plugin to get same data as reference (log.debug is a custom method who write data to a file):
Codelog.debug("Global postion (X,Z) ={}, {} ==> Chunk Postion (X,Z) ={}, {} | Block Position (X,Z) ={}, {}",ChunkUtils.getBlockPositionX(x, ChunkUtils.getChunkPositionX(x)),ChunkUtils.getBlockPositionZ(z, ChunkUtils.getChunkPositionZ(z))log.debug("Global postion (X,Z) ={}, {} ==> Chunk Postion (X,Z) ={}, {} | Block Position (X,Z) ={}, {}",ChunkUtils.getBlockPositionX(x, ChunkUtils.getChunkPositionX(x)),ChunkUtils.getBlockPositionZ(z, ChunkUtils.getChunkPositionZ(z))log.debug("Global position (X,Z) ={}, {} ==> Chunk Position (X,Z) ={}, {} | Block Position (X,Z) ={}, {}",And result!
Global position (X,Z) =-31.999, -31.999 ==> Chunk Position (X,Z) =-1, -1 | Block Position (X,Z) =0, 0
Global position (X,Z) =-32.000, -32.000 ==> Chunk Position (X,Z) =-2, -2 | Block Position (X,Z) =32, 32
Global poistion (X,Z) =-32.001, -32.001 ==> Chunk Position (X,Z) =-2, -2 | Block Position (X,Z) =31, 31
So for -32,-32 getBlockPositionX/Z give wrong result 32!
Further research
So culprit is getBlockPositionX/Z/Y
I opened class in my Eclipse and i see the following code :
Javaafter i look at this code i don't understand why is condition if coordinate are lower than zero:
Because that for every negative coordinate who is integer number ( like -1.000, -2.000, etc.) block position is calculated wrong because added 0.5f and for this reason i get value 32 at boundary of chunk.
So i think a easy fix is to not add 0.5f for negative int values.
But maybe i miss something..
Thx red51
-
This looks very interesting!
However, unfortunately the game doesn't track when a sector was created... you can find out if a sector was "modified" by having a look into the "sectors" table in the Chunk.db (if a sector is stored there, it means that it's considered "modified". All necessary chunk data is stored in the "info" column, so if the algorithm changes, it's not affected by this.
If you want to recreate a multiplayer world in singleplayer, you will basically need the Chunks.db (or at least the content from the "sectors" table). If you're using the Plugin API, you could extract the sector data through the WorldDatabase (i.e. WorldDatase.executeQuery()).
But I don't think there is really a way to find out if a sector was created before or after the biomes update... but on the other hand, why do you need this information specifically?
I opened table sectors from chunks.db before cave update and i got all coordinates of them ( x, z) ( x on horizontally growing to east, z on vertically growing to north - Correctly?) .
I found on world 30 sectors saved which i marked on map with green. Other are sectors starting to be discovered by players. (Blue ocean, yellow arid, light blue Cold.PS: I got a report one sector saved was regenerated after cave update (i can't confirm myself because i don't have raw data from that sector), even if sector was found sectors table. Its possible to sector regenerated on this case?
-
I see. So mainly we have so far :
- Default - Big islands - temperate climate
- Ocean - Some less big islands - temperate climate
- Dry - Big islands - Arid climate
- Snow - Big islands - Cold climate
Thx for clarification.
-
I think next update will focus on map too. In current state no map in game.
-
On updating webmap for Medieval Realm server i research/explored some sector to see their region.
If for region type Arid, Cold things are clear, i am not sure about region Ocean. This type of regions is very similar with region Default. What are differences between these two?
Legacy sectors (generated before cave update) have region of type Default. So my guess is region type Ocean is new type of region who replace former Default region? I am not sure how to interpret differences between these regions.
Thx
-
And i worked at some raster data from raw data exported. it's god to know if i must remade it.
Like this sector 0,0 of MR
-
On world of MR will not be a full reset, but is considered to override manually some sectors. So is good to know what already was saved in the past. And i can reuse old data already extracted. Otherwise i must reextract raw data/reprocess again and compare with live sector to see if must change. But i think i can have access at Chunks.db from before update, so i will open externally and extract what sectors are saved here
.
Btw i already updated map with full 20x20 sector around origin 0, 0 Now must fill remaining data about islands and regions!
-
I wrote a plugin who export raw data from game and now i have several exported/processed islands and i don't know if they are same (legacy) or a new sectors. I work on local world with same seed as server, so from here i have dilemma, locally except spawn sector all are generated with new algorithm post cave update, but on server several sectors was modified by player prior to update so i must somewhat distinguished old sector who remain unchanged.
Examples:
-
Hi.
I am in process of redone webmap for server https://medievalrealms.co.uk/ - https://map.medievalreal.ms . In old map i draw sectors based on 8000 x 8000 m size and now i will redone them as 8192 x 8192 m
I need to know if a sector/island is legacy one (generated with algorithm before cave update) or generated using new brand algorithm after cave update. How i can see/get this information?
Thx
-
I found a bug regarding watermelon. If are many close to each other, if i gather one with sickle i get seed and watermelon from him, but rest on proximity are destroyed. As how to see in images i collect one from 3 from middle, rest of 2 are destroyed. Or how to see in last image, a whole line are destroyed when i gathered first.
And second issue:
Any way to see better planted seed? It's almost impossible to see where you planted seed, before first stage of grow. In inventory, now seeds are more grey and see a bit better after last update, but on terrain when planting ...
-
Hmm... maybe the x or z coordinate was out of bounds? I just realized that the getLODSurfaceLevel() method has no safety checks
The game works with native memory here, so if x or z is out of bounds (i.e. < 0 or >= 32), it accesses an invalid memory address which may result in a hard crash...
We'll change that with the next update, so the API will just throw a proper exception then^^
However, if you run into any other crashes (or if the method mentioned above still causes crashes despite using valid indices), please let me know
For sure that was. i think i messed initially calculate x and y of block position and because that i get out of bounds and game no check and got server crash.
-
Thx red51.
Lol i don't read until late after i figure how to make alone.
BTW i encountered server crash when i try to use function getLODSurfaceLevel()
I will try example from you to see if server still crash when i use function.
So i make something like this:
Quote/**
* Calculate surface for terrain for x and y coordinates
*
* Note: This function ignore object's from ground level like construction elements and so on!. Just terrain level.
*
* @param x coordinates X
* @param z coordinates Z
* @return Z coordinate - height of terrain surface
*/
public float getSurfaceLevel(float x, float z) {
// calculate chunk position.
int cx=ChunkUtils.getChunkPositionX(x);
int cz=ChunkUtils.getChunkPositionZ(z);
// Calculate block position in chunk
int bx=ChunkUtils.getBlockPositionX(x, cx);
int bz=ChunkUtils.getBlockPositionZ(z, cz);
log.debug(" Global position (x,z): {} {} | Chunk position (x,z) : {} {} | Block position (x,z): {} {}",x,z,cx,cz,bx,bz);
// Get chunk
Chunk chunk= World.getChunk(cx, cz);
// return height (Y axis) including water
// First try: i need only a block so i use function getLODSurfaceLevel() but follow line generate exception unhandled and crash server !
//return chunk.getLODSurfaceLevel(bx, bz, true);
// second try - read all chunk terrain height 32x32
float[] terrain = chunk.getLODTerrain();
// read only block what i need
return terrain[Chunk.getTerrainIndex(bx, bz)];
}
I tested your code. No crash! Function seems to work properly .
After i tested again my first variant. All worked fine.
I am not sure why earlier test server crashed many time with exception UNCAUGHT ...
Quote#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363) at pc=0x00007ffb8fb3cb69, pid=18844, tid=14684
#
# JRE version: OpenJDK Runtime Environment (20.0+36) (build 20+36-2344)
# Java VM: OpenJDK 64-Bit Server VM (20+36-2344, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# C [KERNELBASE.dll+0x2cb69]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
--------------- S U M M A R Y ------------
Command Line: -Xmx1024M -Xms32M -Xss1M -XX:MaxDirectMemorySize=256M -XX:-OmitStackTraceInFastThrow
Host: AMD Ryzen 9 5900X 12-Core Processor , 24 cores, 31G, Windows 10 , 64 bit Build 19041 (10.0.19041.2788)
Time: Wed Apr 26 20:57:28 2023 GTB Daylight Time elapsed time: 156.669495 seconds (0d 0h 2m 36s)
--------------- T H R E A D ---------------
Current thread (0x0000023415380520): JavaThread "Thread-0" daemon [_thread_in_native, id=14684, stack(0x000000ad87300000,0x000000ad87400000)]
Stack: [0x000000ad87300000,0x000000ad87400000], sp=0x000000ad873fe6d0, free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [KERNELBASE.dll+0x2cb69]
C [GameAssembly.dll+0x47a3a0]
C [GameAssembly.dll+0x3a9c3c]
C [GameAssembly.dll+0x3a9d23]
C [GameAssembly.dll+0x44f2f9]
C [GameAssembly.dll+0x16a01c2]
C [GameAssembly.dll+0x2cb1bc]
C 0x0000023403771ff3
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j net.risingworld.api.objects.world.Chunk.getLODSurfaceLevel(IIIIZ)F+0
j net.risingworld.api.objects.world.Chunk.getLODSurfaceLevel(IIZ)F+12
j bamse.rw.HelloWorld.showChunkData(Lnet/risingworld/api/objects/Player;)V+81
j bamse.rw.HelloWorld.keyInput(Lnet/risingworld/api/events/player/PlayerKeyEvent;)V+95
j java.lang.invoke.DirectMethodHandle$Holder.invokeVirtual(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V+11 java.base@20
j java.lang.invoke.LambdaForm$MH+0x00000008010bf800.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+52 java.base@20
J 1309 c2 net.jiw.unity.runtime.PluginEventHandler.triggerEvent(Lnet/risingworld/api/events/Event;)Z (388 bytes) @ 0x0000023403f03938 [0x0000023403f02dc0+0x0000000000000b78]
v ~StubRoutines::call_stub 0x000002340375100d
siginfo: EXCEPTION_UNCAUGHT_CXX_EXCEPTION (0xe06d7363), ExceptionInformation=0x0000000019930520 0x000000ad873fe850 0x00007ffae13b9988 0x00007ffade130000
Registers:
RAX=0x00007ffae47f6381, RBX=0x00007ffae13b9988, RCX=0x00007ffae53dc980, RDX=0x00000233804d5d90
RSP=0x000000ad873fe6d0, RBP=0x000000ad873fe9c8, RSI=0x000000ad873fe850, RDI=0x0000000019930520
R8 =0x0000000000000000, R9 =0x00007ffa00000000, R10=0x0000000000000002, R11=0x0000000000000000
R12=0x0000000000000000, R13=0x0000023411055280, R14=0x000000ad873fea10, R15=0x0000023415380520
RIP=0x00007ffb8fb3cb69, EFLAGS=0x0000000000000206
.....
-
Hi.
I want to make a function in API to teleport player on location (x,z), let say function teleport_to_surface(x,z). For this i need to calculate a safe Y value so player don't teleport underground or on high and fall to death. So require is to teleport on ground on terrain or if is any building block here, on top of it.
Any can have a idea to accomplish that?
First try was to use function raycastFromWorldPosition(...) but this have serious limitless like chunk when i want to teleport need to be rendered on client side and if teleport far away or on unexplored world .. this approach do not function.
For second try i think to read somehow position of Z direct from chunk data, but here i am stuck i don't have idea how i can do that. Moreover what happen if i want to work with a chunk which was not yet generated by server ...
Thx in advance for hints!
-
It's the case yahwho say. Survival. I make like other time: just planted and go away in other zone for a few days. When i come back nothing grow, but in same time i collect apples from some wild apple tree and they already have another apples in less 24h. I plant again a apple tree to see tomorrow if grow. BTW all apples tree are one protected area if this matter. And i collect some corn too. This, same like apple tree, don't make another corn. And apple tree and corn are planted at least from Sunday if remember correctly.
EDIT: I just check and apple tree, planted yesterday, are mature now with apples. That in around 12h. Still others, stuck on grow, apple tree and corn are the same: apple tree in some stage of grow and mature apple tree and corn not make another apple, corn.
-
It's like in some cases plants forget to grow. it happens to remains in sap stage, or in some grow stage. In first case collect sap and replant usually fix grow but in latter you lose sap if plant is apple tree for example. And this happen too with mature apple tree or corn. Collect it and it's a chance to not start to make apple or corn again.
-
This will be wonderfully. Just append a line to file, not replace all file and all will be fine.