LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Variable speed objects in ASCII games?

Root / Programming Questions / [.]

ahavasandwichCreated:
On of the problems in making a PRINT based game is having objects and players moving at different speeds. In other games I can just use something like x=x+vx where the absolute value of vx can be increased to increase the object’s speed. However in ASCII games this would cause the object to noticeably skip parts of the map along it’s path of motion. I’ve thought of one way around this. It would involve a system of flags that would dictate whether or not an object would increase or decrease it’s position by 1 for each program loop. This seems to make sense to me, but I’m not sure if this is the right way to go about it. I know altering VSYNC would affect the speed of all object evenly, so that wasn’t given a second thought. Bad idea or good idea?

If I ever need sub-pixel movement speeds, I store position as real numbers and increment by something less than one. When it's time to place the objects, I ROUND() their position values. Maybe not the most efficient way of doing it but it always works for me.

If I ever need sub-pixel movement speeds, I store position as real numbers and increment by something less than one. When it's time to place the objects, I ROUND() their position values. Maybe not the most efficient way of doing it but it always works for me.
That's something I wouldn't have thought of. That sounds waaay easier. Thanks for the input!

I wonder if you could also do more frames for the objects that are moving faster. If velocity is greater than a threshold then update, draw, update, draw.

I experienced this issue(It's called collision tunnelling). One way to handle this problem is to use raycast to detect if there are object between the initial position and the final position of the object on each frame.

I wonder if you could also do more frames for the objects that are moving faster. If velocity is greater than a threshold then update, draw, update, draw.
That was the original idea that I had, but I think it would require a lot of work in light of slackerSnail's idea. I haven't tried either idea out yet. I should get the chance to after my last final today.

I experienced this issue(It's called collision tunnelling). One way to handle this problem is to use raycast to detect if there are object between the initial position and the final position of the object on each frame.
I don't know a lot about raycasting. How would I go about do this?

I experienced this issue(It's called collision tunnelling). One way to handle this problem is to use raycast to detect if there are object between the initial position and the final position of the object on each frame.
I don't know a lot about raycasting. How would I go about do this?
In general terms.

Raycast is to check if there is a obstacle between the origin point and the destiny point. You draw a line and if the line overlap a object, then it detect a collition. I haven't implemented this, but if there is a big distance between the origin and destiny point, then you could use other algorithm to solve this issue. One way is using sweep collition detection: http://www.gamedev.net/page/resources/_/technical/game-programming/swept-aabb-collision-detection-and-response-r3084 Other way is to use quad tree to easily find the object that could intersect the trayectory. However, I don't know the cost of creating such structure. http://gamedev.stackexchange.com/questions/34602/raycasting-collision-detection

Raycast is to check if there is a obstacle between the origin point and the destiny point. You draw a line and if the line overlap a object, then it detect a collition. I haven't implemented this, but if there is a big distance between the origin and destiny point, then you could use other algorithm to solve this issue. One way is using sweep collition detection: http://www.gamedev.net/page/resources/_/technical/game-programming/swept-aabb-collision-detection-and-response-r3084 Other way is to use quad tree to easily find the object that could intersect the trayectory. However, I don't know the cost of creating such structure. http://gamedev.stackexchange.com/questions/34602/raycasting-collision-detection
Thanks for the information and the links. You've given me something to study during my downtime. :)