Calculating Height, Z axis

05/23/2010 16:22 Xorg#1
Yo yo,
Any of you got experiences with implementing correct moving system in Kal by packets?
What is the best way to calculate it correctly?

I am doing like that.
Calculating step in X axis and Y axis. Then calculate Z step like that.
Code:
MoveZ = CurrentPlayerZ - GetHeight(CurrentPlayerX+MoveX, CurrentPlayerY+MoveY);
Ofcourse its not complete thinking as every step must be reversed by multiplying it by -1. Calculated CoordZ must be multiplyed by 10.
Given X and Y arguments to GetHeight must be also prepared.
It does not mattter.

This system works fine, but sometimes when there are steep climbs it goes little underground then after that little over.
Like the mountain its little faster than it really is.

Hope you can help :D.
05/23/2010 19:12 katze123#2
Quote:
This system works fine, but sometimes when there are steep climbs it goes little underground then after that little over.
Like the mountain its little faster than it really is.
maybe you send too much Zcoord at once? i mean e.g. movepacket(10,10,90) or sth like that?^^
05/23/2010 19:19 rolubo#3
I thin (10,10,90) don't work Oo ,max in plus is ~45 and in minus ~(256-45)
never tried to count z-coordinate,is GetHeight a function from Kal?can you post your complete z calculation?
05/23/2010 20:32 MoepMeep#4
Baka allready did it if I'm not mistaken :>

Check kalhack11
05/23/2010 22:59 meak1#5
yes bakabugs heightdetour works perfect @Xorg it stucks on places with hills because the hills go to high, u need to calculate it by urself or search nice place

dont know how to explain it exactly because my english sucks,
if the Z to high for walks from the detour lets say 80 then half it and send z+=40 , z+=40.

is the hill at X = 500
make in your search that he search under it (MobX < 500)
that he not try to go over the hill =/
05/24/2010 00:04 Xorg#6
Quote:
maybe you send too much Zcoord at once? i mean e.g. movepacket(10,10,90) or sth like that?^^
I've got protection for x,y max is 44 (absolute) and z must be between -128,127 (signed char). Till one of the condition fail the x,y will be divided by 2 and Z height will be calculated again.

Quote:
is GetHeight a function from Kal?
You can calculate it on your own (kal maps) or use kal function like I did.

Quote:
u need to calculate it by urself or search nice place
I am enjoying writing working shit, so its not good way for me ;)

Quote:
u need to calculate it by urself
What do you mean saying that?
05/24/2010 00:11 meak1#7
calculate z at your own if u run on a steep hill
i mean the heightdetour says to u , u need to go 150 Z now but its to steep,
calculate it 150 / 2 or so that u send 2 times Z not one time 150 because he cant go 150 dont know how to explain it better^^
05/24/2010 02:09 katze123#8
meak just said what i tried to say, too.
So. Heighdetour tells you "you have to go 100 z up"
so you have to divide it into parts. -> go x,y,and maybe 30% of Z, then just send 2 more packets for Z -> 40 and 30 (just an example).
05/24/2010 09:04 MoepMeep#9
btw, there is a bot function in kal, works nearly perfect ;P
05/24/2010 09:57 rolubo#10
Quote:
Originally Posted by Xorg View Post
I've got protection for x,y max is 44 (absolute) and z must be between -128,127 (signed char)
You just need the same protection for z
05/24/2010 12:45 meak1#11
Quote:
Originally Posted by MoepMeep View Post
btw, there is a bot function in kal, works nearly perfect ;P
AUTO_BATTLE... is left in engine but dont work about the system.ini again, right? =P
05/24/2010 14:05 Xorg#12
Quote:
Originally Posted by rolubo View Post
You just need the same protection for z
Nope, why? The Z is not somehow limited. You can move from -128 to 127 easily.
For example for x the 45+ will not work, till 256-44.
For z it all works fine.

Found the problem.
The problem is speed of moving. It must be calculated with the same speed as animation (3d character model move). If too fast the character model stay in back, but in real (packet coords) its much more forward. The Z value change the position of the model instant, so its just eating grass or flying :D.

Still the question is why kal does calculate range (in code) in 3 axis (X,Y,Z) when only (X,Y) determines the speed of moving and its constance for every move.
05/24/2010 14:10 MoepMeep#13
Quote:
Originally Posted by meak1 View Post
AUTO_BATTLE... is left in engine but dont work about the system.ini again, right? =P
not sure, I'm not playing kal anymore :p
05/24/2010 15:32 Xorg#14
It works perfect now.
Anyone implemented avoiding object system?
05/24/2010 15:51 bloodx#15
Calculate via OPL files. :p