Jump to content
Haru

[2015-12-31] FAKE_NPC and the NPC View ID -1

Recommended Posts

Rationale:

This is part of the NPC scripts standardization project. In the past, NPCs were defined with numeric View IDs, while now we've replaced most of them with more human-readable (and as such easier to maintain) constants - the same constants that AEGIS scripts use, making the numeric IDs obsolete (and deprecated).

 

Contents:

When the NPC View IDs were converted to constants, the only leftover was the special ID '-1' we use for invisible / floating NPCs, that didn't have an equivalent constant defined at the time.

This changeset defines a constant 'FAKE_NPC' for it, and replaces all the '-1' view IDs with the new constant.

The exception for the -1 case is removed from the code (making it effectively deprecated, just like the other numeric IDs).

 

Impact:

The impact of this changeset on custom scripts is low. All old code will still work (but it'll throw a deprecation warning).

It's recommended to update all the affected code as soon as possible - the support for the old style IDs may be removed from the code at any time in the future (after at least a month from the commit).

 

Details:

The use of the sprite ID '-1' in NPC headers to specify an invisible NPC is now deprecated. 'FAKE_NPC' should be used instead. This affects all NPC types (script, shop, trader, duplicate, etc)

/* Before: */
-	script	TurboTrap#tt_main	-1,{
	// ...
}
in_moc_16,65,162,0	duplicate(SinTrap)	02_2	-1,0,0
 
/* Now: */
-	script	TurboTrap#tt_main	FAKE_NPC,{
	// ...
}
in_moc_16,65,162,0	duplicate(SinTrap)	02_2	FAKE_NPC,0,0
Merge Date:

Thu, 31 Dec 2015 23:40:48 +0100

 

Related Pull Requests:

- #1000 - https://github.com/HerculesWS/Hercules/pull/1000 - define FAKE_NPC as -1 in const.txt [AnnieRuru]

 

Related Commits:

- ef171a8 - https://github.com/HerculesWS/Hercules/commit/ef171a8 - Mon, 21 Dec 2015 19:59:38 +0800 define FAKE_NPC as -1 in const.txt [AnnieRuru]

- efaaf84 - https://github.com/HerculesWS/Hercules/commit/efaaf84 - Mon, 21 Dec 2015 20:12:45 +0800 Replace -1,{ with FAKE_NPC,{ replace using Notepad++ [AnnieRuru]

- b4c99db - https://github.com/HerculesWS/Hercules/commit/b4c99db - Tue, 29 Dec 2015 02:16:49 +0100 Replaced leftover -1 view IDs with FAKE_NPC [Haru]

- 32a42ee - https://github.com/HerculesWS/Hercules/commit/32a42ee - Tue, 29 Dec 2015 02:17:26 +0100 Extended the numeric view ID deprecation to '-1' (FAKE_NPC) [Haru]

- 0e99004 - https://github.com/HerculesWS/Hercules/commit/0e99004 - Thu, 31 Dec 2015 23:40:48 +0100 Merge branch 'AnnieRuru-request_29' into hercules [Haru]

 

Trivia:

Commit efaaf84 was done with a find and replace in Notepad++, to globally replace '-1' view IDs with 'FAKE_NPC' (as described in the commit notes).

Commit b4c99db caught the leftovers (less common cases where the -1 is not followed by ',{'), and was powered by vim macros and grep (and vimgrep). It also features manual clean up of trailing whitespace or extra tabs in a small subset of the affected lines.

Share this post


Link to post
Share on other sites

Not intentional, I'll look into it

 

