API Learning & Questions!

The next update will be available on Wednesday, December 18, in the early evening (GMT+1).

This update will not yet replace the Java version, instead it is the actual content update. We'll provide more information about the transition together with the update.
  • Hi so I assume a few here know how the new API works etc yahwho ;) so I thought I’d create a thread about my learning and questions if anyone would mind humouring me :D


    Played quite a lot with Rising World Java but never coded and going to attempt downloading the new version again tonight, but I have been reading through the API looking good so far!


    I have quite a bit of coding experience now albeit not with Java much but pretty much the same as C# syntactically at least :P.


    Anyhow my current question for now is TLDR:


    What CAN you mod in, what CANT be added and what are the future plans for the API?


    My basic research so far is new sounds, inventory management as of 0.7, custom images and UI elements, 3D models which can be manipulated with code, formats? Manipulating existing items, world etc and dealing with user input. Lights.


    Now custom items, objects, new storages etc can’t be done currently officially correct?


    Finally my thought is a bit of clever manipulation and object animations, custom sounds etc and then UI elements mixed with the main world gives quite a lot of possibilities already.


    Anyhoo I’m rambling now :p


    Look forward to any responses and advice, thanks!


    Proto0x7C8

  • Hi, thanks for the @ :crazy: hehe


    I would say the sky is the limit, but with the new version you can actually go into space. :D


    Jokes aside, you are correct, C# and java are very similar syntactically, if you can program in one, you will be able to program in the other.


    The API (as you probably already know) just provides an interface between your code and the game code. You can do as much or as little as you want.


    My advise, would be to just dive in and code!

  • Haha thanks yeah! I have quite a bit of C# experience with coding mods for The Sims 3, but gradually more and more into the survival genre tbh.


    My intentions are to start small like a hello world command or something and go from there got a few ideas for what I’d like to add while not copying the roadmap haha


    Thanks then!

  • Hope its okay to double post, made some progress on modding. Worked out how to get my mod in game and start manipulating things and using events, also understand the basics of UI additions which will be useful. Finally I mucked around with getting animals to follow you, with the goal of maybe adding a 'lead' action or something which'll allow you to get animals back to your base to keep, is this implemented already though??


    TLDR: Plugin API is really awesome, so simple to setup and get going and really fun.


    Got an idea for a plugin to add more simulation and useful additions hopefully, but got a couple of questions now from my experiences :P.


    #1 - Custom items/crafting recipes etc possible at the moment on the new API?

    #2 - When rotating construction elements the texture stays in the same place but the object will rotate is that intended behaviour or can I somehow make the texture static?

    #3 - Is using the update tick event ok for manipulating stuff like moving animals around, moving objects etc, as could do some interesting things.


    There's more questions but I forgot for now hah, those are few to start with.


    Thanks in advance!

  • Thanks for your feedback about the API, I'm happy to hear you had a smooth start! :):thumbup:


    #1 - Custom items/crafting recipes etc possible at the moment on the new API?

    No, unfortunately this isn't implemented yet... this is unfortunately a bit more difficult to implement compared to the Java version, because unlike the Java version, each item now has a separate player animation (while the Java version just had a number of generic animations which were reused for many items, even for custom items). We have to reuse our current animation handling to make sure it could be used by the API as well. It's still on our to-do list ;)


    #2 - When rotating construction elements the texture stays in the same place but the object will rotate is that intended behaviour or can I somehow make the texture static?

    This is indeed the default behaviour, but the last update added some options to set a local texture alignment. This is implemented through a "flags" bitmask. We haven't fully exposed this to the API yet (because this is still subject to change and we didn't want to break existing plugins), but there is a private method available for this (in the ConstructionElement class): it's "setFlags(long globalID, int cx, int cy, int cz, int flags)". Local alignment has the value 0b1000, i.e. "8". You could only call this via Reflection atm:


    Ingame, however, you could just set that through the building menu (c) ;)


    #3 - Is using the update tick event ok for manipulating stuff like moving animals around, moving objects etc, as could do some interesting things.

    Yes, basically that's ok. You could also use Timers or methods like Plugin.executeDelayed(). Just keep in mind that this is executed from the main thread (for example, if you put a "Thread.sleep()" there, the game will freeze for that duration). So if you're doing very complex calculations, it's better to spawn a separate Thread for that (if you want to pass the data back to the main thread - for synchronization purposes - you could use the Plugin.enqueue() method) ;)

  • Thanks red, deleted my previous post but good to know where we stand on those aspects!


    red51


    Got a few new questions :P, anyone in the know might be able to answer but the mod I have in mind to make is like a Sims inspired mod, adding more 'needs' such as fun, bladder, hygiene, energy etc but also more realism aspects, I've tried to scan the roadmap but not 100% sure whether if I make a mod like this I'll just be implementing what is already planned for Rising World down the line?


    Potential other ideas I had were to add food spoilage, make fire require wood/coal etc, tools 'breaking' sometimes on use etc amongst other things.


    TLDR: Just don't want to mod in stuff which will just be added to the game anyhow hah would prefer to use my time wisely to enhance the project hah.


    Thanks in advance! Proto0x7C8!


  • I believe the plans are there for food to spoil... as you can see it is currently staying on Fresh until that system is ready to implement. Tools I think are also going to have a chance of breaking over time.


    I showed on my youtube channel where to make campfires and torches you now need to use both coal and grass as well as the wood and stone. Hard to light that fire without grass. You can go through making these changes to the recipes by editing the SQL file definitions.db which has all the recipes for the different items in Rising World. Took less than 5 minutes to add coal and grass to the torches and campfires. A recent change means you can now collect grass using a sickle.


    If you make changes to definitions.db make a record of what you change as Red will be modifying the file while he is working on adding more to the game. I copy my changes into Excel making it easy to put back into the database.


    Am currently working on solar panels and sodium batteries where the sodium comes from sea water.





    Now "Live " : RunAndHideGamer's Modded Rising World Multiplayer Server : Rise Of The Nightwalkers.

    You are stranded on one of the many islands in the Pacific surrounded by wild animals and savage barbarians.

    You start in the middle of tall dry grass surrounded by a huge number of trees.

    An Important Safety Tip - Get some weapons as early as possible. =O =O =O :wat: :wat: :wat: :verysad: :verysad: :verysad:

    Edited 2 times, last by RunAndHideGamer ().

  • You can change a number of things in the SQL database.... for example this picture below is taken after I changed the wide open grasslands of Rising World to African Grasslands and added more trees and rocks as well as lions , elephants and more animals. You can see a zebra in the middle of the grassland in the picture below. All done by changing the data in the SQL database.



    Now "Live " : RunAndHideGamer's Modded Rising World Multiplayer Server : Rise Of The Nightwalkers.

    You are stranded on one of the many islands in the Pacific surrounded by wild animals and savage barbarians.

    You start in the middle of tall dry grass surrounded by a huge number of trees.

    An Important Safety Tip - Get some weapons as early as possible. =O =O =O :wat: :wat: :wat: :verysad: :verysad: :verysad:

  • Thanks mate yeah I'm aware of SQL editing actually just prefer to try implement custom features via the API ideally, its fine though got the basics and will see. Thanks for your help, nice job on your YouTube videos etc :)

  • Sorry for my late response! But things like bladder, hygiene or energy isn't planned right now... maybe it will be added in the long run, but probably not in the foreseeable future ^^


    But it is our intention to add various buffs in the future^^ Things like food spoilage and tool wear are also planned btw.


    i know in the java version if you changed things in the db of a multiplayer server it could cause some sync issues. not sure if this is still an issue with unity. maybe red51 could let us know.

    It depends: Both the client and the server use the database. If a particular setting is only used serverside (e.g. aggro range or health of an npc, damage per item hit, world-related things like biomes etc), you can safely modify it in multiplayer and it will work properly.


    But if a particular setting is used clientside, serverside modifications will not be applied clientside. E.g. things like the asset path of an item, the animation or move speed of an npc, or weather settings (except things like duration). Changing these things usually has no effect.


    When changing crafting recipes, it's a bit tricky: the actual crafting is handled serverside (so the server checks the recipe and verifies that the client has all required ingredients etc), however, the crafting UI is shown clientside (obviously). The client also checks if all ingredients are in inventory before sending a crafting request to the server (this is done to prevent the client from spamming the server with useless requests).


    We will change that in the future though, so the definitions will be synced between the client and server - once that's done, you can change any definitions on your server and that will be properly applied to all clients automatically. Alternatively it will be also possible to do that through the API then ;)

  • You can change a number of things in the SQL database.... for example this picture below is taken after I changed the wide open grasslands of Rising World to African Grasslands and added more trees and rocks as well as lions , elephants and more animals. You can see a zebra in the middle of the grassland in the picture below. All done by changing the data in the SQL database.

    And how do I change that? I usually look for myself dead there. xD

  • And how do I change that? I usually look for myself dead there. xD



    It is pretty much a case of looking through the tables in definitions.db and making changes here and there..... after making a backup of course.


    For example, changes to the grass biome.


    The biomes table for the grass biome said the texture used for the coastline and under the water was "Gravel1" .... I wanted a different look so I replaced "Gravel1" with another texture called "GrassForestDefault"..... now I no longer have gravel down by the sea. I wanted the dirt to look different so I changed it to "Forestground2"


    The animals.


    A table called biomes_npcs specifies which biomes bears are in for example.... originally the biomes ForestDeciduous and ForestConiferous.


    I wanted bears in an additional 8 biomes so I selected the line for bears in the biomes ForestDeciduous, duplicated the line 8 times and then for each new line added I changed the biome from ForestDeciduous to Grass, Bushmeadow, Fernmeadow etc........ started a new game and bears everywhere.


    I wanted African animals in a biome i like to call African Grassland so i copied their records so they were in Savannah and Grass.


    Increased the number of rocks and trees in the Grass Biome in another table so it looked like African bush and with elephants for example i found the column called herddmax and changed that number to 5...meaning when i see elephants there could be up to 5 of them in that area.


    I didn't want certain animals to just walk by me when in real life they would run at the first sight of me.....so I changed their characteristics so they were shy and escape....changed the distance they would see me ...and there you go..... zebra would stop as they sensed me and then take off...instead of walking up to me.


    I could make all lions tame and friendly kitty cats,...but where is the fun in that lol


    I even changed recipes so that lighting a campfire or torch now needs grass.


    So much you can do with the game.


    But always make a backup of your file.... I put all my changes in an excel spreadsheets in case I need to add them back in again if the file is updated by Red down the track.



    So after changing all of this in single player, I now have a multiplayer server as of yesterday and copied all of these changes to the multiplayer server so others can play a different looking biome.


    The multiplayer server is hard to play and ideal for people wanting a survival challenge.


    Now "Live " : RunAndHideGamer's Modded Rising World Multiplayer Server : Rise Of The Nightwalkers.

    You are stranded on one of the many islands in the Pacific surrounded by wild animals and savage barbarians.

    You start in the middle of tall dry grass surrounded by a huge number of trees.

    An Important Safety Tip - Get some weapons as early as possible. =O =O =O :wat: :wat: :wat: :verysad: :verysad: :verysad:



  • We will change that in the future though, so the definitions will be synced between the client and server - once that's done, you can change any definitions on your server and that will be properly applied to all clients automatically. Alternatively it will be also possible to do that through the API then ;)

    awesome thanks for the info!

  • Hey so was curious if there's a way to disable the default UI in the API, I'm pretty sure there is but I forget ;). Also RE creating a mod for servers and multiplayer do all players need my mod or can the server have it and it'll download the data?


    Thanks Cedarman

  • Hey so was curious if there's a way to disable the default UI in the API, I'm pretty sure there is but I forget ;). Also RE creating a mod for servers and multiplayer do all players need my mod or can the server have it and it'll download the data?


    Thanks Cedarman

    not sure on disabling the UI. The plugins go on the server only

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!