Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [LOCKED] Stupidly inaccurate. I want accuracy

Author
Message
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 31st Mar 2005 05:33
Hi,
move object 65,-0.2
That should move object 65 by -0.2 in the direction its facing

It doesn't
It moves object 65 by approximately -0.2

I'm fed up of this inaccuracy.
How do i fix this problem
If it's a bug.. will there be a fix for it?

Dark Days Software
robo cat
21
Years of Service
User Offline
Joined: 23rd Feb 2004
Location: In a cat litter tray, near you...
Posted: 31st Mar 2005 05:35
Its probably just an error caused by float inaccuracy, its not really a bug so I doubt there will be a fix for it.

Simple... yet fun!
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 31st Mar 2005 05:37
well its hardly somthing that you can work with.
The position of the object in the game is critical as to wether the game works or not.
There must be a work around...

Dark Days Software
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 31st Mar 2005 05:38
ok so heres the code in context

if move = 1
move object 65,-0.2
micromove=micromove + 1



Thanks to robo cat for his rounding solution in another topic.. lucky the position i want can be rounded
Thanks alot robo cat

Dark Days Software
Tommy S
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location:
Posted: 31st Mar 2005 22:01
will it still be inaccurate if you use newxvalue and newzvalue? I seem to remember that them being maths commands makes them far more accurate
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 31st Mar 2005 22:15
It's probably never came up because moving objects in set chunks is usually done with POSITION OBJECT. I think that positioning objects with the command is accurate, it's probably just a little strangeness with MOVE OBJECT that does'nt calculate the exact position.


Van-B

Quote: "How could I condescend you?, you don't even know what it means!"

Van-B's mom.
Baggers
21
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 2nd Apr 2005 11:05
how are you registering this difference ? .. using text or print to put it to the screen.
I think you may find that the internal math and movement could be fine and its only the printing to the screen thats the problem, that is where the inacuracies lie....as far as i can tell.
The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 2nd Apr 2005 11:20
why would the difference between -.2 and about -.2 be that big of a difference?

http://87.savefile.com
87 Productions is the shizz.
TKF15H
21
Years of Service
User Offline
Joined: 20th Jul 2003
Location: Rio de Janeiro
Posted: 2nd Apr 2005 12:07
You never have to work with units that small. If you ever feel like you need to, just scale everything and make it bigger. That way it looks like you're moving 0.2 but it's actually 1.

AphoticVM status: 30% (Yes, that number just went down.) AphoticBasic status: 10%
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 3rd Apr 2005 08:35 Edited at: 3rd Apr 2005 08:37
ok
Badgers that's incorrect. As the object was not being registering at the expected point and the reason why was only later found out as i checked the values.
The maths system is faulty, somthing to do with processors and float numbers.
The idea that there i somthing wrong with the text display an not maths is just.. daft.. frankly..
Maths calculations can be inaccurate..
But why shouldnt the computer be able to print the correct values..
they are unrelated...

The Real 87
It would make a difference because my game trigers depend on the exact locations of objects and these values are then converted to 'integers' which are then placed back into an array to determine a value.
Thats why it makes the difference between game works and game doesnt
yes i should really implement that crazy 3d withing range detection routine.. but that would make my code look absolutly insain.

TKF15H:
Firstly: Well obviously I do.
Secondly: Why shouldn't I?
I guess you must be one of these people who's coordinates run into the billions figure.
Thirdly: Classic example : Valve hammer bsp's... Try moving round them at a value of a 100

Thanks but the question was valid and was answered.
again
Thanks.

Dark Days Software
The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 3rd Apr 2005 08:44
umm... to make it at more then one spot you could make a cube, position it at teh spot, then hide it and run collision detection so that the object does not have to be at the exact spot it just has to be within say 10 or 15 of it.

http://87.savefile.com
87 Productions is the shizz.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 3rd Apr 2005 09:29
I could have sworn I posted in this thread a few days ago.. Hmm..

Basically the ONLY way (and I mean the ONLY way) you're going to get around the problem of 0.1 not ACTUALLY being 0.1 when used on a computer is to completely redesign your PC from schematic level up, along with all your software. The problem lies with a fundamental thing called BINARY.

your quote near the top saying:
Quote: "well its hardly somthing that you can work with"


is, to be quite honest, laughable. Game programmers have been "working with it" for for years!

The problem with binary floating points is you are trying to represent a decimal number using combinations of: 0.5, 0.25, 0.125 and so on (depending on the number of binary places available).

Now, using the above options of 0.5, 0.25 and 0.125:
0.75 = 0.5 + 0.25, Thats easy.. But
0.60 = 0.5 + 0.125 = 0.625

Thats wrong - but as far as binary is concerned it is correct. "I" cant represent that extra 0.1 any more accurately.

So, the answer is to make a PC that uses decimal. The problem there is:
a) It costs a lot, to put it lightly
b) Its been done and given up on for now
c) NONE of the software will run on it

That just a summary - there are MANY other reasons.

To be honest, I cant see a situation where you should ever need to be that accurate in a game. Its much better practice to use a range, like 0.5 +/- 0.1 (ie 0.4 to 0.6). This is basically what The Real 87 has said with his cube and collision detection, but expressed mathematically.

This is why you're having a problem anyway.. Your asking too much of a float. You could always try a double float, but I get the feeling that suffers the same (ie 0.10000000000000000000000000000000001)

Hope this helps...

My Website:
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 3rd Apr 2005 10:14
Damn straight

