HerculesWS / Hercules

Hercules is a collaborative software development project revolving around the creation of a robust massively multiplayer online role playing game (MMORPG) server package. Written in C, the program is very versatile and provides NPCs, warps and modifications. The project is jointly managed by a group of volunteers located around the world as well as a tremendous community providing QA and support. Hercules is a continuation of the original Athena project.
http://herc.ws
GNU General Public License v3.0
901 stars 759 forks source link

[Suggestion] Adding script command to listen for and sending through TCP #1511

Closed didasy closed 7 years ago

didasy commented 8 years ago

Like the title says. This would open great opportunities into creating a more flexible NPCs.

Like if someone want to look up external database through a service to determine the action of the NPC, they could simply communicate with said service through TCP.

In the meantime, I will try to add new script commands for this for a PR. But I would be glad too if you guys really pick this feature up before me doing it myself.

Thanks.

dastgirp commented 8 years ago

Don't know what to say, but having a script command is kinda limited, I believe direct coding from c would be more open and could do much more thing than via script. Moreover, the latency and delay for accessing external services would be high and interacting with npc would make it somewhat boring and time wasting. However, that's my opinion, and if there's some useful case then I am for it.

didasy commented 8 years ago

Direct coding from C would be more limited to the server operator if one want to make a more dynamic NPC. Not everyone understands C.

Latency and delay would be negligible as long as it is below (IMO) 100ms, which will be no problem if the external service sits right on the same network (usually, same machine) as Hercules.

Interacting with NPC experience is a subjective matters. Not everyone plays RO just to have fun with their friends, some also want to do RP.

This is my opinion anyway. Thanks for your response.

dastgirp commented 8 years ago

Any examples ? So as I could personally think about the commands needed, while waiting for feedbacks from other devs..

didasy commented 8 years ago

Examples for a scenario or usage?

For scenario: I imagine a dynamic event (also dialogue) NPC that will spawn boss or monsters or giving items or giving quest and quest requirements based on external parameters and without having to restart the server or use @reloadscript to apply. I realised you can do this through query_sql but I think it would be better if I don't clutter the database with more junk and add more load to it. This is just an example, but I think the possibility is endless.

For usage, I was thinking about 2 commands:

4144 commented 8 years ago

@JesusIslam you cant use any blocking sockets api. Or server can be locked completly in your script. This mean you can use sockets only in async way, like hercules using it. And this mean tcprequest as you show it make no sense you should use labels for trigger event for receiving data or socket status.

btw query_sql not safe too. It may lock server too.

You can replace @reloadscript to some admin npc what will set/change any parameters

Ridley8819 commented 7 years ago

Closing this since this is dead for half a year. Also 4144 and Dast stated pretty much everything.