3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: Math & decimal place & EOI object & networking :)  (Read 225 times)

« on: December 09, 2013, 11:07:39 PM »
In my project my cameras will allow mouse screen positions iMouseX() & iMouseLookX() ect, to control my ship rigidbody movements ( as well as keyboard key input ).

in a networked project this is an issue, because the mouse cursor positions don't have networking options, and need to be proportional.

I have a solution -

An EOI object is a float by design and supports values from 0.0f to 1.0f

I can pass a mouse value like 12.734 to the EOI but as soon as the value reach's 1 or greater, it tunicates to 1.0.

so i have the idea to take say 12.234 for instance and shift the decimal place 2 places to the left to become 0.12234, then after the value is networked by EOI, i can re-shift the decimal place back 2 places to the right.

This would allow me to network the mouse positions using the EOI objects and not have to use the network array process.

I'm NOT looking for a network array solution here, but only a math process to shift the decimal point in both directions so the EOI object can handle the networking process for me.

I'm assuming the EOI object can handle the networking routines much better than any scripted process i can come up with, i only need a math process to shift the decimal place left and right by 2 places.

Got any ideas ?
« Reply #1 on: December 10, 2013, 01:30:03 AM »
couldn't you just divide by 100 this side then multiply by 100 on the other side? as long as the mouse value is never greater than 99.
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11
« Reply #2 on: December 10, 2013, 01:01:03 PM »
i think that mite work actually ( divide by then multiply by )

I figured the process would be simple, just my old brain and maths...

So i thought id ask here and save my self some trouble.

Thank you genetransfer.

i will need a factor higher than 100 though, more like 10,000

I shall play with this.
« Reply #3 on: December 10, 2013, 07:27:42 PM »
no problem, I actually had to second guess myself on the idea because it seemed too simple.
I think the only problem that could arise is how many places of precision can be read back after transport.
can't remember how many places after the decimal are supported by float but I'm sure you'll figure it out,
been so long since I used rad, I almost can't remember a thing now lol, I'm getting old too.
using 3Drad 7.22

system specs:
Windows 7 Home Premium 64-bit
Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz (4 CPUs), ~3.2Ghz
8 gig ram
Geforce GTX 650 1024 MB GDDR5
DirectX 11
« Reply #4 on: December 10, 2013, 07:41:01 PM »
It will work perfectly.

I just had a thought though -

taking 12.234 divided by 1000.000 .. oh no..

So a quick test on my calculator shows it wont be a problem.. the key is using a factor big enough for the largest input value.

Use that on both sides... works perfectly, and the EOI object can handle 9 or more decimal places, which is way more precision than i need. :)
Pages: [1]