Jump to content

zrenderer - Webservice and CLI tool to create RO sprite images


zhade

Recommended Posts


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   10
  • Joined:  11/12/11
  • Last Seen:  

Hey everyone,

The tool I am releasing is able to create RO sprite images in almost the same way as the official client does it. Means all it requires are the official data.grf files.
You can compare it to ROCharGen.

I've been working on this project for quite some time, mostly due to changing to some other fad regarding programming languages and re-implementing the logic everytime. However I have now stick to one and actually got it to a point where it is possible to release it (actually the code has been up on github the whole time).

So what exactly does it do?
Given a data/ folder that contains the necessary sprite and lua files, it creates a set of png images for specific job ids. In case of animations it instead creates an apng image.

Examples

Spoiler

These examples are created using the CLI tool.

zrenderer --job=1001
1001_0.png

zrenderer --job=1870 --action=16 --frame=10
1870_16_10.png

zrenderer --job=4012 --action=17 --frame=2
4012_17_2.png

zrenderer --job=1 --headgear=4,125 --garment=1 --weapon=2 --head=4 --gender=female --action=32
1_32.png

zrenderer --job=0 --head=15 --bodyPalette=1 --weapon=2 --garment=1 --gender=male --action=93 --canvas=200x200+75+175
0_93.png


Webservice
As written in the topic title the tool is available as a CLI tool (see examples) or as a webservice. Means you can put it on your server and make requests to it to view for example the character sprites of your players.
For that I have created a FluxCP addon which interacts with the webservice: https://github.com/zhad3/zrenderer-fluxcp-addon.
Setting up the whole thing is not as easy as ROCharGen hence there is a comprehensive tutorial available to get up and running: https://github.com/zhad3/zrenderer-fluxcp-addon/wiki/Tutorials

FAQ
Q: Can it create signatures like ROCharGen with background image, name, level, etc.?
A: No.

Q: Can it render 3d sprites such as the Guild Guardians, Treasure chests or Emporium?
A: No, only 2d sprites

Q: Can it render 4th jobs and new expanded classes such as Shiranui, Spirit Handler or Hyper Novice?
A: Yes.

Q: Can it render my custom items?
A: Yes, with the exception of shields.

Q: Can I use it for Ragnarok Online Zero?
A: It has not been tested. The tool was created based on Renewal and just as that uses the lua files from the GRF which might not be available for Zero.

Q: How do I use this?
A: For a server setup read the tutorial: https://github.com/zhad3/zrenderer-fluxcp-addon/wiki/Tutorials. If you just want to fiddle around I recommend building the CLI tool. See the build instruction on the github. For windows you may also directly download the binaries from the releases page: https://github.com/zhad3/zrenderer/releases.

Q: How do I update the data when I release a patch for my server?
A: Currently there is no automatic process. The tool zextractor that we use in the tutorial supports also GPF and THOR. So you would need to upload your patch to the server and extract the data as done in the tutorial.

Q: Why should I use this if I use ROCharGen already?
A: You don't. Unless you are not happy with ROCharGen.

Q: Can I use this for other purposes instead of just rendering Player sprites?
A: Yes, for example you could use this for a database to automatically render sprites. You most likely don't want to use the FluxCP addon then but may reference it as an example.

Links
zrenderer repository: https://github.com/zhad3/zrenderer
zrenderer windows binaries: https://github.com/zhad3/zrenderer/releases
FluxCP addon repository: https://github.com/zhad3/zrenderer-fluxcp-addon
Setup tutorial to get it up and running on your server: https://github.com/zhad3/zrenderer-fluxcp-addon/wiki/Tutorials

Support
Only limited support. There are still some features open I haven't implemented but since I consider this project overdue I just released it as is now.
Regarding questions on how to setup I will only answer very specific questions referencing a specific step in the tutorial.

 

Have fun!

Edited by zhade
Expand on the "How do I use this" question
  • Upvote 3
  • Love 1
  • MVP 3
Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   7
  • Joined:  06/06/12
  • Last Seen:  

Hi, thanks for sharing your awesome project.
For some reason when i use curl i'm receiving the following message:

curl: (52) Empty reply from server

Docker Logs:

[main(----) INF] Listening for requests on http://localhost:11011/
Failed to listen on 0.0.0.0:11011

Docker PS :

CONTAINER ID   IMAGE                    COMMAND                CREATED          STATUS          PORTS                                           NAMES
27116789bf84   zhade/zrenderer:latest   "./zrenderer-server"   40 minutes ago   Up 22 minutes   0.0.0.0:11011->11011/tcp, :::11011->11011/tcp   zren

And my Docker version is 20.10.7
I'm using docker desktop for windows and WSL2. And i followed all the steps in the guide, except about grf extraction that i extracted the grfs without the tool provided by the guide.
Any clue about why this is happening?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   10
  • Joined:  11/12/11
  • Last Seen:  

Hey, thank you for trying it out!

[main(----) INF] Listening for requests on http://localhost:11011/
Failed to listen on 0.0.0.0:11011

This seems to be the problem. Unless you explicitly set the Docker network to share the same interface as your host (being able to connect through 'localhost') then it won't work. You can see that it failed to listen on '0.0.0.0'.

Can you try running the 'docker run' command with '-u root'?

