View previous topic - View next topic |
Author |
Message |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Aug 28, 2011 3:13 pm Post subject: |
[quote] |
|
OK I thought of a way to make a decent mini RPG on one screen-wide board.
It involves an elevator.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Thu Sep 01, 2011 11:45 pm Post subject: |
[quote] |
|
Basic synopsis for this game: a shoot'em up. No leveling, but coin collection for a shop. The story: jewels have been created that interface with reality on a fundamental level (I'm thinking they turn the surrounding matter into nano-machines). The protagonist has stolen these jewels and is trying to escape with them on an elevator to a sky city. I'm thinking he was hired by the people controlling this city, and has absconded with it. He takes the operator of the elevator hostage, but ends up bonding with her over the course of the ride. Something happens on the elevator which clues him in on the wonderous nature of the jewels and endows him with a sense of responsibility he otherwise wouldn't have had. This sets up the endgame scenario, as he begins to question who should have control of the jewels and for what purpose.
The elevator is under constant attack by robots controlled by the jewel creators. There is also a task force in their employ.
The most difficult aspect of the game will be creating the motion mechanics for the player. The idea of programming jumping is outright intimidating, especially in the case of a vertical north-to-south leap. On the one hand the player is rising up, but they are also moving down.
|
|
Back to top |
|
 |
Verious Mage

Joined: 06 Jan 2004 Posts: 409 Location: Online
|
Posted: Mon Sep 05, 2011 1:02 pm Post subject: |
[quote] |
|
You may want to check-out the excellent tutorials here:
http://www.tonypa.pri.ee/tbw/tut07.html
They are oriented towards Flash, but the concepts and code are easily ported to other languages.
I would specifically read, "Jumping", "Clouds", and "Moving tiles".
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Sep 07, 2011 3:50 am Post subject: |
[quote] |
|
Thanks Various. I'm working on the project again. I find myself stymied though, by bugs, particularly NaN errors and DHTML formatting issues. They keep cropping up... it would be great if someone could help me look over the code and find out what's going wrong.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Sep 11, 2011 10:35 pm Post subject: |
[quote] |
|
This project is just so huge... damn time sink. I feel under zero obligation to finish it... people don't seem to care about an HTML 5 GCS one way or the other.
|
|
Back to top |
|
 |
Mattias Gustavsson Mage

Joined: 10 Nov 2007 Posts: 457 Location: Royal Leamington Spa, UK
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Sep 17, 2011 5:09 am Post subject: |
[quote] |
|
I care about walking a walk.
It seems like the kernal is working.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Fri Nov 11, 2011 4:37 pm Post subject: |
[quote] |
|
Actually the kernal is not working. That's the last thing I have to finish. Map saving and loading appears to be working okay. The cheat agent is working, too. So I guess I get the event system going and it'll be operational...
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Nov 19, 2011 9:30 pm Post subject: |
[quote] |
|
So the event kernal is operant, now. However I'm seeing that the sprite coords are returning NaN... thanks, Javascript! I wish there was some way to lock the types of variables... I like the declaration flexibility, but I would prefer that variable types were open to fixing by some mechanism. Because if I had a nickle for every hour I've spent hunting NaN errors...
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Wed Nov 23, 2011 4:51 am Post subject: |
[quote] |
|
OK NaN errors are dealt with (for now) and now the actors are moving on command. Got two immediate priorities, the jumping and increasing the expression calculation abilities of the syntactical analyzer.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Thu Dec 01, 2011 10:41 pm Post subject: |
[quote] |
|
Various the jumping tutorial you offered wasn't particularly useful, but thanks for offering it anyway.
Trying to conceive of action-RPG style jumping. I'm thinking that if I just increase the y coordinates of the sprite, the sprite will "jump" as it moves downward. It's actually a complex illusion to consider because you're on the one hand moving the sprite south, and on the other moving it north. So the actual position of the sprite is the equilibrium between the northward and southward pressures. But, in the descending phase, the northward pressure is steadily reduced, so the sprite moves southward very fast.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sat Dec 03, 2011 12:59 pm Post subject: |
[quote] |
|
OK, I added jumping. Here's the algorithm:
Code: |
function elevateSprite (sprite) {
sprite.downVelocity += sprite.gravity; // accelerate the gravitational velocity
if (sprite.downVelocity > sprite.terminalVelocity) sprite.downVelocity = sprite.terminalVelocity; // adjust for terminal velocity
sprite.risingVelocity = sprite.risingVelocity - sprite.downVelocity; // apply the gravity
sprite.elevation =+ risingVelocity;
if (sprite.risingVelocity < 0) { // is the sprite rising or falling?
sprite.isAscending = 0;
sprite.isDescending = 1;
}
if (sprite.elevation < 0) { // is the sprite level?
sprite.isElevated = 0;
sprite.isLevel = 1;
sprite.risingVelocity = sprite.risingVelocity + sprite.elevation;
}
}
|
Now what I'm seeing is that I need a timer by which to apply the gravity. I'm also seeing that I am going to have frame motion step issues. Not to mention that making the sprite jump a specific length of tiles is gonna require some special timing. I'm thinking I should use the quadratic equation to chart a parabola for the sprite to follow, in that case.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Dec 04, 2011 7:27 am Post subject: |
[quote] |
|
Algorithm for finding the rate of upward/downward force over a fixed breadth of tiles:
Code: |
function leapAcrossTiles (sprite, distance) {
var risingVelocity = 0;
var downVelocity = 0;
var ascendencyIndex = 0;
var apexPoint = (distance * map.tiles.width) / 2;
while (risingVelocity > 0) {
downVelocity += sprite.gravity; // accelerate the gravitational velocity
if (downVelocity > sprite.terminalVelocity) downVelocity = sprite.terminalVelocity; // adjust for terminal velocity
risingVelocity = risingVelocity - downVelocity; // apply the gravity
ascendencyIndex++;
}
sprite.riseRate = Math.floor(apexPoint / ascendencyIndex);
}
|
The problem is it's not smooth motion. If it happens slowly enough, there will be noticeable "springs" in the motion from one elevation to another.
Edit: I made a mistake. I added the down velocity to the rising velocity instead of the original force, which was an error because the rising velocity was thus modified. Gravity acts continuously against the original force vector until it no longer has effect, but the force itself is not eliminated. Or, that's how I'm thinking of it in this case, anyway. The force is inferred from the velocity, I suppose if the velocity in the vector of the force falls below zero that means the force is no longer extant.
I need to infer the points at which the sprite nudges upward by a single pixel along the parabolic arch. How is that possible when the gravity is measured at a steady rate? What is the rate within the rate?
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
Posted: Sun Dec 04, 2011 11:05 am Post subject: |
[quote] |
|
OK there's no getting around the math, so...
http://tutorial.math.lamar.edu/Classes/Alg/Parabolas.aspx#Graph_Para_Ex1_a
I hate using any formula that relies on squares. It just seems so chaotic and inexplicable.
If I set the Y intercept at the origin (0), and the vertex at the peak of the jump, then I can find any y for any x. Then I can transform the coordinates to the appropriate orientation.
|
|
Back to top |
|
 |
tcaudilllg Dragonmaster

Joined: 20 Jun 2002 Posts: 1731 Location: Cedar Bluff, VA
|
|
Back to top |
|
 |