The Mana World

Feel the mana power growing inside you!
It is currently Thu Jun 20, 2013 11:12 am

All times are UTC - 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: bug: paralysis of monsters solved
PostPosted: Fri Sep 23, 2011 4:10 pm 
Offline
Peon
Peon
User avatar

Joined: Thu Apr 02, 2009 11:58 am
Posts: 16
Location: Brazil
Where a distance of monsters, especially when entering a passage, the monster is paralyzed. This is a known bug in the game.
Analyzing the code, figured out how to run problem. Simply by changing the order of a few lines:
pt_br wrote:
Sempre que se distancia de um monstros, principalmente ao entrar por uma passagem, o monstro fica paralizado. Este é um bug conhecido do jogo.
Analisando os códigos, descobri como corrir problema. Bastando apenas trocar a ordem de algumas linhas:
current code:
Quote:
static int mob_attack (struct mob_data *md, unsigned int tick, int data) {
struct block_list *tbl = NULL;

nullpo_retr (0, md);

if ((tbl = map_id2bl (md->target_id)) == NULL)
return 0;


if (!mob_check_attack (md))
return 0;
corrected code:
Quote:
static int mob_attack (struct mob_data *md, unsigned int tick, int data) {
struct block_list *tbl = NULL;

nullpo_retr (0, md);

if (!mob_check_attack (md))
return 0;

if ((tbl = map_id2bl (md->target_id)) == NULL)
return 0;
The simplest way to check the problem and the fix is ​​also creating a monster that does not move, offensive and attacking from a distance.
buggy: to distance himself from the monster he stops attacking and is paralyzed.
no bug, it comes back to attack once again reaches the target.
pt_br wrote:
A forma mais simples de verificar o problema e também a correção é criando um monstro que não se move, ofensivo e que ataca à distancia.
com bug: ao se distanciar do monstro ele para de atacar e fica paralizado.
sem bug: ele volta a atacar assim que alcança o alvo novamente.

_________________
Diogo_RBG - Server BR - ADM, DEV
:mrgreen: The Mana World BR - The best MMORPG 2D now in Portuguese.


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Fri Sep 23, 2011 5:40 pm 
Offline
User avatar

Joined: Sun Feb 20, 2011 8:09 pm
Posts: 1361
Location: ^ ^
Can someone test this? This is just a proper git patch of the change suggested.

Code:
From e9e94a4275978ecb63024bafe4a78ab8bf5b5280 Mon Sep 17 00:00:00 2001
From: Ben Longbons <b.r.longbons@gmail.com>
Date: Fri, 23 Sep 2011 11:32:53 -0700
Subject: [PATCH] Possible fix for the frozen stationary mobs bug (i.e. frozen
Flowers)

Untested.
---
src/map/mob.c |    4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/map/mob.c b/src/map/mob.c
index 2402245..4ace058 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -903,10 +903,10 @@ static int mob_attack (struct mob_data *md, unsigned int tick, int data)

     nullpo_retr (0, md);

-    if ((tbl = map_id2bl (md->target_id)) == NULL)
+    if (!mob_check_attack (md))
         return 0;

-    if (!mob_check_attack (md))
+    if ((tbl = map_id2bl (md->target_id)) == NULL)
         return 0;

     if (battle_config.monster_attack_direction_change)
--
1.7.6.1

_________________
Source Lead for tmwa: chat.freenode.net #tmwa
<BigCrunch>look at o11c, half the time he speaks in code, yet he's getting **** done
<Freeyorp> Jaxad0127 is pretty awesome, despite the Java :>
<veryape> tmw and evol is like linux vs bsd
<veryape> evol might be more coherent but have less stuff, tmw is a great chaos that somehow works together imo


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Sat Sep 24, 2011 5:43 am 
Offline
Peon
Peon
User avatar

Joined: Sat Jul 25, 2009 9:36 pm
Posts: 43
Location: 13
The same patch was made by me for ufb server more than year ago:

https://www.gitorious.org/tmw-ufb-ea/tmw-ufb-ea/commit/4f9ec7f2ca077f3353ae43273b350b0b02a7e16f

It fix one thing but it add another bug, test it and you will see.

_________________
Non sprecare tempo con qualcosa ke è già belle che morto, lascia ke i cadaveri giokino nel loro piccolo ed inutile angolo di universo continuando a sognare ke sappiano fare ciò ke non sanno fare.


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Sat Sep 24, 2011 11:45 am 
Offline
Peon
Peon
User avatar

Joined: Thu Apr 02, 2009 11:58 am
Posts: 16
Location: Brazil
If you say that adds another bug, maybe it's because the function does mob_check_attack extra checks.
If the check (map_id2bl tbl = (md-> target_id)) == NULL before this function is more accurate, then you need to give appropriate treatment rather than return 0;
The second bug you say, maybe the monster is not to chase their target. So we need a logic to expect that stationary target for his return and then keep attacking. And it can change target too.
pt_br wrote:
Se você diz que adiciona outro bug, talvez seja porque a função mob_check_attack faz verificações extras.
Se a verificação (tbl = map_id2bl (md->target_id)) == NULL antes desta função for mais correto, então é preciso dar um tratamento adequado ao invés de return 0;
O segundo bug que você diz, talvez seja do monstro não perseguir seu alvo. Então precisamos de uma lógica para que estacionários esperem por seu alvo retornar e continue atacando depois. E ele possa mudar de alvo também.

Thank you for your attention.

_________________
Diogo_RBG - Server BR - ADM, DEV
:mrgreen: The Mana World BR - The best MMORPG 2D now in Portuguese.


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Wed Sep 28, 2011 7:27 pm 
Offline
Peon
Peon
User avatar

Joined: Sat Jul 25, 2009 9:36 pm
Posts: 43
Location: 13
I think you didn't understand the nature of the bug.

The function mob_check_attack does not do extra checks since as you can read in this line
http://gitorious.org/tmw-eathena/mainline/blobs/master/src/map/mob.c#line829 the check
Code:
if ((tbl = map_id2bl (md->target_id)) == NULL)

is duplicated which imply that this code
Code:
if ((tbl = map_id2bl (md->target_id)) == NULL)
return 0;

if (!mob_check_attack (md))
return 0;

does, if the condition is true, double check on the same thing, i think that you probably missed it.

Also changing the return value of the mob_attack function is useless since the return value is always 0 and it's never checked in any part of the code.

In my opinion it's not a good practice to add new code to fix a bug until you do not have a clear idea why it exists and how you may fix it but i may be wrong.

Now, leaving all that on one side, the flower is stucked due to that double line, the reason why swapping the lines fix the issue comes from this other one http://gitorious.org/tmw-eathena/mainline/blobs/master/src/map/mob.c#line814
the mob status is set to idle while this do not happen when the first if fails, the flower stucks on the attack status which brings its paralysis.

By fixing that in the proper way, which i won't explain in detail using the code since it's obvious; change the return values and the returned variable type in mob_check_attack, removing the double check, etc, etc...
you will end up with a solution for the paralysis but there will be a new issue, now the mobs that were following a player will stuck on the entrance of the caves where he or she left, this, until a player would enter in that map and move them away.

_________________
Non sprecare tempo con qualcosa ke è già belle che morto, lascia ke i cadaveri giokino nel loro piccolo ed inutile angolo di universo continuando a sognare ke sappiano fare ciò ke non sanno fare.


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Sun Feb 12, 2012 8:22 pm 
Offline
User avatar

Joined: Sun Feb 20, 2011 8:09 pm
Posts: 1361
Location: ^ ^
I was poking around some other stuff and found some files in ~/.local/share/mana/updates/updates.themanaworld.org/fix ... who ships these and why don't they put them in the main repository? (Edit: found this, as I guessed)

One of the live files is the flower mob (the other is for items.xml and I don't feel like touching that) and I remember seeing it's animation continue looping while playing with this patch ... I guess this fixes *that* problem?

I really want to see this bug fixed but I don't have the time to fully understand it ... and those who apparently do, are not very forthcoming. Maybe this could be applied on the test server for a while?

Anyway, I've attached the diff for client-data/fix/update-that-contains-flowers.zip


Attachments:
flower.xml.diff [696 Bytes]
Downloaded 29 times

_________________
Source Lead for tmwa: chat.freenode.net #tmwa
<BigCrunch>look at o11c, half the time he speaks in code, yet he's getting **** done
<Freeyorp> Jaxad0127 is pretty awesome, despite the Java :>
<veryape> tmw and evol is like linux vs bsd
<veryape> evol might be more coherent but have less stuff, tmw is a great chaos that somehow works together imo
Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Sun Feb 12, 2012 8:42 pm 
Offline
Novice
Novice

Joined: Mon Aug 03, 2009 10:57 am
Posts: 416
o11c wrote:
I was poking around some other stuff and found some files in ~/.local/share/mana/updates/updates.themanaworld.org/fix ... who ships these and why don't they put them in the main repository? (Edit: found this, as I guessed)


This is fixes for clientdata for manaplus what was rejected (or will be rejected) by some tmw people.
Some features from here still not supported by "official" (tm) client.

_________________
Advanced game client


Top
 Profile  
 
 Post subject: Re: bug: paralysis of monsters solved
PostPosted: Sun Feb 12, 2012 10:56 pm 
Offline
Knight
Knight
User avatar

Joined: Tue Sep 07, 2004 1:55 pm
Posts: 1019
Location: France
Hi,

4144 wrote:
This is fixes for clientdata for manaplus what was rejected (or will be rejected) by some tmw people.
Some features from here still not supported by "official" (tm) client.

Sorry, but this is wrong as the code to support the <end /> tag is there in the src/resources/spritedef.cpp line 284.

It is thus supported or at least should be and was broken. I'll try it on the 0.6.0 client and look into fixing it if not already done.

Please, 4144, I'm in very good term with you, and I wish you could name the people involved with the rejected features instead of involving the whole (tmw, but I guess more mana, in that case) team, which is atm concerning only bjorn, Ablu and me.
You're right some features got rejected, and I'm sure some were rejected for bad reasons, or badly exposed. Let's try to make the future of this project a better place for sharing. :)

Best regards,

Bertram


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group