Otherwise if you're on windows you may instead try to use the compiled binaries directly from the releases page: https://github.com/zhad3/zrenderer/releases
I should have mentioned that now that I think about it... You will need to change the zrenderer.conf accordingly. You can simply set the paths directly as they are on your harddisk.

Hope this helps!

Edited by zhade
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   7
  • Joined:  06/06/12
  • Last Seen:  

Thanks for your quick answer, i tried with root without success, but maybe is a windows issue and it works well on my linux VPS, i will see...
Otherwise the windows binary doesn't work for me =( ...
I'm executing this :

.\zrenderer.exe --job=1001

And i'm receiving this :

[CRITICAL] LuaResource (datainfo/accessoryid) does not exist.

This is how my zrender folder looks :
05b4306eb1de5bb557e418024f8a1541.png
And my zrender.conf :

; Output directory where all rendered sprites will be saved to.
; Default value: output
outdir=output

; Path to the resource directory. All resources are tried to be found within
; this directory.
; Default value: 
resourcepath=resources

Inside resources folder :
3308dbb45f1d0fcb3f6f426cd4d5b307.png
The path to "accessoryid.lub" is "zrenderer\resources\luafiles514\lua files\datainfo\accessoryid.lub".
And all the resources were extracted of course by zextractor.exe with the filters provided by the RESOURCES.MD

And finnally this is how my accessoryid.lub looks like :
 

ACCESSORY_IDs = {
	ACCESSORY_Goggle_ = 1,
	ACCESSORY_Cat_Hairband = 2,
	ACCESSORY_Glasses_ = 3,
	ACCESSORY_SPECIAL_0004 = 4,
	ACCESSORY_Flower_Love_Hat = 5,
	ACCESSORY_Old_Bandanna = 6,
	ACCESSORY_Turban_ = 7,
	ACCESSORY_Flu_Mask_F = 8,
	ACCESSORY_Hair_Band = 9,
	ACCESSORY_Diver_s_Goggles = 10,
	ACCESSORY_Biretta_ = 11,
	ACCESSORY_Assassin_Mask_ = 12,
	ACCESSORY_Pirate_Eyepatch = 13,
-- and more ... --

I tried to execute powershell as admin and still happens, i have no idea why this is happening since the file is there...
Thanks again for your time.

Edited by Waken
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   10
  • Joined:  11/12/11
  • Last Seen:  

1 hour ago, Waken said:

Thanks for your quick answer, i tried with root without success, but maybe is a windows issue and it works well on my linux VPS, i will see...

I have admittedly not tried docker on windows. I would need to investigate that myself, sorry.

 

1 hour ago, Waken said:

The path to "accessoryid.lub" is "zrenderer\resources\luafiles514\lua files\datainfo\accessoryid.lub".

This seems to be the issue. Try placing the resources in the 'data' directory so that the full path is 'zrenderer\resources\data\luafiles514\lua files\datainfo\accessoryid.lub'

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   7
  • Joined:  06/06/12
  • Last Seen:  

Hey!
Do not worry about windows on docker, this is gonna be used anyways on a host/vps.
Now it works perfectly, but there's an issue using some male hairstyles.
33.png.58148b55ace45dd80f40c7ac6ad36822.png
For the rest seems to work pretty well =D
 

33.png

33.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   10
  • Joined:  11/12/11
  • Last Seen:  

20 hours ago, Waken said:

Hey!
Do not worry about windows on docker, this is gonna be used anyways on a host/vps.
Now it works perfectly, but there's an issue using some male hairstyles.
33.png.58148b55ace45dd80f40c7ac6ad36822.png
For the rest seems to work pretty well =D
 

33.png

33.png

That seems odd. It doesn't happen on my end, also the chick headgear's color is off and the shadow different. Did you modify the images or is that how the program created them?

This is mine for comparison:33_head_4.png.4abe6d23cd2d18d63b141d8d2e005852.png

zrenderer --job=8 --action=33 --headgear=311 --head=4

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   7
  • Joined:  06/06/12
  • Last Seen:  

On 1/14/2022 at 6:32 PM, zhade said:

That seems odd. It doesn't happen on my end, also the chick headgear's color is off and the shadow different. Did you modify the images or is that how the program created them?

This is mine for comparison:33_head_4.png.4abe6d23cd2d18d63b141d8d2e005852.png

zrenderer --job=8 --action=33 --headgear=311 --head=4

 

The shadow is a custom one from my grf, and the headgear that i was using is a different one, about the hairstyles... maybe mines are modified to not have issues with palettes. Honestly i don't remember where i got them.
I upload it in case you want to check it out.

And i opened some issues that i'm having using zextractor, again thanks for your time!

4_³².rar

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   10
  • Joined:  11/12/11
  • Last Seen:  

On 1/16/2022 at 12:36 AM, Waken said:

The shadow is a custom one from my grf, and the headgear that i was using is a different one, about the hairstyles... maybe mines are modified to not have issues with palettes. Honestly i don't remember where i got them.
I upload it in case you want to check it out.

And i opened some issues that i'm having using zextractor, again thanks for your time!

4_³².rar 7.58 kB · 1 download

Thank you for providing the hairstyle. It was indeed a bug in the program. I have release a new version v1.3.2 which addresses that. Hope you give a try!

  • MVP 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...