Sign in to follow this  

representing position WITHOUT using FLOAT

Recommended Posts

Hi, I have a question. Does game programming usually represent position using integer-based type instead of float? Thing is, I've been playing this multiplayer RPG, and since the physics is simple (no jump, movement is click-based, player can only move in "valid" regions of the map) they use integer to represent the player position. (I know this by "sniffing" at the packets received :p). And somewhere I ever read a blog that suggest that we better represent position using integer, since precision will be lost on big numbers.


This gives a big question mark upon my head:

1. How could the position be represented by using integers? what about when we render the object? shouldn't we be using float?

2. The game I played use integer for representing position, however, the object move smoothly (unless there's lag which will make it slide), as if it's using float. How would I achieve this?

3. Now, my game is similar. Object can only move on valid pathfinding nodes, so invalid movement are never allowed. Plus there's no jumping, the physics is very simple (it's click point adventure puzzle game). Now, how would I move object using integer-based coordinate?


Thanks for the wisdom you are willing to share with me.


Share this post

Link to post
Share on other sites



I think this is what supposed to be done. Well, it seems for no I'll just use floats. Whatever floats my boats :p


I got another question, but I think I'll just make another thread about it. Thanks Mr. Hodgman

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this