L2jFrozen - Lineage 2 Interlude Source

Main Plaza => Guides => Topic started by: ruke on October 24, 2017, 04:17:12 PM

Title: Development workflow (hot deploy)
Post by: ruke on October 24, 2017, 04:17:12 PM
Note: I wrote this guide for l2jserver, but it should work the same for Frozen. Let me know if you run into issues.

Hi, I just recently started working on L2J and while I was implementing a few custom features in the server I found the development workflow quite awful since I had to make quite a lot of steps to actually see my changes: change the code -> compile -> update files -> shutdown server -> start server -> login again -> see the changes in game.

So, I wanted a change, I only wanted to follow these steps: change code -> compile -> see changes in game. And luckily I was able to accomplish it.

What do you need?
- A working server
- The sources of the l2jserver/frozen (obviously)

Steps

1 - In your source folder, you need the gameserver/config and gameserver/data folders from YOUR WORKING SERVER. You can do this by copying the folders or create a symbolic link so any changes you made to those folders are reflected without having to copy/paste again.

(https://i.imgur.com/d1awF6t.png)

2 - Download DCEVM (light) for Java 8u144 (build 2) (https://github.com/dcevm/dcevm/releases/download/light-jdk8u144%2B2/DCEVM-8u144-installer.jar)

3 - Download HotswapAgent (https://github.com/HotswapProjects/HotswapAgent/releases/download/1.1.0-SNAPSHOT/hotswap-agent-1.1.0-SNAPSHOT.jar)

4 - Download JDK 8u144 (http://filehippo.com/es/download_java_development_kit/64/77057/)

5 - Install JDK 8

6 - Open a command line with administrator permissions:

(https://i.imgur.com/lNWdbDd.png)

7 - In your command line, go to the folder where you downloaded DCEVM (light) for Java 8u144 (build 2) and run it:

Code: [Select]
$ cd path/to/your/DCEVM (light) for Java 8u144 (build 2)
$ java -jar DCEVM-8u144-installer.jar

8 - Once the application opens, select your JDK 8 and click Install DCEVM as altjvm:

(https://i.imgur.com/LLO8W2u.png)

Perfect, almost done!

9 - Open your IDE, and go to the Run configurations

(https://i.imgur.com/gX2KeSc.png)

10 - Complete with the following:

Name: GameServer Hotswap

Main class: net.sf.l2j.gameserver.GameServer (if you cannot find it, try searching for gameServer.GamesServer)

VM Options: -XXaltjvm=dcevm -javaagent:PATH\TO\hotswap-agent.jar

JRE: Make sure you have selected JDK 1.8.0.144

(https://i.imgur.com/Ed3rkxg.png)

11 - Go to your gameServer.GameServer class, and make sure the logs line are commented:

(https://i.imgur.com/YL6rOAQ.png)

12 - Start your loginServer as usual.

13 - Go to your IDE, and run GameServer Hotswap (from step 10)

14 - Your server should be up, try login with a character.

15 - If you succeed, perfect, now the exciting part, let's make a tiny change. Go to java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java class and add this line to runImpl method, in the line 108:

Code: [Select]
activeChar.sendMessage("Hello from HOTDEPLOY!");
16 - Save the file, and rebuild the project:

(https://i.imgur.com/zixj5Sm.png)

You should have a message that a class was updated.
Great, our change is already on, go to your server, login with a character and:

(https://i.imgur.com/YrmkZes.png)

Did you notice? no downtime!

Hope it helps. Happy to help if anyone cannot do it.

Have a good day.
Title: Re: Development workflow (hot deploy)
Post by: ReynalDev on October 24, 2017, 07:51:06 PM
Wow!! Nice guide but this only work when you are in development because in a real server (Production) doesn't have any sense install all those programs.  ;D
Title: Re: Development workflow (hot deploy)
Post by: ruke on October 25, 2017, 12:54:36 AM
Right, this is only for development ^^
Title: Re: Development workflow (hot deploy)
Post by: ReynalDev on October 25, 2017, 01:07:36 AM
Right, this is only for development ^^

Thanks for share!  ;)
Title: Re: Development workflow (hot deploy)
Post by: Nefer on October 25, 2017, 09:13:27 AM
Nice work, i always accept guide from our community.  ;)