The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combat engine / Targetted Hit
Author Message
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #1
Combat engine / Targetted Hit
This week I'm taking a look on sphere internal combat engine to make many optimizations/improvements, and for my surprise, I found an reasonable big code about some features that honestly I think it must be done by scripts and not hardcoded:
  1. the COMBAT_TARGETTEDHIT setting on sphere.ini, which will force the char hit an targetted region of the body (head/foot/...)
  2. the internal "hit location" messages, which are just messages like "You hit someone on the head/foot/..." and doesn't make any difference on the real damage
  3. the old [Physical/Fire/...]DAMAGE behavior which add an aditional damage for each *DAMAGE used. Note that we already have a new DAM[Physical/Fire/...] which this one works correctly as it should be, it will split the base damage into different types and use RES[Physical/Fire/...] to resist each one. The idea is remove the old *DAMAGE and use only the new DAM*

I think these 3 features can be removed from the internal source, it will make the combat code much more clean and optimized (in other words: lightweight / fast), and if someone still want these features, it can be done on script-side without any problem. The main idea is optimize the code making it lightweight, and if someone want aditional damages, formulas, etc, it can be done using scripts

so the question is: someone still using these features? If yes, there's any problem to move it from hardcoded to scripts?
(This post was last modified: 01-21-2015 11:20 AM by Coruja.)
01-19-2015 11:39 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Combat engine / Targetted Hit
Maybe this is not related:
In the @gethit trigger, ARGN1 holds the value of the "raw damage" (in the case of physical damage, that's the damage before armor calculation), it will be possible to get the "real damage" (so the one that appears in the pop-up damage above the character) in a new trigger/variable?

The current "work-around " for this, is to apply dam_god or dam_fixed to argn2 in @gethit.
(This post was last modified: 01-20-2015 01:33 AM by darksun84.)
01-20-2015 01:32 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #3
RE: Combat engine / Targetted Hit
I don't care about this hardcoded thing.

My combat systems always have ARGN2 = 01 (dam_god) which means I control the real damage applied on the chars.

Also the targeted hit system is useless. I never ever seen this system working in any shard I played before.

But these stuff should be moved to scripts, yes.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
01-20-2015 01:40 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #4
RE: Combat engine / Targetted Hit
yep, on the new engine @GetHit will return the real damage value on ARGN1 (instead return the base damage before apply any bonus/armor calculation). Also the client status gump will show the real damage that the char can deal (instead show only the base damage), and some others improvements
01-20-2015 03:27 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #5
RE: Combat engine / Targetted Hit
Wait, you gonna change the @GetHit?

Please, don't mess with it! If the 'problem' is the targeted hit, just remove this. Don't change how @GetHit works.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
01-20-2015 05:42 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: Combat engine / Targetted Hit
Yes for avoding conflicts the "real damage" should be held in another variable in @gethit (argn3 ? or a new local? or maybe a completelly new trigger that fires after @gethit ? Or a ini flag ?)
01-20-2015 05:56 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #7
RE: Combat engine / Targetted Hit
the combat engine have 2 parts: one calculate the attack damage (@Hit), and the other one (@GetHit) will apply armor calculation over this damage -already defined before- by @Hit

but the problem of the current engine is that it doesnt follow this rule, it still calculate the damage value even when applying the armor calculation (where the damage value must be already set, not in progress), and @GetHit is called even when the armor calculation still unfinished

so the only difference is that @GetHit now will be called at the right moment (after the armor calculation, and not before), nothing more. The real damage -before- armor calculation still fully acessible on @Hit, which is where all damage values are calculated. And @GetHit will just apply armor calculations over this damage value already defined before on @Hit

the call sequence is something like this:
1) sphere does all damage calculations and call @Hit (ARGN1 is exactly the real attack damage including all damage bonuses)
3) now apply armor calculations and call @GetHit (ARGN1 is exactly the final damage that the char will get)
(This post was last modified: 01-20-2015 08:45 AM by Coruja.)
01-20-2015 08:37 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes Coruja's post
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #8
RE: Combat engine / Targetted Hit
Really, leave this. Don't messy the system.

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
01-20-2015 10:07 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #9
RE: Combat engine / Targetted Hit
I actually like the idea, what about adding a flag in the .ini for keeping/enabling the old/new behaviour ?
(This post was last modified: 01-20-2015 10:24 AM by darksun84.)
01-20-2015 10:20 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #10
RE: Combat engine / Targetted Hit
(01-20-2015 10:20 AM)darksun84 Wrote:  I actually like the idea, what about adding a flag in the .ini for keeping/enabling the old/new behaviour ?
since no behavior was really changed I think we doesn't need new flags, all changes are just improvements/optimizations

if you like the "old" sphere internal engine, it will be the same as always, but now running on a fast and lightweight code. And if you're using new combat features (COMBAT_USE_RESISTANCE, COMBAT_SPECIALDAMAGE and COMBAT_OSIDAMAGEMOD) it will be the same as always too but much more improved

(01-20-2015 10:07 AM)Extreme Wrote:  Really, leave this. Don't messy the system.
what kind of behavior do you use on @GetHit? maybe I can explain it better, there's no need to worry since this wont break anything
01-20-2015 11:58 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)