Sunday, June 8, 2025

How to host your own Dusk Server with Cheerpj and Tailscale VPN

I thought I'd do a write up on how to setup your own server. I haven't got Cheerpj working 100% yet but I think it's possible it will work.

1. Download https://github.com/ZabinX/DuskRPG go to (code) click "Download ZIP".

2. Install Tailscale https://tailscale.com/ Go into "machines" and click "..." change the machine name to something like "dusk". Then go into "DNS" tab and use the random name generator to get a better Tailnet name. Generate 2 authentication keys like this. Go to "settings" tab, then "keys", then "generate auth key...", then click button for "use this key to authenticate more than one device", and then finally "generate key". Put one key in "Server.html" the other in "client.html" in the /DuskServerClientCheerpj directory and /wwwClient.

3. Edit the "prefs" file inside /DuskServerClientCheerpj/conf. Change 'dusk.comet-richter.ts.net" to "yourmachine.yourTailnet.ts.net". 

4. Command prompt (cmd): cd C:\Users\drago\Documents\DuskServerClientCheerpj

http-server -p 8080

5. Visit "127.0.0.1:8080/" in a browser and click "Server.html" to start the server.

6. Another command prompt: cd C:\Users\drago\Documents\DuskServerClientCheerpj\wwwClient

http-server -p 8081

7. Administrator command prompt: 

tailscale funnel 8081

8. Go to your new website and click "client.html" to start the game. Connect to server using the server machine IPv4 address (make sure the server is finished loading and "ready for connections").

That's it! Pretty easy. Here's couple pics from my Android phone almost working. I will have to fix the GUI layout for mobile a little but that's easy.



Wednesday, May 28, 2025

Dusk and Cheerpj test?

I got the server and client working with Cheerpj and Tailscale enough to create a player and almost load the map but it disconnects from error loading player. So not working yet but is pretty cool to see that much happening on my android phone.

I don't know if Cheerpj can handle the Dusk script.java which generates these ".dsko" compiled files. That could be causing these errors. Here's link to the java for running DuskServerCheerpj. 

https://github.com/ZabinX/DuskRPG/tree/master/DuskFiles/DuskServerSourceCheerpj

https://github.com/ZabinX/DuskRPG/blob/master/DuskFiles/DuskServerSourceCheerpj/Script.java 

**Update** It's in read only mode. The fix is "library mode" which will copy the files into the virtual IndexedDB directory, which is read/write. This takes some JavaScript combined with Java libraries.

Friday, May 16, 2025

Dusk + Cheerpj = revived?

Hey again, :)

I've almost finished the demo world! Pixel art is all sourced from OpenGameArt, craftpix.net, and Jetrel gets huge thanks for his tree. I felt motivated to work on Dusk again when I saw this new tech to convert Java to JavaScript called Cheerpj. Dusk can possibly be revived! I think the performance may be fine.

I need help with this Cheerpj conversion. I'll post in their discord and maybe somebody can help or give advice what I need to do. 

I believe both client and server need to run through Cheerpj but I'm not 100% sure how to proceed. I'm like a 2/10 in Java, 0/10 in JavaScript, and 9/10 in coding DuskScript. Here's the links to my Cheerpj tests.


Here's source code.

Please forgive my nearly 200MB Dusk collection. There are a couple old game worlds in there. I will clean it up and finish licensing art.

I think I need a little JavaScript help, make changes in Java to find the file locations and maybe even a native call to Java_Bridge_Websocket for the server? To avoid using TailScale. I'm guessing here, I read all the docs and there's not enough examples for me, but this is fancy new tech still in development. Here's a pic of Dusk client in browser using Cheerpj.



If you have noticed I redone the GUI with swing components. I managed to do this by digging through the wayback machine. I found the sources https://web.archive.org/web/20010617163439/http://dusk.wesowin.org/ and merged them with the fork I had. This fixed some bugs, and I also merged some code from NotZed's fork to improve the walking animation. I've added buttons for potions, spells, and settings. I'm still improving the GUI and will probably change size to better fit into browser if Cheerpj can do it.

If you have Java installed u can play offline.
Run server with java -cp . DuskServer or java -jar Duskserver.jar
Double click the client in (www)
Click connect: 127.0.0.1 port 7474. Connect and create a player.

Take care, bye -Zach