US 20070004486 A1
The invention is the computer game software, article of manufacture, and related system for generating swinging-chain-like behavior in the image of loosely connected objects consequent to applying a force upon one of the objects. The specific embodiment illustrates its application in a computer-based solitaire game, wherein the player in moving a pile of cards from one column to another drags the top card by cursor, which causes the connected (overlapping) cards aligned underneath to follow not as a single object, but a loose chain that swings and sways when the top card is dragged and which continues its oscillation momentarily after the player has finished dragging the top card.
1. A computer system comprising a central processing unit of the capability meeting or exceeding the microprocessor capability of a Pentium 100 with at least 8 MB of RAM, suitably connected with an input device and a monitor, and containing or applying software that generates the image of a series of chained objects aligned by a constant vector but articulating with respect to one another, such that application of a vector by external input, lateral to the constant vector, upon one link will cause that link to move in accordance with that input, but which in addition will cause the connecting links, while remaining connected at all times throughout the operation, to angle away and trail the movement of the first link, and which trailing links will continue to move after the external input ceases and the first link stops, said trailing links passing through that position of alignment defined by the constant vector, to a point in the same direction of movement but further, then returning to said position of alignment, thereby resembling the action in the real world of a chain hanging by application of the constant vector of gravity, which by application of a lateral force upon an upper link causes the lower links to at first lag behind the moving top link, then swing and sway after the lateral force is applied and the top link has stopped, past the point of vertical alignment, then returning to a position at rest in vertical alignment.
2. The application of
3. A software routine providing a method that generates the image of an object chain aligned by a constant vector but articulating with respect to one another, and providing that application of a vector by external input that is lateral to the constant vector upon one link will cause the connecting links to angle away from the direction of travel, and trail the movement of the link acted upon externally, and which trailing links will continue to move after the external input ceases, passing through a position of alignment according to the constant vector to a point in the same direction but further while curving in the direction of travel, then returning to a position of alignment with the link upon which the variable vector had acted, thereby resembling the action in the real world of a chain hanging by application of the constant vector of gravity, which upon application of a lateral force upon an upper link causes the lower links to swing and sway past the point in time and space of the application of the lateral force, before returning to a position at rest in vertical alignment.
4. Software for achieving the result described in Claim no. 3, comprising the following:
a. A string of nodes, in turn comprised of at least a primary node and a terminal node, and one or more intermediate nodes;
b. A constant vector (“gravity”) that aligns the string at rest in a fixed direction, and which continues to act upon the string when the string is acted upon by another vector;
c. A variable vector (“drag vector”) for moving the chain in a direction more or less perpendicular to the direction of the constant vector;
d. An input for applying said variable vector; and
e. An object or chain of objects visible on the computer screen, in number one less than the number of nodes, the location and orientation of said objects being determined on a frame-by-frame basis by the location and orientation of the node string.
And further consisting of a computer-based method for generating the swinging chain effect heretofore described, comprised of the following:
a. Variable input moves primary node as directed;
b. Terminal node moves in trailing fashion, i.e., delays in commencing movement before ‘catching up’ such that application of the variable vector by input causes the nodes to be aligned away from vertical (‘vertical’ being the alignment by application of the fixed ‘gravity’ vector), and wherein the end further from the primary node is angled away from the direction of travel;
c. Intermediate nodes, if present, trail in intermediate fashion at an intermediate angle (relative to the primary and terminal nodes) such that the entire string is, after application of the drag vector upon the primary node, aligned in a curve away from the direction of the primary node's travel, with the degree of angle of a particular node segment being a function part of the number of nodes it is removed from the primary;
d. Upon cessation of the drag vector input, the primary node ceases movement in real time;
e. But the other nodes continue through to ‘catch up’ in alignment, i.e., move to a position of vertical alignment under the primary node, but pass through that position in the direction the primary node had been travelling in a fashion creating a mirror image of the curve referred to in subparagraph ©, above. I.e., the angle of each node segment increases as a function in part of the number of nodes that node segment is removed from the primary, but with the deflection of the bottom of each segment from vertical now in the direction of the (now stopped) travel of the primary node, and with the entire chain curving forward in the direction of travel with maximum curve at the terminal node, rather than trailing as before.
f. Thereupon there is a “cracking of the whip” at the terminal node end of the string, wherein the string stops movement, then reverses direction toward the postion of vertical alignment, dampening as it approaches that position and then stopping as it reaches it. (Embodiments wherein there is a dampening of amplitude through more than one oscillation, in the manner of a pendulum, are an obvious extension and are claimed).
5. A computer-based method for creating the effects seen on a computer monitor as have been described heretofore, comprising the following:
a. A list of spring nodes is created, one for each object or chain segment being represented on the monitor, plus a termination node. The position of the first (primary) node is assigned to match the movement of the object being directly acted upon by the input (variable) vector. Initial positions of nodes following the primary are determined by applying each node's velocity to its position. The relative angle between nodes is restricted and each node is repositioned to be a constant distance from the preceding node. The difference between the initial position and final position is multiplied by a mass factor (best mode of 0.05 to 0.1, with 0.10 applied to the attached embodiment) to the velocity of each node. Changes are applied using a fixed timestep to keep the simulation stable and consistent regardless of extremes or variations in the display framerate. The objects are positioned at the corresponding spring node, offset by an anchor position, and oriented along the angle to the following node. If the first card was not originally oriented along the gravity vector, it is rotated into line over several frames.
b. Initialization: If two or more objects are supplied, the spring length is determined from the distance between the first two cards; otherwise a default value of at least one pixel is used, with a best mode of 20 pixels, more or less. An anchor offset where each card is attached to the spring node is determined from the card height and the spring length. A list is built of spring nodes, one for each object plus one additional node at the bottom (terminal node). Beginning with the position of the first object, each spring node is initialized to be positioned below the initial position, spaced by the spring length, and assigned a velocity of zero.
c. Update timing. In each subsequent frame, the spring system is updated. The time since the previous frame is divided into fixed-length timesteps. (The best mode is between 10 and 80 frames per second, with 20 frames per second used in the attached embodiment.) Any remaining time is saved and applied to the next frame. Any movement of the first card since the previous frame is divided equally among the available timesteps.
d. Node updating.
i. The drag vector is found by subtracting the first node's position from the position of the first object;
ii. Velocity increase from ‘gravity’ (the fixed vector that aligns the string at rest) is determined by multiplying the gravity vector by the timestep. If the angle of the drag vector is close to the gravity vector, than gravity velocity is enhanced by the drag movement. (The best mode is no more than 30 degrees, and 30 degrees is used in the attached embodiment.)
iii. For each node after the first, prior velocity is dampened by multiplying prior velocity by a constant of less than 1.0. The best mode is near 1, with the value used in the attached embodiment being 0.9.
iv. Acceleration due to gravity is applied to the velocity;
v. Velocity is applied to the node's position; and
vi. A copy of the position determined by velocity alone is saved.
e. Angle restriction. For each node, from the primary to the end:
i. The direction of the vector from the previous node (or to gravity if it's the first node) is determined;
ii. The angle between the two vectors is found, clamping to (best mode) +/−90 degrees;
iii. The angle range is mapped onto the angle limit such that a (best mode) angle of 90 degrees becomes an angle of limit;
iv. The next node is repositioned relative to the current node using the adjusted angle.
f. Spring length restriction. For each node, starting with the first, the vector is determined to the next node, the vector is adjusted so length is equal to the spring length, and the node is positioned relative to the current node offset by the adjusted vector.
g. Momentum. For each node, starting with the first:
i. Determine movement vector between fmal position and position saved after applying gravity;
ii. Determine acceleration by dividing movement (velocity over this tic) by a mass value for the node. The best mode is between 1 and 10;
iii. Clamp acceleration to a maximum value, whose best mode is near 3.
iv. Apply acceleration to node's velocity;
v. Snap velocity to zero if it is close. The best mode definition of ‘close’ is less than or equal to value between zero and one, with a maximum of 0.1 being used in this embodiment.
h. Object orientation. For each object:
i. Determine unit direction vector from object's spring node to the next node;
ii. Scale the vector by the anchor offset;
iii. Add the vector to the node position to get the object position;
iv. Rotate the object by the angle between the direction vector and zero degrees.
v. In certain applications a first object or single object may have an orientation other than along the gravity vector; if so upon operation of this sequence it is reoriented to ‘up and down’ over a short period of time. The best mode as applied in the attached embodiment is 180 degrees per second.
6. An application of the methods described in claims 4 or 5, wherein the objects referred to are playing cards, and the chains or strings referred to are “piles” of cards, each pile consisting of a plurality of cards that are moved as a single unit in accordance with the rules of the particular card game being played. The attached embodiment marked “Appendix A” is for the game known as “solitaire.”
7. Embodiment and article of manufacture of what is claimed in
Provisional Patent, application Ser. No. 60/540.059.
Not applicable, no federally sponsored research and development.
The field of art is computer software; more particularly, it is the depiction of virtual objects and their movement on a computer screen in response to external input, as is commonly found in computer games. Many computer games involve a pictoral representation of reality on a computer monitor, and it is one goal of game developers to improve the fidelity to the real world of such representations, including the representation of physical laws, because the market demands improvements in realism. Developments that improve such over the prior art, at least in terms of better evoking some aspect of physical reality, thereby meet the requirements of novelty and utility for patent protection.
Consider, for example, the movement of a solid object across the table. As long as force is applied, it moves, and when we stop applying force friction and gravity bring it to a halt. This is adequately done in the prior art by “dragging” the virtual object across the virtual surface with a cursor whose motion is generated with a mouse; when we drag, it moves as a single unit, and when we stop it stops. But the realism exists only if the object is treatable as a unit. Suppose the object is actually a loose connection of segments that may not in the real world move uniformly upon application of a vector upon one segment? In that instance, a more realistic game would reflect a “messier” effect. Consider in the real world holding a metal chain at the top link, with the rest of the chain hanging freely, and we suddenly move the top link a few inches to the side. The top link moves like the single object, stopping and starting in real time with our input. But the links hanging behave differently. What we see is that each link (moving down the chain) lags slightly behind the link above it, that the angle consequently increases from vertical toward the direction of the starting point as we move down the chain, i.e., the bottom trails. It then catches up, but moves through the position directly below the (now stopped) top link to a position that is a mirror-image of its trailing position, then returns in one or more oscillations of decreasing amplitude until dampened back to a position parallel to its original pre-movement position. In other words, moving the top link does not move the chain as a unit, but causes it to swing and sway before the new resting position is achieved.
Applicant's invention includes a software routine that mimics that action, where there is an “object” that is a functional unity, but where the object sought to be moved actually is a segmented string of objects in which the individual segments articulate with respect to one another, like the links of a chain.
The specific embodiment in the code submitted describes the routine as applied to the most common version of the card game known as “solitaire”. The game involves in part moving “piles”, i.e., aggregates of cards ordered a certain way with each card identifiably visible, from one location to another. A particular pile may be moved as a functional unit from one location to another. In the prior art (i.e., computer-based solitaire games), moving such a pile by dragging a cursor moves the pile as a graphically represented single unit, which is to say the position of the cards that comprise the pile being moved do not move vis-a-vis one another. Unless a solitaire player in the real world is in the habit of gluing together the cards before he moves them as a group, the representation provided by the prior art is unrealistic. In the embodiment of the subject of this application, dragging the uppermost card will drag the associated pile in a fashion that causes the associated cards to swing and sway, as though the cards were links of a chain. Of course, a real world alignment of playing cards does not behave like a chain either, but the dynamics of treating the pile as though it were a string divided into segments enables the player, while moving them as a unit, to be reminded that the card pile, while functionally at that point in play is actually composed of separate cards whose connection with others in the pile is temporary and functional only; the internal articulation and the swinging and swaying of the string as a whole entertainingly evokes a certain aspect of reality, the comparative “messiness” of moving an aggregate of individual objects only “connected” for a limited purpose in a way that the prior art does not; thus has the new program routine both novelty and utility.
An embodiment in the form of an ASCII form code listing is recorded on disc, of which two copies are appended hereto (Appendix A); as is the embodiment in the form of the actual commercial product, being a disc of the resultant article of manufacture, the computer game “Hardwood Solitaire II” (Appendix B.)
The subject of this application is a software routine and method, and associated systems, involving the representation on a computer screen of the movement of an object or chain of objects connected but positionally articulable vis-a-vis one another, said chain which at rest is aligned in response to a constant vector, but when acted upon in a direction other than the constant vector by external input, will move as a whole and articulate internally in a manner that mimics the real-world behavior of a hanging segmented string or chain of objects upon application of a lateral force upon the top link, i.e., the bottom link will trail and angle with intermediate links trailing and angling to an intermediate degree, upon cessation of the external input will then swing through vertical alignment to a certain point, then return to a vertical and still position after the external input is removed.
More particularly, the embodiment presented herein is for a card game that involves, inter alia, moving piles of overlapping cards laterally across the playing surface by ‘dragging’ the uppermost (in two dimensions, toward the top of the screen, what would actually be partially underneath in a real world, three-dimensional setting) with a mouse cursor, and which by application of this program creates the image of the overlapping cards below (i.e., toward the bottom of the screen) being dragged in a trailing and angled fashion (location and angle being proportional to the distance from the card being directly acted upon), and in which when the external input is removed (i.e., the cursor stops dragging) the card being directly acted upon stops moving, but the trailing cards continue, “catch up” and then pass through vertical alignment to a position further then the stopped position of the card directly acted upon, then swing back to a position and alignment parallel to the position and alignment prior to the external vector being applied. In other words, the card pile swings and sways in a fashion resembling that of a freely hanging chain when moved from one place to another. In applications involving the movement of a single card, it changes alignment (the bottom edge trails) during movement, then returns to original at-rest alignment when the external vector is removed. The system environment for the embodiments appended is a connected central processing unit with microprocessor capability equal to or exceeding a Pentium 166 and memory equal to or exceeding 32 MB of RAM, connected with an input device such as a mouse, and connected to a monitor.