Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] parsePacket to Lua! #1786

Closed
mokerhamer opened this issue May 10, 2016 · 5 comments · Fixed by #4043
Closed

[Feature Request] parsePacket to Lua! #1786

mokerhamer opened this issue May 10, 2016 · 5 comments · Fixed by #4043
Labels
enhancement Increase or improvement in quality, value, or extent

Comments

@mokerhamer
Copy link

mokerhamer commented May 10, 2016

As the title says.

We just load a .xml. Now instead of programming in c++ we can do it in Lua. i'm currently using a system displayed in the screenshots below and it works amazingly! I don't have to compile and rebuild and reboot server with every small change. I just reload lua (/reload gameprotocols)!
Currently i have the following working with this system.
*Premiumstore
*Equiphotkey

Example XML (Feel free to check out Premiumshop entry codes, the are annoying to track :) ):

image

Example coding, of opening premiumshop, feel free to take a good look at opening Premiumstore code :)

image

Short but powerfull!

My system was made by Milice, so full credits to him.

@marksamman marksamman added the enhancement Increase or improvement in quality, value, or extent label May 10, 2016
@ranisalt
Copy link
Member

ranisalt commented May 10, 2016

Lots of stuff could be offloaded to Lua. Problem is it would be too easy to mess and break a server - nothing that I care personally.

Hey wait, isn't it OTClient extended opcodes?

@HeavenIsLost
Copy link
Contributor

@ranisalt and what about performance? Luajit is good but does not operate miracles.

@ranisalt
Copy link
Member

As stated by @djarek once, the major bottleneck is spectators, so we probably can afford some performance hit. Maybe not for all networking, but surely some of it can be scriptable.

@marksamman
Copy link
Member

The major bottlenecks are: getSpectators, XTEA (IO thread probably spends 99% of its time doing XTEA encrypt, it either needs heavy optimizations using vectorization or we should support multiple IO threads), Map::getTile, heap allocations/deallocations, pathfinding and item attribute lookups. As long as these things aren't done in Lua, you can probably implement everything else without a noticeable difference if you're running LuaJIT. The most significant performance hit is going to be from increased heap allocation/deallocations by using Lua.

I agree that this is a powerful concept, and this is similar to how TFS 2.0 would probably be designed, where every packet would be handled in Lua.

@ghost
Copy link

ghost commented Nov 26, 2020

#2978

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Increase or improvement in quality, value, or extent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants