Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-29-2003, 05:46 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Coordinate inaccuracy and confusion

Ok, I've been rather reluctant to make any new threads on the forums, seeing as how most of them end up as "flame wars" or something else with a lot of insults, but nonetheless, I'm posting now.

First off, I've noticed that the gserver and NPC Server both don't send EXACT player/NPC coordinates. For example, an NPC could be on 30,40.599999, and the player would receive the coordinate 30,40.5. It truncates everything after the first digit following the decimal. This can cause problems with NPCs that need to be very accurate on their locations. Has anyone else noticed this happening?

Second... why do players/NPCs EVER end up on coordinates that aren't evenly divisible by 0.0625? That has eluded me for quite a while now. All coordinates should be evenly divisible by 0.0625, as that's 1 pixel in Graal coordinate terms. You can't exactly go smaller than a pixel...

I wanted to make sure I wasn't crazy before posting in the bugs section about this, that's why I posted it here. Feel free to move it, although it's not like you need my permission to do so. :P
__________________
Kat
Reply With Quote
  #2  
Old 09-29-2003, 06:10 AM
Kaimetsu Kaimetsu is offline
Script Monkey
Kaimetsu's Avatar
Join Date: May 2001
Posts: 18,222
Kaimetsu will become famous soon enough
Re: Coordinate inaccuracy and confusion

Quote:
Originally posted by -Ramirez-
Second... why do players/NPCs EVER end up on coordinates that aren't evenly divisible by 0.0625? That has eluded me for quite a while now. All coordinates should be evenly divisible by 0.0625, as that's 1 pixel in Graal coordinate terms. You can't exactly go smaller than a pixel...
There is a reason, though it may not be immediately obvious. I'll see if anybody can guess ^_^
__________________
Reply With Quote
  #3  
Old 09-29-2003, 06:17 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Re: Re: Coordinate inaccuracy and confusion

Quote:
Originally posted by Kaimetsu
There is a reason, though it may not be immediately obvious. I'll see if anybody can guess ^_^
Does it have anything to do with Graal's internal movement system?
__________________
Kat
Reply With Quote
  #4  
Old 09-29-2003, 07:37 AM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
I blame Stefan's scary way to calculate the movement that happens if you walk against an edge and thus get pushed to the side.
Reply With Quote
  #5  
Old 09-29-2003, 08:20 AM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by Loriel
I blame Stefan's scary way to calculate the movement that happens if you walk against an edge and thus get pushed to the side.
That's what I first suspected, however, before posting, I put myself on integer coordinates, then pressed up enough to move a little bit. My coordinates were then a float value not divisible by 0.0625, so that just goes to show that Graal's internal movement system must also not increment/decrement your coordinates by a 0.0625 divisible amount.
__________________
Kat

Last edited by -Ramirez-; 09-29-2003 at 08:54 AM..
Reply With Quote
  #6  
Old 09-29-2003, 04:48 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Bandwidth?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #7  
Old 09-29-2003, 05:06 PM
Loriel Loriel is offline
Somewhat rusty
Loriel's Avatar
Join Date: Mar 2001
Posts: 5,059
Loriel is a name known to allLoriel is a name known to allLoriel is a name known to allLoriel is a name known to all
Quote:
Originally posted by -Ramirez-

That's what I first suspected, however, before posting, I put myself on integer coordinates, then pressed up enough to move a little bit. My coordinates were then a float value not divisible by 0.0625, so that just goes to show that Graal's internal movement system must also not increment/decrement your coordinates by a 0.0625 divisible amount.
Mhm, do you have lizard shield? I am pretty sure that the default speed is 0.5 tiles/frame, but I dun know how the lizard shielded speed is calculated. :|
Also, on GK, the whole thing gets more messy with mudlib speeds and the like
Reply With Quote
  #8  
Old 09-29-2003, 05:18 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
It seemed to me that a lot of variables seemed to be saved as "integers" or whatever
If you have a calculation, you can never go less then about 5 numbers behind the comma. 33,333...% for example, is, i believe,
33,33333%
What also questions me... is there a way to change values to integer values? It's possible for sure - when i calculated some stuff of the Magic points on GK, i noticed it was 4.2 instead of 4.2, so i guess it must be able to change values to integer values...

I think that Graal saves all x's and y's as integers or floats (?????) ... Wait, that doesn't makes sense, if you press F5, you see numbers like 38.8575040382... I guess that if Graal sends data to the player it becomes integers immediatly or something.
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #9  
Old 09-29-2003, 05:26 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
I'm going to take a wild guess and say when you move diagonally you move at speed squareroot 2...