Okay, checked. The reason is that we don't parse the view ID, if the shop NPC is floating. I'll probably change that (I believe it's a good idea to enforce the syntax more strictly, to avoid unexpected issues later)

Share this post


Link to post
Share on other sites

I'm not sure if It's good idea to delete server's ability to read NPC sprites as numbers, because, personally, for me, it has more readability than those names. im not sure how to explain it properly, but I like old variant.

Share this post


Link to post
Share on other sites

@@Oxxy 49 66 20 79 6F 75 20 70 72 65 66 65 72 20 72 65 61 64 69 6E 67 20 6E 75 6D 62 65 72 73 20 74 68 61 6E 20 77 6F 72 64 73 2C 20 6E 6F 74 68 69 6E 67 20 70 72 65 76 65 6E 74 73 20 79 6F 75 20 66 72 6F 6D 20 64 65 66 69 6E 69 6E 67 20 74 68 6F 73 65 20 6E 75 6D 62 65 72 73 20 61 73 20 63 6F 6E 73 74 61 6E 74 73 2C 20 62 79 20 65 64 69 74 69 6E 67 20 63 6F 6E 73 74 61 6E 74 73 2E 63 6F 6E 66 2E. Sarcasm aside, it's just ASCII codes. If you decode it, it contains a solution that should work for you.

 

@@vykimo If you're not pleased, you can use any other emulator. We provide both content updates and architecture modernization, and we will keep doing so as long as the project lives. If you want to stick to the early 2000's coding practices *and* use Hercules at the same time, then feel free to make your own fork, and undo the changes you don't like. As you can see in my post, I specified the related commits, so they're easy to revert.

Share this post


Link to post
Share on other sites

@@Oxxy

use this tool to convert what Haru just said XD

http://www.asciitohex.com/

 

 

EDIT: the reason why we can't fix some bugs is because we have a very crappy and messy coding format in the source code

when we directly fix the bugs, most of the time, is just a temporary measurement

 

to permanently get rid of the bugs, the 1st step is of course make the source code have higher readability

 

only a good structure code and a readable coding style that understood by many users, can help make our emulator less bug

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

@@Oxxy 49 66 20 79 6F 75 20 70 72 65 66 65 72 20 72 65 61 64 69 6E 67 20 6E 75 6D 62 65 72 73 20 74 68 61 6E 20 77 6F 72 64 73 2C 20 6E 6F 74 68 69 6E 67 20 70 72 65 76 65 6E 74 73 20 79 6F 75 20 66 72 6F 6D 20 64 65 66 69 6E 69 6E 67 20 74 68 6F 73 65 20 6E 75 6D 62 65 72 73 20 61 73 20 63 6F 6E 73 74 61 6E 74 73 2C 20 62 79 20 65 64 69 74 69 6E 67 20 63 6F 6E 73 74 61 6E 74 73 2E 63 6F 6E 66 2E. Sarcasm aside, it's just ASCII codes. If you decode it, it contains a solution that should work for you.

 

@@vykimo If you're not pleased, you can use any other emulator. We provide both content updates and architecture modernization, and we will keep doing so as long as the project lives. If you want to stick to the early 2000's coding practices *and* use Hercules at the same time, then feel free to make your own fork, and undo the changes you don't like. As you can see in my post, I specified the related commits, so they're easy to revert.

Then could you define them together with release, because I don't think they will be so useless, not only me is using them instead of constants, because you gotta look up for those constants every time, and numbers were used since forever :)

Share this post


Link to post
Share on other sites

The constants don't need to be looked up, since they have somewhat of a meaning (they already tell you if a NPC is a man, a woman, an animal, a monster or a thing for example, and they describe in a way or another what it looks like). Numbers on the other hand, are just numbers, and don't have any descriptive meaning. It's discouraged to use numbers, since they're too easy to mistake (and several errors in the past, both in scripts and in source, were caused by misplaced numbers, very hard to detect while reviewing code)

Share this post


Link to post
Share on other sites

Honestly not really in favor of the idea of deprecating the use of IDs :/ I was the one that was pushing for script standardization originally.

I released the first const use in place of sprite IDs.

 

But that change was not meant to become a mandatory thing. Users should not be forced to use constants in place of IDs if they don't want to.

 

Consts reference the IDs anyways, so eliminating the ability to use direct IDs just really doesn't make sense.

 

It's in the same sense of script commands like getitem, delitem, specialeffect, skill, etc. We encourage the use of constants but in no way should it be mandatory.

 

A better solution instead of straight up deprecating it would be to create an official scripting style guide and encourage the user of constants over the IDs, but don't require users to have to use them. If users will be contributing to the repository they should follow the style guide / use constants, but if they're making their own scripts they should be allowed to use either.

 

Constants should be optional always for these situations.

Share this post


Link to post
Share on other sites

Oh come on everyone, where have you all been during the past 7 months? I mean, there's been a warning since June, when a NPC was using a number instead of a constant (the only thing that changed now is that it's extended to the '-1', everything else was already changed last June)

Share this post


Link to post
Share on other sites

When NPCs were using IDs, we all had to learn the IDs of the NPCs and I bet not everyone, still to this day, knows ALL the NPC IDs by heart. Now that the NPCs are constants, it'd be the same way like it was back in the day; learning.

 

Yeah I know it'll take some time to learn new things, but what's the point staying back in the olden days?

Share this post


Link to post
Share on other sites

@@Oxxy 49 66 20 79 6F 75 20 70 72 65 66 65 72 20 72 65 61 64 69 6E 67 20 6E 75 6D 62 65 72 73 20 74 68 61 6E 20 77 6F 72 64 73 2C 20 6E 6F 74 68 69 6E 67 20 70 72 65 76 65 6E 74 73 20 79 6F 75 20 66 72 6F 6D 20 64 65 66 69 6E 69 6E 67 20 74 68 6F 73 65 20 6E 75 6D 62 65 72 73 20 61 73 20 63 6F 6E 73 74 61 6E 74 73 2C 20 62 79 20 65 64 69 74 69 6E 67 20 63 6F 6E 73 74 61 6E 74 73 2E 63 6F 6E 66 2E. Sarcasm aside, it's just ASCII codes. If you decode it, it contains a solution that should work for you.

 

@@vykimo If you're not pleased, you can use any other emulator. We provide both content updates and architecture modernization, and we will keep doing so as long as the project lives. If you want to stick to the early 2000's coding practices *and* use Hercules at the same time, then feel free to make your own fork, and undo the changes you don't like. As you can see in my post, I specified the related commits, so they're easy to revert.

