Sign in to follow this  
Warlander

WurmAPI - create your own Wurm world

Recommended Posts

WurmAPI
create your own Wurm world


WurmAPI is Java API that allows you to create and preview your own Wurm Unlimited world, before the game release. It is available here: https://github.com/codeclubab/WurmModServerApi . It will be extended with time, depending on needs.

In case of any problems/bugs/suggestions, please leave feedback - we will try to deal with issues as soon as possible.

Simple usage example:
 


import com.wurmonline.mesh.FoliageAge;import com.wurmonline.mesh.GrassData;import com.wurmonline.mesh.Tiles.Tile;import com.wurmonline.mesh.TreeData;import com.wurmonline.wurmapi.api.MapData;import com.wurmonline.wurmapi.api.WurmAPI;import java.io.File;import java.io.IOException;import java.util.logging.Level;import java.util.logging.Logger;import javax.imageio.ImageIO;public class MapTest {        public static void main(String[] args) {        WurmAPI api;        try {            api = WurmAPI.create("Creative", 11);        } catch (IOException ex) {            Logger.getLogger(MapTest.class.getName()).log(Level.SEVERE, null, ex);            return;        }                MapData map = api.getMapData();                int halfWidth = map.getWidth() / 2;        int halfHeight = map.getHeight() / 2;                for (int i = 0; i < map.getWidth(); i++) {            for (int i2 = 0; i2 < map.getHeight(); i2++) {                int distToEdge = Math.min(halfWidth - Math.abs(i - halfWidth), halfHeight - Math.abs(i2 - halfHeight));                if (distToEdge > 10) {                    map.setRockHeight(i, i2, (short) (95));                    map.setSurfaceTile(i, i2, Tile.TILE_GRASS, (short) (100));                    map.setTree(i, i2, TreeData.TreeType.CEDAR, FoliageAge.OLD_ONE, GrassData.GrowthTreeStage.MEDIUM);                }                else {                    map.setRockHeight(i, i2, (short) (-200));                    map.setSurfaceTile(i, i2, Tile.TILE_DIRT, (short) (-100));                }                map.setCaveTile(i, i2, Tile.TILE_CAVE_WALL);            }        }                map.saveChanges();        try {            ImageIO.write(map.createMapDump(), "png", new File("map.png"));            ImageIO.write(map.createTopographicDump(true, (short) 250), "png", new File("topography.png"));        } catch (IOException ex) {            Logger.getLogger(MapTest.class.getName()).log(Level.SEVERE, null, ex);        }        api.close();    }    }

  • Like 17

Share this post


Link to post
Share on other sites

yeah ,.,, i use notpad ++ for LUA scripts , its similar , but how i compile a java ?> 


Share this post


Link to post
Share on other sites

i have to use java sdk ?

Yes, you need JDK 8 and either good IDE or very good knowledge about how to build and run Java projects from command line/via ANT.

Share this post


Link to post
Share on other sites

yeah  .... not for me lol


im a squirrel scripter ... never worked with java or visual based codes .


shame you didnt made something easyer XD


  • Like 1

Share this post


Link to post
Share on other sites

Well the rest of us will be waiting for someone to make a map generator for dummies edition, lol 


  • Like 9

Share this post


Link to post
Share on other sites

It's an API, it's there so people can start building actual map editors/builders.

Awesome job, Warlander!

  • Like 6

Share this post


Link to post
Share on other sites

i probably can learn the basic java work in 2 days .. i just dont wanna XD il wait for more easy program to make maps for wurm unlimited . like some visual editor can be nice ..


Share this post


Link to post
Share on other sites

i probably can learn the basic java work in 2 days .. i just dont wanna XD il wait for more easy program to make maps for wurm unlimited . like some visual editor can be nice ..

https://en.wikipedia.org/wiki/List_of_JVM_languages

Pick your own taste, most (well, I think all) of these languages can work with this API.

  • Like 2

Share this post


Link to post
Share on other sites

ty warlander. now lets build some stuff


Edited by noermel

Share this post