For it not being divisible of .0625, it might not me, but it goes to the nearest pixel.

Go ahead Kai, say I'm wrong
Reply With Quote
  #10  
Old 09-29-2003, 05:41 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally posted by DustyPorViva
Go ahead Kai, say I'm wrong
Can i say it Kai? Can i say it? Pleaaaase? lol
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #11  
Old 09-29-2003, 05:48 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by Loriel
Mhm, do you have lizard shield?
Yes.

Quote:
Originally posted by Loriel
I am pretty sure that the default speed is 0.5 tiles/frame, but I dun know how the lizard shielded speed is calculated. :|
0.5 is also what I've always determined it to be. I also always thought the Lizard shield was 0.6, but with the weird coordinates you end up on, that can't be right.

Quote:
Originally posted by GoZelda
What also questions me... is there a way to change values to integer values?
Of course, int().

Quote:
Originally posted by GoZelda
I think that Graal saves all x's and y's as integers or floats (?????) ... Wait, that doesn't makes sense, if you press F5, you see numbers like 38.8575040382... I guess that if Graal sends data to the player it becomes integers immediatly or something.
If it's not an integer or a float value, what could it possibly be? Of course it's going to be one of the two. No, the data isn't an integer, it's a decimal with 1 digit following the period, or at least that's what I've seen when testing this.

Quote:
Originally posted by DustyPorViva
I'm going to take a wild guess and say when you move diagonally you move at speed squareroot 2...
Even though this doesn't have a whole lot to do with what I posted, your diagonal speed is slightly higher than your normal speed. Without the Lizard shield, it's 0.7071068 (sqrt(0.5)), and around 0.8485583 (which I don't know of any calculation that equals this amount, or even relatively close) with it.

Quote:
Originally posted by GoZelda

Can i say it Kai? Can i say it? Pleaaaase? lol
Too late.
__________________
Kat
Reply With Quote
  #12  
Old 09-29-2003, 06:01 PM
GoZelda GoZelda is offline
Mister 1,000,000
GoZelda's Avatar
Join Date: Jan 2003
Location: Brussels, capital of Europe.
Posts: 5,396
GoZelda will become famous soon enough
Send a message via AIM to GoZelda Send a message via MSN to GoZelda
Quote:
Originally posted by -Ramirez-
Even though this doesn't have a whole lot to do with what I posted, your diagonal speed is slightly higher than your normal speed. Without the Lizard shield, it's 0.7071068 (sqrt(0.5)), and around 0.8485583 (which I don't know of any calculation that equals this amount, or even relatively close) with it.
Mh, maybe this is because two keys are pressed?
__________________

Quote:
Originally Posted by Lance
stefan is satan
I am the best.
[URL removed]Music or aural pollution?
Reply With Quote
  #13  
Old 09-29-2003, 06:18 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
If you press two keys you move diagonally, which is a slightly longer distance then horizontally or vertically, which could alter the coordinates from being naturally divisible by the speed you move.
Reply With Quote
  #14  
Old 09-29-2003, 06:23 PM
-Ramirez- -Ramirez- is offline
Registered User
Join Date: Jun 2002
Location: USA, Ohio
Posts: 729
-Ramirez- has a spectacular aura about-Ramirez- has a spectacular aura about
Quote:
Originally posted by DustyPorViva
If you press two keys you move diagonally, which is a slightly longer distance then horizontally or vertically, which could alter the coordinates from being naturally divisible by the speed you move.
Oh... of course, sorry, I guess I was too set on thinking something else. However, what I mentioned about coordinate inaccuracy says that I only moved up, not diagonal, and my coordinates were still messed up.
__________________
Kat
Reply With Quote
  #15  
Old 09-29-2003, 08:45 PM
Ningnong Ningnong is offline
Registered User
Ningnong's Avatar
Join Date: Nov 2002
Location: < -- way
Posts: 262
Ningnong is on a distinguished road
Do you always walk the same speed, regardless of frames per second?

If so, then Graal uses a frame-rate independent movement system.

Meaning, the more frames/second you have the slower the co ordinates increment while you walk. Game engines record the time since the last frame.

eg, Y = Y + ( (0.6/1000) * timeElapsed )
1000 milliseconds in 1 second, so you divide 0.6 by 1000 .

y = increasing.


- I talk to Boco alot
__________________
Former Global Scripting Team Member



Last edited by Ningnong; 09-29-2003 at 10:36 PM..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.