![]() |
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 |
Re: Coordinate inaccuracy and confusion
Quote:
|
Re: Re: Coordinate inaccuracy and confusion
Quote:
|
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.
|
Quote:
|
Bandwidth?
|
Quote:
Also, on GK, the whole thing gets more messy with mudlib speeds and the like :\ |
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. |
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 :) |
Quote:
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
Quote:
|
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.
|
Quote:
|
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 :) |
Quote:
|
.... So that means no cookie for Ning :( ?
|
Quote:
Now Kai, what's the answer??? |
There are actually two, but I'm not sure if the second is applied to Graal.
The first is indeed related to movement. If x and y were locked to pixels then there'd be a limited range of movement speeds. I could move one pixel per frame, or two pixels per frame etc. To deviate from these, I'd need to code a system that keeps track of how far between pixels I am. Essentially I'd be replacing playerx with another variable, and thus negating the whole point of locking it in the first place. The second is related to how the characters are drawn. If the game were antialiased then characters wouldn't be drawn at the nearest pixel, and thus non-pixel player coordinates would be valid. |
How do you get to know all this stuff?
|
The cookie monster told him?
Probably experience, you tend to pick things up as you go along. Read forums associated with these type of things, you learn stuff... Quote:
|
Actually, i found it out myself XD
But you trying to help was great, too :) By the way i finished it and it's even better and it's the pwn XD |
Quote:
|
Quote:
|
C++ is an extension of C. I am told that most C++ tutorials assume you know C.
|
Quote:
Quote:
|
Quote:
|
I don't know, im only taking advice of someone who's been there and done stuff like this.
Anyway, isn't the new graal engine close too C? As in: If you could script in this new G script then, wouldn't working with C be an easy transition? |
Quote:
Quote:
Quote:
|
Loriel's learning C. So is Ning. I guess they have the same reason for that.
End. Anyway, you already learn the very very very basics with GScript; if, for, while and a bit of functions. |
I didn't mean I wanted to learn C / C++ using the new graal engine, I was just saying, If I did learn C would I understand the new graal engine better (or vice versa), but you have answered my question.. (it was just another reason for learning C.)
Anyway, I'll most likley get the C++ books out ;) |
Quote:
Quote:
Quote:
|
Quote:
-Also, is there a way I can access that book via a website or something, I also need to find a good online tutorial, I hate ones that blab on and talk about irrelevant things, and kind of branch off....one thing leads to another and you get lost..."hey how come were talking about the evolution of the earth now?" |
Quote:
Quote:
Oh and Ning, try http://www.cprogramming.com and http://cotweb3.mccneb.edu/Computercl...Resources.html (note: above URL might be invalid because copy&paste is dope - svchost.exe closed itself x.x) |
I think someone said that I do plan to first learn C, and then learn C++. This is incorrect, I have no intentions to learn C++.
Almost all C++ tutorials I have seen do not assume that you already know C. Actually, most of them start with things that are almost done the same way in both C and C++. This gets more confusing as simple C code often is valid C++ code too. The new scripting engine is probably going to be closer to C++ than C, which is not at all object oriented. If you want to learn C++, I do not think you should start with C. Actually, if you want to start with either C or C++, you should rethink your plans :) ESR explains that very well, in my opinion, and although this article itself is probably not what you want, the section I point at should be useful. |
| All times are GMT +2. The time now is 07:59 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.