Link to post
Share on other sites

API Documentation to go with the code?

It is in code. Any modern IDE should be able to allow easy access to it.

Share this post


Link to post
Share on other sites

WTB "for dummies" editor.  (Seriously, I'm sure it would sell, AND would be one of those rare DLC's worth getting).


 


I can SORTA read code and get an idea of what's being aimed at but.... 


 


At university..basic C++.... I learned that code and I are not meant to get along.. I DON'T HAVE THE GIFT!!!! *storms off dramatically*


  • Like 4

Share this post


Link to post
Share on other sites

Once again you did an awesome job, Warlander! Congratulations - and thank you for this very useful API.

  • Like 2

Share this post


Link to post
Share on other sites

Trudat.. good job making things ready for launch there, War.


 


Rolf should give you a cut on certain WU-related profits at this rate.  (Run Rolf, RUN!) *grin*


Share this post


Link to post
Share on other sites

Thank you Warlander!


 


I'm kicking myself for learning Python instead of Java now. I'll start on Java, its just going to take a lot of time before I can do something useful.


 


I already see something interesting about tree "difficulty". For a long time folks have thought oak trees provided more difficulty to cut down (and consequently should be better for skill gain at higher skill) then other trees. I'm not sure what the numbers mean or if they do in indeed mean what I think they do but TreeData.class has tree difficulty values.


 


oak 20, willow 18, walnut 15, linden 12, chestnut 12...the rest are 2s and 5s.


Edited by joedobo
  • Like 1

Share this post


Link to post
Share on other sites

 

Can someone recommend an open source API for Windows that can get this up and running quickly?

 

 

Someone in the map thread posted about an island generator with MIT source license no commercial use restrictions .  Although it is polygonal Voroni mesh should be easy to interpolate to grid at higher resolution by ripping its pixels from the display routine..  You will need to tweak river and lakes pushing them to sea level or turning them in to dirt.  The flash website lets you save .png.

 

http://forum.wurmonline.com/index.php?/topic/130605-wu-mapterrain-generator-development/page-7#entry1352673

 

I think it would be much easier getting up and running quickly if someone writes a 16b greyscale height map .png/.tiff importer though as that would require no SDK at all.  Could use 8b grey scale for defining biomes, maybe an RGB for the various terrain and flora layers.

Edited by yarnevk

Share this post


Link to post
Share on other sites

It is in code. Any modern IDE should be able to allow easy access to it.

 Just a lot easier to sneak a peak at a documentation .pdf file than having an IDE up to read the API and comments in case the boss walks by....not all of us can work on Wurm at work bad enough I am on the forum!

Edited by yarnevk

Share this post


Link to post
Share on other sites

Someone in the map thread posted about an island generator with MIT source license no commercial use restrictions .  Although it is polygonal Voroni mesh should be easy to interpolate to grid at higher resolution by ripping its pixels from the display routine..  You will need to tweak river and lakes pushing them to sea level or turning them in to dirt.

 

http://forum.wurmonline.com/index.php?/topic/130605-wu-mapterrain-generator-development/page-7#entry1352673

 

I think it would be much easier getting up and running quickly if someone writes a 16b greyscale height map .png/.tiff importer though as that would require no SDK at all.  Could use 8b grey scale for defining biomes, maybe an RGB for the various terrain and flora layers.

 

Sorry I meant IDE, not API. Some kind of development platform (like Visual Studio etc) that lets you compile standard java out of the box.

 

There's a list here: http://java-source.net/open-source/ides but I wondered if someone could recommend a simple one that has an integrated editor etc. but doesn't come bloated with a million things you don't need for simple java compilation.

Edited by DKSprocket

Share this post


Link to post
Share on other sites

Just a lot easier to sneak a peak at a dpcumentation .pdf file than having an IDE up to read the API and comments in case the boss walks by....not all of us can work on Wurm at work bad enough I am on the forum!

I am not even sure if it is possible to export Javadoc to PDF at all - it is possible to export it as HTML page, but never seen it in PDF format.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this