Jump to content

Event Engine


Recommended Posts

I wanted my event engine to be fully controllable by the individual XML files, all good until the complexity of the XML grew to a level that its very hard to debug the parser and add more features. So I came up with the idea of the Script tag that can do many things with a simple code.
 

New Update

 

v5.1 (Beta) new tags: Script

 

Scripts in this EventEngine can be any language the user wants (python, java, javascript, scala, etc)

 

A quick preview of the XML:

 

ZW3BH7I.png

 

 

The hook attribute will hook your code where you want automatically, its self explanatory.

 

call by id example:

 

cb9pOM8.png

 

 

 

Made this topic to get the point of view of customers (users) and other developers...

 

//discuss

Link to comment
Share on other sites

  • 2 weeks later...

That scripts thing is just way too much now.

Any developer in this case will prefer to extend a class and make methods as he likes to. Its just way easier to read/understand.

Any non-developer will not even have the slight idea what to do in this case and how to use such scripts in xml...

 

ThugEscape::legitimateKill($any, $thug)

... I don't have the slight idea what this method is, where it is called and what are those variables... Imagine how it looks to the regular person.

 

I suggest you to make it so people extend AbstractEvent in scripts folder and they change the preferred methods as they like. Current way needs to make scripts anyway and I cannot imagine a case where im going to use the same script for 2 or more events, unless Im too lazy and I make copy-paste redundant events. Basically just point out what "script AI" (sub-classes of AbstractEvent) the event is going to use, and forget about 123123 hooked scripts to methods to wtf... I think people are used to changing at least constants in scripts, so you can make a set of pre-done scripts with given constants. Maybe you can add an exception to change constants of chosen script from XML, but that's as far as I suggest you to go.

Link to comment
Share on other sites

That scripts thing is just way too much now.

Any developer in this case will prefer to extend a class and make methods as he likes to. Its just way easier to read/understand.

Any non-developer will not even have the slight idea what to do in this case and how to use such scripts in xml...

 

ThugEscape::legitimateKill($any, $thug)

... I don't have the slight idea what this method is, where it is called and what are those variables... Imagine how it looks to the regular person.

 

I suggest you to make it so people extend AbstractEvent in scripts folder and they change the preferred methods as they like. Current way needs to make scripts anyway and I cannot imagine a case where im going to use the same script for 2 or more events, unless Im too lazy and I make copy-paste redundant events. Basically just point out what "script AI" (sub-classes of AbstractEvent) the event is going to use, and forget about 123123 hooked scripts to methods to wtf... I think people are used to changing at least constants in scripts, so you can make a set of pre-done scripts with given constants. Maybe you can add an exception to change constants of chosen script from XML, but that's as far as I suggest you to go.

 

Yeah, I totally agree with you its again complicated, but I've created this Script support to counter big and complex events. For example a survival map with dozens of timers, doors, new npc spawns etc.

 

By attaching a script on the event's template and reloading it with a simple //reload events command made my life easier for very complex and huge event scenarios, but again it counter attacks itself with complexity...

 

ThugEscape::legitimateKill($any, $thug) calls the legimitateKill method from ThugEscape class if and only if the second parameter is the thug instance (L2PcInstance object in this case)

 

public void legitimateKill(final L2PcInstance killer, final L2PcInstance victim)

 

 

Complicated but still a good tool.

 

But the most important reason I've added script support to the event template is that as you can attach multiple templates on a single AbstractEvent child, for example Escape.java

 

you can create two different events that use Escape.java class for example; both events are handled from the same java class BUT they are different because the template and each template's scripts are different.

Link to comment
Share on other sites

At this point of configuration, better open and edit directly the file with Eclipse, no ? It's a bit overkill.

 

Those ThugDied and ThugPicker (which I suppose could be based on regular quest listener onDeath / onKill) are that fat they need their own file ?

Edited by Tryskell
Link to comment
Share on other sites

Well, do as you like, but I suggest you to keep things simpler. Even if you are good developer and this complexity is ok for you, its still abnormally complex in my option. At some point this complexity will go against you, and cause you to get confused more often than it should. Even if you comprehend it now, it doesn't mean you will always comprehend it without mistake. Chinese people created their traditional language very complex but very robust, now many Chinese are unable to learn that language and learn simplified instead :D

Link to comment
Share on other sites

I totally agree with your points, but as I said before the main purpose was not to counter complexity, but to extend the templates of the events.

 

 

3lq8JZ8.png

 

Each template can be individually unique regardless of the class it extends... Look at this example, RuneCastleSurvival and GoddardMassacre are both handled by the java class Survival, but they are much different due to configuration in their XML (The template)

Link to comment
Share on other sites

Well I don't have general idea of the structure of this event engine, so I can't say anything.

What is the point of "all in XML" thing if only you can understand it?

 

Imagine a server with a shitload of different and unique event templates. Would it ever get boring?

Link to comment
Share on other sites

Yes, so far with my experience, players don't tend to like shitload of events thrown in their face. Most of them just get confused when there are more than a handful of events. Unless you are able to present that many events nicely, players won't pay much attention to the different kinds of events. You either make a handful of strongly different events, or make basic event templates like TVT and give different objective each time to the event. In this case your XML thing will be the most useful, but again, if I have to make 5 different XML templates for the same TVT event with 5 different mini-objectives, it just sucks.