<maddox> yeah, most help channels tend to be elitist.. "HOLY ---- YOU ------- IDIOT, YOU SHOULD KNOW THAT ALREADY. NEVERMIND THE PURPOSE OF THIS CHANNEL!
--Mouse
Baggers
21
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 3rd Apr 2005 10:54
Terabyte: Lighten up, i did say it was just a theory...based on the fact that the good old windows calc can show 4.5 without a massive string of numbers after it...as i said, it was an opinion.
And try using my name, my home is not monitored by Bill Oddie.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 3rd Apr 2005 10:57
LMAO - Such a shame, I bet Bill's a great guy

I think Calc probably does a little test.. something like if the last 12 digits are "0000000000000000000001" then truncate it.

Basically, Calc lies to you. It doesn't calculate like it does.

I suppose the other alternative, thinking about it, is to write your own functions that work in base 10, rather than the current functions which are all base 2 (you say 10.1, thats converted to a number close to it, then converted back to a number that isn't 10.1). Good luck with that one

My Website:
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 3rd Apr 2005 11:03
i swear that said badgers
The real 87... I don't want complications like that. The code was anoying enough without introducing the concept of collision and tacky work arounds like that.
The solution was given by sombody else. in one command... INT(blah+0.5)

Rounding.. which was somthing i was trying to do and not getting anywhere with because i hadnt added +0.5 in the right place. But thanks for the suggestion.

yes buggers and i did say it was wrong : ) which is fact.
and i will from now on, purposly misspell you name

Dark Days Software
The Real 87
21
Years of Service
User Offline
Joined: 3rd Mar 2004
Location: somewhere between 86 and 88
Posted: 3rd Apr 2005 11:06
so my code is tacky now... I know when I am not wanted. From now on he is gunna fight my battles for me!

http://87.savefile.com
87 Productions is the shizz.
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 3rd Apr 2005 11:09 Edited at: 3rd Apr 2005 11:10
yes
putting an object in the place...
and makeing a whole friggin collision system with the ng dll for a tiny inaccuracy when i can just put INT() in the code IS tacky.
Yes! One thing i decided to make a point of in this game was no collisions! Because it doesnt need it lol!

(wuv u weally)

**hands him a cuppa **

Dark Days Software
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 3rd Apr 2005 11:55
He never mentioned NG DLL.. a simple Object Collision(a,b) would do.

Its not such a silly suggestion.

One thing i've learned from DBPro is the skill of hacking your way around a problem

My Website:
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 3rd Apr 2005 13:13
dude...
its ott...3 letter command... INT
compared to how much collisionc code.. used how many times thoughout my project.. with how many problems arrising from it?

and apart from that...
the problem had already been solved.
god dam we need a point system on this forum.
less questions asked more questions answered

Dark Days Software
Baggers
21
Years of Service
User Offline
Joined: 31st May 2004
Location: Yonder over dem dere hills
Posted: 3rd Apr 2005 19:50
Quote: " i will from now on, purposly misspell you name"

pèrebyte: Thats fine then !...as long as i know !
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 3rd Apr 2005 20:42 Edited at: 3rd Apr 2005 21:38
Lol..

Ok Terabyte, Int works great in your situation. The cube with collision detection on it will work in any situation when you want to detect if something is in range of something else. There are a near inifinate other ways, like radius checking, etc.. This was just 1 suggestion that some people actually use! Baggers was trying to help you. In return you call his attempt at help tacky and now wont even refer to him by his proper name! How rude Hehe..

My Website:
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 3rd Apr 2005 20:52
Quite right, 'tis very rude.

Carefull which enemies you make, Terrabyte


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Terabyte
22
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 4th Apr 2005 10:52 Edited at: 4th Apr 2005 10:53
i wasn't being rude
I was stating a fact.
Will you stop putting words in my mouth and read the posts carefully
I never said his help was tacky.
I said the cube method (in my situation) was tacky and very inefficient.
And Banjoes didn't suggest it.. The Real 87 did.
Baggers suggested that the text display system was the one causing the error.. which isn't very likely.. infact.. it just isn't.

I didn't on purposly spell his name wrong, somthing which you guys seem to be having trouble understanding. So to emphasise that point i joked about totally mispelling his name.
Bandergraph, don't pick hairs.

Ye know.. at the delphi forums.. the reply to your question.. and finish there. You give em the point and everyone's happy.
They don't sit there questioning the purpose or integrity or necessity of your question

The Real 87 : "Why would -.2 to +.2 make a difference."
Why doesn't matter, i'm asking because it does, appart from the fact i already said the position of the object is critical.
TKF15H: "You shouldnt have to do that anyway"
Why are you saying that.. obviously.. I do.. so .. give solution or shut up

all of you

answer the post directly, or don't answer it at all..
My previous posts wern't being rude.
This post is being rude.

Baggers i was joking when i said i would mispell your name
but if you want to take it seriously then yeah ok.
And jessTicular and NickTompson.. you are the ones trying to make me look rude for a post which has smilies in it and is meant in jest

Of course can't arugue with a mod.. I'm the rude one.. The Real 87's code was totally appropriate and I totally personally insulted baggers by spelling his name wrong.

Back in a year.. when patch 7.8 Final Beta comes out

Mod if you have any brains lock this post...

The proceeding text contains 50% sarcasm
Be sure to apply it to the right places.

Dark Days Software
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 4th Apr 2005 14:08
Learn some manners. I'm not locking it because of them

<maddox> yeah, most help channels tend to be elitist.. "HOLY ---- YOU ------- IDIOT, YOU SHOULD KNOW THAT ALREADY. NEVERMIND THE PURPOSE OF THIS CHANNEL!
--Mouse

Login to post a reply

Server time is: 2025-06-05 20:50:02
Your offset time is: 2025-06-05 20:50:02