Scatter DC

10/27/2014 07:57 Soulfly25#1
Hello Mates,

Good Day!.

I am having a problem of my scatter which is when there's lot of monster surrounded me and when I use scatter it will Disconnected(DC). when the monster is over 14+ then using the scatter it will Disconnected.
this happen when archer will be leveling and hunting because all monster will be gather infront of the character.

So anyone have a solution for this? please share it to me :)
Or any advice?

thank You Mates.
10/27/2014 11:25 Super Aids#2
Get a new source.
10/27/2014 13:15 .Ocularis#3
the client is having and issue because it will not handle individual messages over 1016 bytes, plus the seal (8 bytes)
you're sending too many targets in your skill effect message (1105) which causes the length of the message to exceed 1024 bytes.

split the targets among multiple 1105 transfers, limit scatter's max target count to 29 (edit: i came up with 29 by 8 + 20 + 32 + Targets.Count * 32 for latest revision of the 1105 message type because adding one more target would exceed 1016) to reduce bottlenecking the graphics render with tons of skill effects and damage amounts, or reduce the amount of monsters in each screen area then raise the rates to compensate for thinned mobs.

even COSV3 could have this condition if you didn't compensate for it.
some projects had no implementation of scatter.
10/27/2014 13:38 Xio.#4
Quote:
Originally Posted by .Ocularis View Post
the client is having and issue because it will not handle individual messages over 1016 bytes...
Do you have an idea when they increased the max. packet size? On 5021 it will close the client if it exceeds 821.
10/27/2014 14:38 .Ocularis#5
No I don't, however.. 821 is an odd overflow length.. are you certain the structuring was valid? You'd do better asking JP that question.
10/28/2014 07:27 Soulfly25#6
Thanks for the Information, But It's kinda I am noob in C# :) I only know basic. hehe

Code:
  const int TargetLimit = 30;
        public byte[] ToArray()
        {
            if (Targets.Count <= TargetLimit)
            {
                byte[] buffer = new byte[61 + Targets.Count * 32];
                Writer.WriteUInt16((ushort)(buffer.Length - 8), 0, buffer);
                Writer.WriteUInt16(1105, 2, buffer);
                Writer.WriteUInt32(Attacker, 4, buffer);
                Writer.WriteUInt16(X, 8, buffer);
                Writer.WriteUInt16(Y, 10, buffer);
                Writer.WriteUInt16(SpellID, 12, buffer);
                Writer.WriteUInt16(SpellLevel, 14, buffer);
                Writer.WriteUInt32((uint)Targets.Count, 17, buffer);
                ushort offset = 20;
                foreach (KeyValuePair<uint, DamageClass> target in Targets.Base)
                {
                    Writer.WriteUInt32(target.Key, offset, buffer); offset += 4;
                    Writer.WriteUInt32(target.Value.Damage, offset, buffer); offset += 4;
                    Writer.WriteBoolean(target.Value.Hit, offset, buffer); offset += 4;

                    offset += 6;
                    Writer.WriteUInt32(target.Value.newX, offset, buffer); offset += 4;
                    Writer.WriteUInt32(target.Value.newY, offset, buffer); offset += 8;
                }
                return buffer;
            }
            else
            {
                using (MemoryStream stream = new MemoryStream())
                using (BinaryWriter writer = new BinaryWriter(stream))
                {
                    var array = [COLOR="Red"]Targets.ToArray();[/COLOR]
                    for (int i = 0; i < array.Length; i += TargetLimit)
                    {
                        int targets = array.Length - i;
                        if (targets > TargetLimit) targets = TargetLimit;

                        byte[] buffer = new byte[61 + targets * 32];
                        Writer.WriteUInt16((ushort)(buffer.Length - 8), 0, buffer);
                        Writer.WriteUInt16(1105, 2, buffer);
                        Writer.WriteUInt32(Attacker, 4, buffer);
                        Writer.WriteUInt16(X, 8, buffer);
                        Writer.WriteUInt16(Y, 10, buffer);
                        Writer.WriteUInt16(SpellID, 12, buffer);
                        Writer.WriteUInt16(SpellLevel, 14, buffer);
                        if (Kernel.GamePool.ContainsKey(Attacker))
                            if (Kernel.GamePool[Attacker].Spells != null)
                                if (Kernel.GamePool[Attacker].Spells[SpellID] != null)
                        Writer.WriteUInt32((uint)(targets/* << 8*/), 17, buffer);
                        ushort offset = 20;
                        for (int j = 0; j < targets; j++)
                        {
                            KeyValuePair<uint, DamageClass> target =  [COLOR="Red"]array[i + j][/COLOR];
                            Writer.WriteUInt32(target.Key, offset, buffer); offset += 4;
                            Writer.WriteUInt32(target.Value.Damage, offset, buffer); offset += 4;
                            Writer.WriteBoolean(target.Value.Hit, offset, buffer); offset += 4;
                            offset += 6;
                            offset += 6;
                            Writer.WriteUInt32(target.Value.newX, offset, buffer); offset += 4;
                            Writer.WriteUInt32(target.Value.newY, offset, buffer); offset += 8;
                        }
                        Writer.WriteString("TQServer", buffer.Length - 8, buffer);
                        writer.Write(buffer, 0, buffer.Length);
                    }
                    return stream.ToArray();
                }
            }
        }
I am workin now, and I've got this error . Please help me please :) Im stuck with this part
Error in this part:
1. = var array = Targets.ToArray();
2. = KeyValuePair<uint, DamageClass> target = array[i + j];

Here is the ScreenShot error
[Only registered and activated users can see links. Click Here To Register...]
10/28/2014 11:38 Xio.#7
Quote:
Originally Posted by .Ocularis View Post
the client is having and issue because it will not handle individual messages over 1016 bytes, plus the seal (8 bytes)
you're sending too many targets in your skill effect message (1105) which causes the length of the message to exceed 1024 bytes.

limit scatter's max target count to 29
PHP Code:
const int TargetLimit 30
Can you see it? Can you? xD

Replace SafeDictionary with ConcurrentDictionary. I'm pretty sure the implementation of SafeDict is worse than Microsofts implementation ;D
10/28/2014 11:57 Soulfly25#8
as I sad I am still noob in C# :)
wanna help me? can I have your skype?
if you are willing
10/28/2014 12:30 Xio.#9
EDIT:

Sittin here on TeamViewer, watching him undo his "fix" because scatter doesnt work at all anymore haha :D

--

There is more wrong with it than just the amount of targets. We've limited to 2 Targets and it still disconnects.

Anyone else cares to help him? I don't know that source well enough nor do I have the time to dig through everything at this moment.
10/28/2014 13:55 Soulfly25#10
and Thanks for Xio for helping me :) but still not working and still thinking of it to limit the target count in scatter skill id

and Problem Solve :) I think It's solved now coz when I scatter it won't DC. but sometimes it give me lag. :)