Alaric
Journeyman
Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7
|
Bigger effects
I was just trying to make some effects using sendpacket. Although it brought a few questions/problems.
Quote:1, How do you personally use sendpacket - moving items - to make a good effect without lags, bugs, simply pure and fluent?
Tried, for instance:
for 30
sendpacket bla bla bla
endfor
30 moving items is quite much I quess, I had to increase the speed to minimalize lags. (just example, the number should be higher)
2, Who do you send them to.
-sector? Not perfect... when 1 player is standing in sector 1, and 2. player in sector two, one of them dont see the effect.
-room? doesnt work (at least, not to me)
-region? (isnt it unnecessarily big?)
-serv...(...)
-forplayers/forchars? Well, I tried, but it seemed to be slower and less fluent
In conclusion and for those who dont want to read the craps above - How do you make more complicated effects without lags, or eventual client crashes (because of too many packets)
I see the only way and its - forplayers; sendpacket; endfor...
(This post was last modified: 04-25-2013 05:16 AM by Alaric.)
|
|
04-25-2013 04:59 AM |
|
|
Alaric
Journeyman
Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7
|
RE: Bigger effects
(04-25-2013 05:55 AM)darksun84 Wrote: What you mean about less slower and fluent ?
Anyway, I think that the main problem is not to find "the best way" to implement them, but limiting how many times the players will be able to use the functions/spells that will "trigger" those graphical's packet.
Ye, true... I used timer memory, to be sure players clients won't crash.
Btw. an example of larger effect I made.
Quote:local.x= <r3,7>
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<p.x> W<eval(<p.y>+<local.x>)> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
for 0 <eval <local.x> -1>
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>-1)-<dlocal._for>)> W<eval((<p.y>+<local.x>)-<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
endfor
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval(<p.x>-<local.x>)> W<p.y> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
for 0 <eval <local.x> -1>
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>-<local.x>)+<dlocal._for>)> W<eval((<p.y>-1)-<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
endfor
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<p.x> W<eval(<p.y>-<local.x>)> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
for 0 <eval <local.x> -1>
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>+1)+<dlocal._for>)> W<eval((<p.y>-<local.x>)+<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
endfor
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval(<p.x>+<local.x>)> W<p.y> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
for 0 <eval <local.x> -1>
sector.allclients sendpacket 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>+<local.x>)-<dlocal._for>)> W<eval((<p.y>+1)+<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
endfor
ef_daemon_element_spell_damage <local.x>
[function ef_daemon_element_spell_damage]
local.x = <uid>
forchars <argn1>
if !(<npc>==brain_undead) && (<canseelos> == 1) && !(<local.x> == <uid>)
damage <getarg <uid.<local.x>.tag.element>,<def.daemon_element_damage>>,<getarg <uid.<local.x>.tag.element>,<def.daemon_element_type_dmg>>,<local.x>
effect 3,<getarg <uid.<local.x>.tag.element>,<def.daemon_element_effect_id>>,1,10,0,<getarg <uid.<local.x>.tag.element>,<def.daemon_element_color_spell>>,0
endif
endfor
cso, thats why I'm afraid it might cause problems. ( Ignore sector and those tags.. )
(This post was last modified: 04-26-2013 04:06 AM by Alaric.)
|
|
04-26-2013 03:58 AM |
|
|
sco
Apprentice
Posts: 38
Likes Given: 0
Likes Received: 3 in 1 posts
Joined: Mar 2012
Reputation: 7
Elantharil
|
RE: Bigger effects
Ok.
I would limit it to 15 or 20 of those fireballs. Should be enough to display that effect to look nice - damage done effectively is another thing but does not have to be related to how many of those fireballs are around. You just use the range to determine the area of effect ... you might be better off to skip some packages (every second or so) if you have some higher values in local.x.
To optimize this one:
Do all those for-loops without sending those packets. Something like that:
Code:
local.x= <r3,7>
local.packetcount = 0
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<p.x> W<eval(<p.y>+<local.x>)> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
for 0 <eval <local.x> -1>
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>-1)-<dlocal._for>)> W<eval((<p.y>+<local.x>)-<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
endfor
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval(<p.x>-<local.x>)> W<p.y> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
for 0 <eval <local.x> -1>
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>-<local.x>)+<dlocal._for>)> W<eval((<p.y>-1)-<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
endfor
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<p.x> W<eval(<p.y>-<local.x>)> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
for 0 <eval <local.x> -1>
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>+1)+<dlocal._for>)> W<eval((<p.y>-<local.x>)+<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
endfor
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval(<p.x>+<local.x>)> W<p.y> B<eval(<p.z>+12)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
for 0 <eval <local.x> -1>
local.packet<local.packetcount> = 0c0 00 D0 D0 W036d4 W<p.x> W<p.y> B<eval(<p.z>+12)> W<eval((<p.x>+<local.x>)-<dlocal._for>)> W<eval((<p.y>+1)+<dlocal._for>)> B<eval(<p.z>+13)> B<dlocal.x> B1 00 00 00 00 D0 D0
local.packetcount += 1
endfor
forclients 18
for 0 <eval <local.packetcount>-1>
sendpacket <local.packet<local._for>>
endfor
endfor
ef_daemon_element_spell_damage <local.x>
Try to count and save all those packets in some locals first. With that you save up time calculating all those coordinates during your sendpacket-statement.
Then send them all at once, rather than looking up your clients all the time.
(This post was last modified: 04-26-2013 05:08 PM by sco.)
|
|
04-26-2013 05:06 PM |
|
|