I was in bad mood and sorry if I was a bit aggresive

But what I meant is that changes like this are totally invisible for players and you have to understand that players' community of Ragnarok Online is decreasing years by years. Today it reached its worse point ever.

 

Hercules is actually the best emulator for stability and exactness with official content : I work on hercules everyday and I thank dev every single day for the cleanliness of source code.

NOW, official content takes very long time to come and you probably will understand that Ragnarok is nothing without players, thus hercules too.

And I care most about Ragnarok pServ/Hercules' community than using constants instead of integers.

 

That's all I wanted to say just before.

Edited by vykimo

Share this post


Link to post
Share on other sites

That's certainly true, the RO population is declining and all, but please understand that Hercules has very little to do with the number of players playing the game.

 

I'm not here to implement the latest NPCs or to obtain information from official servers (I don't even have an account on official servers, nor I have access to any inside information or leaks), but you can't deny that other developers in the Hercules team are constantly adding new features or adapting to game mechanics changes. My role here is to oversee the development, review code, and bring architectural improvements when they're necessary.

 

Please also keep in mind that, while Hercules is mostly a Ragnarok Online emulator, it provides a foundation that can be used with other games (see The Mana World / evol online for an example).

Share this post


Link to post
Share on other sites

One of the goals of *Athena (Hercules was forked from rAthena which was forced from eAthena which is forked from jAthena...etc) is to closely emulate the official server(s) as possible. This includes databases, NPC's and yes, source and NPC code structure (with obvious modernization such as not using 96GB of RAM and Windows only to run). This change most closely follows that original goal.

Share this post


Link to post
Share on other sites

 

@@Oxxy 49 66 20 79 6F 75 20 70 72 65 66 65 72 20 72 65 61 64 69 6E 67 20 6E 75 6D 62 65 72 73 20 74 68 61 6E 20 77 6F 72 64 73 2C 20 6E 6F 74 68 69 6E 67 20 70 72 65 76 65 6E 74 73 20 79 6F 75 20 66 72 6F 6D 20 64 65 66 69 6E 69 6E 67 20 74 68 6F 73 65 20 6E 75 6D 62 65 72 73 20 61 73 20 63 6F 6E 73 74 61 6E 74 73 2C 20 62 79 20 65 64 69 74 69 6E 67 20 63 6F 6E 73 74 61 6E 74 73 2E 63 6F 6E 66 2E. Sarcasm aside, it's just ASCII codes. If you decode it, it contains a solution that should work for you.

 

@@vykimo If you're not pleased, you can use any other emulator. We provide both content updates and architecture modernization, and we will keep doing so as long as the project lives. If you want to stick to the early 2000's coding practices *and* use Hercules at the same time, then feel free to make your own fork, and undo the changes you don't like. As you can see in my post, I specified the related commits, so they're easy to revert.

I was in bad mood and sorry if I was a bit aggresive

But what I meant is that changes like this are totally invisible for players and you have to understand that players' community of Ragnarok Online is decreasing years by years. Today it reached its worse point ever.

 

Hercules is actually the best emulator for stability and exactness with official content : I work on hercules everyday and I thank dev every single day for the cleanliness of source code.

NOW, official content takes very long time to come and you probably will understand that Ragnarok is nothing without players, thus hercules too.

And I care most about Ragnarok pServ/Hercules' community than using constants instead of integers.

 

That's all I wanted to say just before.

 

sorry but the population is not decreasing because people improve a opensource project or not.

the population is decreasing because the whole scene became toxic.

 

every kid wants money for their work today, they want to get payed for every small shit bit.

the community does not care for quality. they prefer to go to a 1.1k populated server who crashs everyday and which is money making oriented with a damn bad quality, instead of joining a server where they offer nearly everything for free and where the admins knows how to fix bugs to keep a full server alive without crashes.

 

this community don't die because of the devs of Hercules or RAthena, it dies because of the stupid greedy admins who open one server after the other to make money and milk the people.

flame them, not Haru and the others.

 

Topic related: Nice changes, took me quiet some while to merge to the newest level, but was worth it.

Share this post


Link to post
Share on other sites

Does not matter when you got a list

Don't need to remember the ids, don't need to remember the names, you gonna look and copy paste anyway, kek

Share this post


Link to post
Share on other sites

if you do typo in id, it will works

if you do typo in name, it will show error.

Share this post


Link to post
Share on other sites

When WILL Hercules will be support 2015 client i mean fully support* @@Haru sorry for posting out of topic. 

I just need the fully function of client 2015-10-29a :D

Share this post


Link to post
Share on other sites

When WILL Hercules will be support 2015 client i mean fully support* @@Haru sorry for posting out of topic. 

I just need the fully function of client 2015-10-29a :D

Please don't use this topic as a means of inquiry outside topic's trajectory (scope). Meaning, don't ask questions regarding clients in a topic like this that talks about a NPC structure change. Nor is it advised to ask support questions in this topic as it is just used as an announcement.

 

Thanks.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.