Link to comment
Share on other sites

Imagine a server with a shitload of different and unique event templates. Would it ever get boring?

 

Generally events follow some "trends", the point is to abstract it to a maximum (team distribution, spawn system, attackable status, reward, etc), and then gather all "shared" methods over a sort of commons package.

 

Basically, even with the simple Quest.java, you can already do a lot, so I tbh don't get what you need to add more. All retail events from L2 can be handled by its children, LongTimeEvent. If your event needs a complex scripting, it's maybe it's simply too complex (sounds stupid to say that, but well...). You can handle a lot of "on the fly" behaviors using memos (npc/server/player) and isScriptValue() / setScriptValue() for NPC.

 

Well without an specific exemple of what you try to achieve you couldn't do it without your system, it's hard to believe it's that useful. Until you're the only one to XML config it but then the whole thread shouldn't be a problem :P.

Link to comment
Share on other sites

I have to disagree Tryskell, Quest.java, at least L2J version have a shitload of nonsense and limitation (onKill/onAttacked triggered for Attackable only for instance) while LongTimeEvent is just a piece of useless shit

Link to comment
Share on other sites

By using Quest.java Im commiting on being compatible only with the Project fork I've coded it, thus it requires lots of adaption to work on another chronicle. What if I want to adapt it on a project where Quest.java doesn't exist or if its totally different? Things get messed up.

 

My architecture now is:

 

Events Core Library (compiled) -> Events classes and xml templates (source) -> Driver Interface (compiled or not) -> Any Project (compiled or not)

 

And really solves my hands in terms of addapting cause I only need to create Driver Interfaces for different project which is an easy and fast task

Edited by xxdem
Link to comment
Share on other sites

onKill/onAttacked triggered for Attackable only for instance

 

It's only a matter to cut/paste 2x6 lines of codes, from one class to another (or simply rework the system of listener and put everything on L2Character level). About LongEventTimer, I use my personal SheduledQuest (which is probably as shitty as, but well), so i can't say.

 

@xxdem, the idea wasn't to reuse Quest.java, at all, but just tell you than most of needed methods already exist. Which doesn't explain your need of code complexity, as most if not all can already be handled by shitty stuff as Quest.java.

Edited by Tryskell
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.
Note: Your post will require moderator approval before it will be visible.

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.



  • Posts

    • WTS Gold bars reborn interlude x10   discord : xeenthekeen
    • Guys, if you'd let me be the bearer of bad news, No amount of "break from server development" can justify your complete lack of idea how things work. If it was this easy, you should've been seeing 90% of the servers of the popular old versions, such as IL and HF, running on the newest client. For this task, you would need a lot of time - think at least 2 months, if you can code, have access to all the necessary tools for client development, and you have a relatively good idea of how server<->client communication works. f you don't, then you either find yourself a well-paying job and find someone who would do it for you or you put the idea aside (for no less than 1-2 years) and start reading and learning asap. Let me give you a little preview/breakdown of what some of the work includes. The work can be split into two parts - SERVER side and CLIENT side.  The server and the client communicate through packets. Each of these packets has a defined structure. Both, the server and the client MUST know this structure and MUST use the same structure, otherwise they won't be able to "understand" each other. - The server side predominantly includes the alteration of existing packet structure and the creation (from zero) of missing packets that the client requires. Then you also have to take these changes into account and alter the existing features of your server to match the changes. A good example for this is SKILL ENCHANTING. On older chronicles, the enchant level is determined by the LEVEL value of the skill and on the new clients, it has been taken out into a separate value. What this means is that you would have to figure out a way to adapt the old system to the new requirements. - Now that we mentioned the client, you would also need to edit a bunch of files, such as Interface, UTX, UNR, as well as DAT files, including those related to ITEMS, SKILLS, QUESTS, NPCS, and AUGMENTATION STATS and DESCRIPTIONS, etc. For some of those, you would also have to figure out how to check for missing entries and how to parse data from the older client to the new. The best example, again, would be the SKILLS. On the latest clients, the skill enchanting was limited to only +20. As such, even if there were some matching skills between the two different client versions, you would still need to add the missing 10 levels to +30. And once you complete all of that, you start testing and fixing bugs and sh1t. And once you have fixed all of that, you can start adding new features from the new client, because otherwise it would be one big mess and a waste of time and/or money.
    • As far as I know, these are not linked to the server. What I mean by this is - there is no server <-> client communication for these two features. If that is indeed the case, you would need the Interface sources in order to create a custom function which you can trigger with a SERVER_TO_CLIENT packet.
    • Hello, I recently Installed the h5 Interface from emu-dev   Everything is working great but i was wondering if anyone can help me add the monster book and item book buttons on my community board to make it more accessible. Or if there is a way to add a button with HTML that calls these windows. I have xdat editor installed and i have located the relevant windows, but i don't know what to do with them. Thank you for your time.  
  • Topics

×
×
  • Create New...