![]() |
Movement/Wall Detection for Variable sizes
3 Attachment(s)
A small script I threw together to show how you can create a movement system with various speeds(without skipping over walls), and more importantly: various sizes. This means you can shrink your player down to 1 tile and squeeze through cracks, or apply a better wall detection to larger players. What it is lacking is detail to anything else but those two things. It initially started as an experiment with onwall2 for a solid wall detection(instead of lots of onwall()'s), and I decided to add size support later. Lacks important things like sliding around corners, but that's not what this is focused on.
PHP Code:
|
please donate this script to UN, they need it.
Anyways great job dusty, I'm loving the work lately. |
Quote:
Great script Dusty, could have an awesome use for server having interesting quests, like drinking an elixir to become smaller or something like that. |
Oh, this should be moved to the code gallery, my bad!
|
How I did the movement on Classic was by having a function that works a long a "primary axis". That could be x-axis, y-axis, or say 45deg.
Then it moves along that access, then when it encounters a wall in its path, it will slide perpendicular to the primary axis. I made it even more complex (for the sake of efficiency), by doing a conquer-and-divide algorithm along the movement path. With built-in onwall() and onwall2() it literally had 0% impact on CPU. With our scripted onwall (i.e., loop through every player, npc, blocking tile and check if they are blocking & intersect), it matched default performance. Getting it pixel perfect was a little annoying, but the script came out nicely in the end (probably about 200 lines if all the extra documentation and lines were removed). It supports variable speeds and sizes as well. I might release it in Code Gallery at some point, but it'd require some cleaning up so it wouldn't rely on some of the other systems we have on Classic, so that is a project for when I have free time. ;) |
Well making sliding isn't that hard, especially in GS2 since I can use passing parameters to simply make a function that checks for a wall in a given direction, making it much simpler to do accurate wall sliding. Maybe I'll add that later.
|
I <3 you Dusty....saved me a hell of alot of effort.
p.s. PHP Code:
p.p.s If you do add sliding, I will love you even more =) p.p.p.s On further usage, it doesn't seem very smooth. I also found it suffered the same problem I had whereby faster speeds can cause you to jump obstacles... it was this problem that caused me to delay working on it since it was either efficiency or accuracy :( |
Quote:
It's a fairly easy fix though, which just involves adding the speed to the size of the onwall2. |
Quote:
|
Quote:
|
Quote:
|
I'm rescripting this from scratch right now. I'm instead breaking the wall detection into 4 quadrants and basing wall collisions off of that. This will make it easier to implement sliding, and easier to handle the wall data.
|
Must say, very impressed. Tho size doesn't show for other players, so I came up with this. Maybe you could impliment something to show size properly in your next rescript?
PHP Code:
|
Quote:
A better way would be to put the players size in an attr[] and simply update the local (someone in a different gmap won't care how the player is being drawn afterall) player's size via some method clientside script (weapon/gani).... |
Typically you will use a gani as an attr, with ganiscript in it to handle zoom. You set the script in to one attr, then the size of your player(and other visual aspects like alpha and such, if you'd like) to another attr. Use the ganiscript to parse the other attr and then set the player's effects.
However, it was not my responsibility to do this, as that's not what the script was about :) |
I normally stay AWAY from ganiscripts. Most people dont fully understand, ganis are downloaded from the server. If you have the gani it usually ignores it (or has in the past). And you can use scripts in ganis maliciously. I saw people do it on N-Pulse, UN, and gk. =/
Yah I really don't recoment doing it the way I showed but I was just showing a example of something that worked. o_o It would be alot easier if we could just use findplayer("player").clientr.value =/ but that doesnt work clientside. and I thought cleintr. was readable by client and server? |
Quote:
If they were that dangerous, all you'd have to do is input ganiscript into any gani like idle or walk, and have it run. Whether or not you have a ganiscript has no bearing on how available the function is. Also, client vars are readable by server/client, but it's not data sent to other players. Data shared between players is a very specific set of vars, as to not chew up a lot of bandwidth. |
Quote:
Thanks for informing me on the client vars. so player.attr[] vars would be the best way? I was just wondering cuz if a noob opened a memory editing tool and changed there attr, would this effect show for all other players? seems unfair if 1 player changes his size to 20+ and just stomps you to peices. |
Quote:
As for player.attr[]'s, even if a hacker were to change the attr of another player it'd all be clientside. That means the only person who would see the change is the player doing the hacking. Also, there's a reason my system is not dependent on zoom. I use a separate, more secure(ideally, though I mainly leave that up to whomever uses it to implement) variables and zoom is only a visual representation. In fact, the zoom was the last thing I added. |
Quote:
This is all good information to know then. We should all hope that graal checks other forums of security. Altho modification time would be useless as I can modify those dates from Borland Delphi 2005 (yes i use outdated version). Checksum of the files might work. Tho collisions are easy to generate now :( |
Quote:
Also, sorry for derailing. :P |
Scriptless, I think you're over analyzing security a bit lol
|
Quote:
Erm, I am not overanyalising security at all. I will fully admit, I am iwir3d. I have been playing graal since 2002 and I have been responsible for several trainers being released. My best trainer I made allowed 2.220 and priror to go form offline mode to online mode and inject scripts onto a server. Here I will link you to some damage I did on GK back in 2005. http://forums.graalonline.com/forums...light=bloodpet (pictures at bottom and top of 2nd page) I have since then tried to move my abilities to more productive things but having this knowledge that allows me to do this helps me acheive a greater understanding on BOTH sides of scripting in the efforts for better security. If you guys want you can do a full search on me :) Here are my other names I have gone by: mewtoo18, toybox, dbug, shadow_deathstorm, bloodpet, scriptless, nibnub. And I think that may be it. Oh and ofcourse "iwir3d". I once read in a book that you should never assume that a bug will not be exploited and you should never assume that any small bug does not esculate into a even bigger bug (as my unethical work has clearly shown). *sorry for going off topic a little (needed to show how critical security can be). |
Quote:
The complexity of an MD5 collision is still 2^32, and with the added complexity of the format you are trying to engineer a hack into, I stand by my original statement. |
| All times are GMT +2. The time now is 01:02 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.