Posts by red51

A new update is now available, introducing "Points of interest" and many more changes!
Latest hotfix: 0.9 (2025-11-05)

    @red51 I just noticed something in the Javadoc, in the Chunk information net.risingworld.api.utils.Chunk it says a chunk is 16x64x16 while in the same page under the blockData() and terrainData() methods it says they are 20x68x20 why the difference by 4 in each value?

    Basically a chunk is 16x64x16 (XYZ), however, every chunk contains information about the adjacent blocks of the neighbour chunks, that's why the actual array has a size of 20x68x20. The functions getTerrainID() and getBlockID() treats the data as a 16x64x16 array, so you don't have to care about these "neighbour" blocks (but when working with the raw data, you have to keep these neighbour blocks in mind) ;)

    As @Minotorious said, the ingame time only increments while the server is running. The server can configure the time speed. This value is persistent, so you can only reset it manually or by creating a new world ;)


    If you just want to get the real time timestamp, it's better to use use the Java function System.currentTimeMillis();, this returns a millisecond timestamp (i.e. milliseconds passed since 1 January 1970 UTC). If you need a unix timestamp (seconds instead of milliseconds), you can just divide this value by 1000, e.g.:

    Java
    long timestamp = System.currentTimeMillis() / 1000;
    //If you need an integer instead, just cast it:
    int timestamp = (int)(System.currentTimeMillis() / 1000);

    Oh, extra brackets don't matter btw, so even something like int a = ((((((((4 + 2)))))))); is totally legit (even though that's ugly). If was just referring to the wrong bracket positions, since this actually makes a difference ^^

    server_ip=192.168.178.20

    Dieser Eintrag bewirkt, dass der Server nur im LAN erreichbar ist. Die 192.168.178.20 ist deine lokale IP Adresse, welche von außen nicht sichtbar ist, d.h. übers Internet kann niemand zu dieser IP Adresse verbinden. Relevant ist hier stattdessen deine öffentliche IP Adresse, diese kannst du bspw. von Seiten wie https://www.wieistmeineip.de/ herausfinden.


    Wenn der Server allerdings auf deinem privaten Computer läuft, dann kannst du deine öffentliche IP Adresse nicht in dem Feld eintragen, da dein Computer diese IP nicht kennt. In dem Fall musst du das Feld server_ip einfach leer lassen, dann binded der Server an alle Adressen ;)


    Auch die Einstellung bei server_query_ip ist leider falsch. Dort wird eine IP erwartet anstelle eines Ports. Am besten sollte dieses Feld aber leer gelassen werden.


    Wenn du nach diesen Änderungen noch nicht connecten kannst, solltest du ggf. einmal prüfen, ob die Ports wirklich von außen erreichbar sind. Dazu kannst du zB diese Webseite benutzen: https://www.yougetsignal.com/tools/open-ports/
    Starte einfach den Server und gib dann auf der Webseite die Ports 4254, 4255, 4256, 4257 und 4258 ein und prüfe, ob alle von außen erreichbar sind. Falls nein, ist da noch irgendwas was die Ports blockiert (Firewall/Antivirenprogramm, oder falsche Routerkonfiguration, oder etwas auf Providerebene).

    Just a minor correction, the line above is almost correct, but some brackets are at the wrong position (so it won't work this way). Probably you wanted it to look like this :)
    Database db1 = getSQLiteConnection(getPluginByName("Portals").getPath() + "/portals_pingperfect.db");

    Thanks for the report file, everything seems to be ok there... another thing you could try is to run the dedicated server and see if that works. You find the dedicated server in your Steam lib (under "Tools"), just install and run it. Does the server start, or does it also crash while creating a world?


    If the server works, the issue might be somehow related to the game directory.

    As @Minotorious mentioned, this is likely caused by a third party program or a driver issue. Do you run the game in fullscreen mode? In this case you can try to disable the fullscreen mode, adapt the resolution to your desktop resolution and check the "Undecorated" box (this provides an alternative fullscreen mode which works better in most cases).


    If the cursor is still gone, you can try to switch back to the basic Windows cursor. To do that, open the "config.properties" file in the game directory and set "game_no_customcursor" to true, then save the file and run the game. Is the cursor still missing?

    In my case, the problem with RayCastResult is that it does not report the hit object itself in .getCollisionObject(); it only reports something if the hit object is a player or an NPC.

    Unfortunately there is no "Object" object (lol) in the API, so getCollisionObject() only works for entities (like players or npcs). It's difficult to create a class representing an "Object" in the API... the game uses something similar though, but it becomes tricky to keep track of this object (and all changes of its state). The server only uses the actual "Object" instances temporarily in certain situations (when any changes happen), most of the time the server only holds the compressed chunk data.
    Maybe there will be an actual "Object" representation in the API (and also other objects like "Plants" or "ConstructionElements") in the future, but currently it's not planned :|


    But with the next update, it will be possible to retrieve the actual object position and also the type id (as well as the "info id", which - in case the object is a chest - represents the chest id). So if you want to get the actual chest, it could look like this (after the next update):

    Sorry für die späte Antwort! Es handelt sich leider tatsächlich um einen Bug in der API, dieser wird im nächsten Update behoben ;)


    Könntest du bitte in die ChestAPI eine Methode hinzufügen: chest.removeItem(Item item, int amounth)

    Eine ähnliche Methode, welche keine "Item" Instanz, sondern die TypID des Items entgegennimmt, kann ich gerne hinzupacken. Allerdings wird sich diese Methode so verhalten, dass das nächstgelegene Item mit dieser TypID entfernt wird. Die Suche nach einer bestimmten Item Instanz innerhalb der Kiste kann leider nicht ganz zuverlässig implementiert werden: Angenommen, du holst dir eine Item Instanz aus dem Spielerinventar, und der Spieler legt dieses Item anschließend in die Kiste. Grundsätzlich wird dann diese Item Instanz einfach in die Kiste übertragen, das trifft aber nicht in allen Fällen zu (zB wenn das Item auf den Stack eines anderen Items hinzugefügt wird, wird einfach nur der Stack-Count des vorhandenen Items hochgezählt und die Instanz des Inventar-Items gelöscht). Falls es also darum geht, wird es etwas schwierig. Wenn es aber tatsächlich nur darum geht, ein Item eines bestimmten Typs aus der Kiste zu entfernen (zB es sind 10 Spitzhacken in einer Kiste vorhanden, und es geht nur darum, eine der Spitzhacken zu entfernen, egal welche), ist das kein Problem^^

    I am not shure what is causing the db lockup on my server

    Sorry for the late response regarding this issue! Basically the "locked" error indicates that the game/server was not able to write to the database. This happens if the database file is locked/inaccessible, although it's really strange that - according to the log - the server is no longer able to save the world once this issue occurs. I spent some time checking out if there is anything wrong in the game. SQLite hates multithreading, so there is a chance that this error occurs if multiple threads access the world database. However, we synchronized all write tasks some time ago so basically this should not cause this issue. Of course there could be a bug in the server, but unfortunately I wasn't able to find anything that could cause this issue :huh:


    But it looks like the current JDBC driver we're using for the server has some issues at least on Linux. Maybe you can try to download the latest (just extract the zip file into the "libs" folder of your server [while the server is not running] and replace the existing file): jdbc.zip


    If that does not work, I guess the only solution would be to move to MySQL :|


    What's new to me here would be crop failure that it has me now worried if we're going to be struggling 'Conan Exiles' style, or if it'll be tolerable like with Terraria

    I didn't play Conan Exiles so I can't say much about that unfortunately^^ But of course it's important to find a good balance. We just want to make sure that the current "get-a-few-tomato-plants-and-you-never-have-to-worry-about-food-again" approach does not work that easily :D So it will be important to keep an eye on your plants.


    Yeah, but will we be able to build it up from the shell by adding customized parts onto it? Start with the shell to then add the parts onto it in the main world that you'd have vehicle garages build that it be like a factory type setting

    You have to build cars step by step (i.e. first create the chassis, then add the engine, transmission, wheels, body, doors etc). However, these will be pre-made elements, so you can't fully customize it (for example, you can't make a car out of planks, for example). But you can still change the appearance by removing the roof, for example (turning it into a convertible), or changing the color/paintjob of the body. And, of course, you can decide what engine and transmission you want to use (there will be both automatic and manual transmissions available) :)


    We decided against the "fully customizable cars made out of single construction elements" approach. On the one hand, it would be nice to have a high degree of freedom, but on the other hand, 90% of all cars would basically just consist of a few planks, or resemble a "cube on wheels" if we take that approach :D That might be funny, but could be annoying on multiplayer servers...


    That's a tease with the "big boat". I do hope we get to see them then see if we can have them ourselves. I consider this a tease because it's one of those "it's so close, yet so far aware" type deals. Any chance for a sneak peak?

    I really can't say much about big boats yet. The first type of boat we're going to add will be a rowboat, but it would be a pity if there won't be any bigger vessels. We have a big sailing ship in place, but idk if the player will be able to control it (alternatively it might just spawn randomly on the ocean with several pirates on it and precious loot) ^^ Nevertheless, it will take some time until we can focus on bigger vessels^^


    I tried to delete all the world, but I do not see them on the ingame list. If I just delete them from the world folder they are back after restarting the game

    Hmm... that's strange 8| Make sure the game is not running while deleting the worlds manually. Probably it's better to remove the whole "Worlds" folder in your game directory. Is the "jdbc" beta branch still active? Sometimes Steam has trouble downloading all files, maybe make sure the correct files of the beta branch are downloaded by verifying the game files (rightclick on RW in Steam -> Local Files -> "Verify integrity of game files"), then start the game ;)


    If the crash still occurs after removing the worlds folder manually and verifying the game files (I guess there is probably still no errorlog or hs_err_pid?), maybe post a report file here (to do that, open the ingame console by pressing ^ or ` while the main menu is loaded and type "report", then a file called "report" shows up in your game directory).

    You're probably referring to the ObjectInteractionEvent which is called when a player presses F while looking at an object (ignore the note about "setListenForObjectInteractions()", that's deprecated and no longer required, I will update the javadoc soon). It works for all objects (even for objects the player cannot interact with by default, like tables) and allows you to get all relevant information about the object.


    Alternatively the player.raycast() attempt is already a very good approach. Unfortunately it's not possible to get the actual object position yet (instead just the collision point can be retrieved, which is useless in this case). However, the raycast() Method will be enhanced with the next update (or more preceisely, the "RayCastResult" object) so it will be possible to get the actual object coordinates ^^

    Yes, at least when using SQLite, you can use the ATTACH and DETACH statements, for example:


    However, usually it's fine to just establish an new connection to the 2nd database ^^ It's safe to have multiple connections to different database simultaneously, e.g.:

    Java
    Database db1 = getSQLiteConnection(getPath() + "/database1.db");
    Database db2 = getSQLiteConnection(getPath() + "/database2.db");
    ...


    Just remember to close() the database connections if you don't need them anymore.


    If you want to access the world database btw, it's highly recommended to use the built-in WorldDatabase (since there are issues with thread-safety in SQLite). When using the WorldDatabase, all commits are synchronized.
    Example to use the WorldDatabase:

    Well, basically the "cancelled state" can be removed by calling setCancelled(false);. But that depends on when the event listener is executed exactly (or more precisely, in which order the plugins are executed). Example: You have three plugins and they're actually called in this order (plugin 1, plugin 2, plugin 3). By default, the "cancelled" state is set to false. Now if plugin 1 cancels the event, plugin 2 and 3 can see that (by calling isCancelled()), so they can either ignore it (so the event will be cancelled), or set the cancel state to false (then the event will be executed). But if plugin 1 cancels the event, plugin 2 explicitly sets the cancelled state to false and plugin 3 cancels the event again, the event will be cancelled.

    Sorry for the late response! If the crash still occurs without using Lua scripts, it might be related to the jdbc driver (native crash while creating the world database). I've prepared a beta branch with the latest jdbc drivers, to download it, rightclick on RW in Steam -> Properties -> Betas -> select jdbc - sqlite-jdbc-3.23.1. I'd also recommend to delete all worlds (unless there is a working world which was created previously). Once the download it completed, try to run the game and create a new world. Does the issue still persist?

    1) I am finding it would be very useful to have a way to get the vertical and, above all, horizontal size of a GuiLabel

    These methods will be added in the near future :) The current GUI anyway needs an overhaul...


    2) It would also be very useful to be able to retrieve the sizes both as relative and as absolute, regardless of the way they have been defined;

    Methods like "getRelativeWidth()" or "getAbsoluteHeight()" etc. will be added accordingly^^


    Tbh I would like to also see the equivalent setWidth, and setHeight methods for labels as well as setTextAllignment methods wich will be then needed to control where the text will appear on the label.

    Hmm... I'm afraid that will be a little bit complicated. The underlying framework is designed to adapt the element size to the font size (and text width), and the alignment is automatically determined by the pivot... maybe this changes in the future, since we want to rework the underlying framework anyway (to support ttf fonts), but unfortunately I can't say much about that yet :(


    Currently the only way I can see to create a button of set size but with text on it is to first create a GuiImage to have the button border at a set size and then create a GuiLabel on that GuiImage to have the text label in the middle of the button. Then in my GuiListener have an if loop on the GuiClickEvent for either the label or the image being clicked to do the action my button needs to do.

    Maybe it would work if we implement a flag that certain GUI elements should be ignored when it comes to mouse clicks, then the click event will be forwarded to the parent. Basically that's how the game handles it own GUI elements. However, button elements are planned for the API GUI anyway :)

    Ok, danke Red51. Warum aber klappt das mit dem Regen und nicht mit dem Nebel? Nur mal so ne Frage, weil es ja eigentlich aufs Gleiche rausläuft. Oder sehe ich das falsch?

    Naja, der Regen verhält sich grundsätzlich etwas simpler als Nebel ^^ Der Regen kommt ja immer aus einer bestimmten Richtung, nämlich schräg oben. Aus Sicht des Regens kann bestimmt werden, wo genau sich die erste solide Fläche befindet, und unterhalb dieses Punktes wird einfach kein Regen mehr angezeigt. Das funktioniert insgesamt eigentlich sehr zuverlässig. Bei Nebel hingegen würde das nicht ganz so gut funktionieren, denn dann würde schon eine einfache Überdachung (zB ein Carport) ausreichen, dass der Bereich "nebelfrei" ist. Sehr komisch wird es vmtl. bei den verlassenen Waldhütten aussehen, welche ja recht viele Spalte zwischen den Planken aufweisen^^ Bei Nebel brauchen wir also einen anderen Ansatz...