Drawing a path in-game

Posts: 14
Joined: 2009.04
Post: #1
Hey guys,

Does anyone know how you create/store "paths" that the user draws on screen during game play? I'm thinking of games like Flight Control (where the player needs to draw a path for each airplane to the appropriate runway).

Is it done by storing every pixel of the path in an array? Using a lot of waypoints and straight-lines in-between? Using a few waypoints and spline interpolation? Something else? How many times a second would you need to record a point?

(This is more a "technique" question as opposed to technical - I already know how to sense touch events and what-not.)
Quote this message in a reply
Posts: 1,488
Joined: 2002.09
Post: #2
You already don't get per-pixel input. It tends to come in maybe 10 times a second or so anyway.

A pretty simple solution to the problem is to record every input value that is more than a certain threshold distance from the last recorded input value. Smoothing the points out using splines might be a plus, but you probably won't notice anyway.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Posts: 455
Joined: 2003.08
Post: #3
On a semi-tangent, I really like when the lines I draw on screen (on something like an iPad or iPhone) are smoothed out, makes it feel more natural to the way my finger went, rather than a bunch of line segments.
Quote this message in a reply
Posts: 14
Joined: 2009.04
Post: #4
Hmmm... seems I'll have to look into that whole "spline thing" then. Smile

But I do agree, seeing a nice smooth path does look the best.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Get path to user's "Application Support" folder Meh123 5 6,046 Nov 7, 2008 12:07 PM
Last Post: Wowbagger
  Path Finding bwalters 22 14,119 Mar 27, 2006 11:36 AM
Last Post: Blacktiger
  file path from NavReplyRecord? frac707 2 3,906 Mar 2, 2005 05:14 AM
Last Post: Hog