Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
GlyphGryph
Jun 23, 2013

really israel could slaughter all these children without our help, I just didn't want to miss out on the chance to participate

anothergod posted:

This gif turned out pretty OK.



I really want to play... whatever this is. That's quite an interesting aesthetic you've got going on.

Adbot
ADBOT LOVES YOU

Imaginary Friend
Jan 27, 2010

Your Best Friend

GlyphGryph posted:

I did not get the sense that Imaginary Friend was just a designer/writer, was just sharing a technical example of "how I would do it".
Well I wouldn't call myself a programmer, but I got some of the stuff you wrote at least :)

Also, good thing I broke both my legs longboarding so I have time to add useless stuff to my game! When entering blah-mode, different kinds of blah's are jumbled together with keywords that are tagged with [blah] in the text file. The keywords in there are food and here so I actually managed to create some weird kind of blah-language! :)


edit with amazing car because I've been posting too much.

Imaginary Friend fucked around with this message at 20:41 on Sep 29, 2016

D34THROW
Jan 29, 2012

RETAIL RETAIL LISTEN TO ME BITCH ABOUT RETAIL
:rant:
I haven't seen anything about it recently and the latest Google results are old as poo poo: whatever happened to that one game somebody in here was working on called Black Annex? The one done in QBASIC? That poo poo was awesome!

Count Uvula
Dec 20, 2011

---

D34THROW posted:

I haven't seen anything about it recently and the latest Google results are old as poo poo: whatever happened to that one game somebody in here was working on called Black Annex? The one done in QBASIC? That poo poo was awesome!

I would assume it's trucking along very slowly because it's written in QBASIC.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

This is looking pretty great. Keep it up!

theroachman
Sep 1, 2006

You're never fully dressed without a smile...
That would be Mug, and his most recent post that mentions the game is about a year old and it's here: https://forums.somethingawful.com/showthread.php?goto=post&postid=451406209#post451406209

But it seems like he hasn't mentioned the game on his Twitter account for the last month at least. Couldn't be bothered to scroll down further. Perhaps shoot him a PM?

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
In preparation for the Octojam, I had a bit of a play today: http://johnearnest.github.io/Octo/index.html?gist=3cc3c1274ca165644a7d50281555e321
WASD to move, E to shoot.

Got to look into saving and loading registers, or at least refactoring to use less of them, if I want to add something to shoot at.

MariusLecter
Sep 5, 2009

NI MUERTE NI MIEDO

Imaginary Friend posted:

Well I wouldn't call myself a programmer, but I got some of the stuff you wrote at least :)

Also, good thing I broke both my legs longboarding so I have time to add useless stuff to my game! When entering blah-mode, different kinds of blah's are jumbled together with keywords that are tagged with [blah] in the text file. The keywords in there are food and here so I actually managed to create some weird kind of blah-language! :)


This is pretty much how I interact with people IRL, will definitely want this when it's done.

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

FuzzySlippers posted:

Do you guys think it is tacky to mention other games to let customers know how your game plays easily? Like I remember a game on Steam just said "like advance wars" which saved them a butt ton of words describing advance wars and I knew what they meant and if someone didn't they went on to explain a bit more.

In theory that's a great way to get your point across but in practice I imagine humanity will ruin it. I enjoyed the pants off Advance Wars and if somebody made a game that was Like Advance Wars but with Minor Twist I'd be all over it.

Except that it's too easy a marketing ploy to pass up. So there are going to be a ton of games that claim to be Like Advance Wars, when what they really mean is Like Advance Wars but Crappy. Which ruins the credibility of that form of pitch.

This is unfortunate, because half of the games I want to see made are essentially X + Y. Like a SHMUP plus Juggler -- the enemies you shoot turn into flaming wreckage that you have to bounce in the air because if it lands on the city you're trying to protect, they get pissed at you. But feel free to lay waste to the forest intervals.


Once this mechanism is finished, I think we need to proselytize. This is clearly the One True Way, and now I'm going to be retroactively angry at all the other games I play that Do It Wrong.

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

Physics Question

I want my skeletons to lob bones in parabolic arcs that will hit the player if they don't move -- standard physics engine stuff.

When a skeleton is ready to throw, I know the position of the bone, the position of the player, the value of gravity, and the angle at which they intend to toss it. What I don't know is the initial velocity to give that projectile so that its trajectory intercepts the player.



What's the formula to find this?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Hammer Bro. posted:

Physics Question

I want my skeletons to lob bones in parabolic arcs that will hit the player if they don't move -- standard physics engine stuff.

When a skeleton is ready to throw, I know the position of the bone, the position of the player, the value of gravity, and the angle at which they intend to toss it. What I don't know is the initial velocity to give that projectile so that its trajectory intercepts the player.



What's the formula to find this?

Google for ballistic trajectory formula. Specifically look at the "angle required to hit coordinate" section.

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

TooMuchAbstraction posted:

Google for ballistic trajectory formula. Specifically look at the "angle required to hit coordinate" section.

That gives the formula to find an unknown angle:



I've got a fixed angle, so I'd need to solve that equation for v. I'm not sure my algebra is up to that standard anymore, but I'll spend some time on it.

Obsurveyor
Jan 10, 2003

Hammer Bro. posted:

That gives the formula to find an unknown angle:



I've got a fixed angle, so I'd need to solve that equation for v. I'm not sure my algebra is up to that standard anymore, but I'll spend some time on it.

If you need more guidance, this is a good article:

https://blog.forrestthewoods.com/solving-ballistic-trajectories-b0165523348c#.2j112v87k

Polo-Rican
Jul 4, 2004

emptyquote my posts or die
Honestly, for this use case, I'd just solve it using a little guess and check. If you were making a golf game or a tank game or something, then it would be worth really hitting the books. A skeleton throwing a bone?... I dunno...

1. pick a y-velocity and gravity value for the projectile that feel good
2. do a test throw with x-velocity=10 and see the distance it travels in pixels
3. (x-distance in pixels / 10) = the distance / x-velocity ratio you can use

Add a slight amount of randomness to each throw and that's probably good enough that nobody will ever complain. if there are lots of circumstances where the thrower is above the player, you can figure out a similar ratio that decreases the x-velocity if the y-distance is positive.

This is a better solution in some ways because it's super easy to add maximum and minimum x-velocities, so your skeleton whiffs bones in the air if the player is too far away.

Polo-Rican fucked around with this message at 19:09 on Sep 29, 2016

anothergod
Apr 11, 2016

Polo-Rican posted:

Honestly, for this use case, I'd just solve it using a little guess and check. If you were making a golf game or a tank game or something, then it would be worth really hitting the books. A skeleton throwing a bone?... I dunno...

1. pick a y-velocity and gravity value for the projectile that feel good
2. do a test throw with x-velocity=10 and see the distance it travels in pixels
3. (x-distance in pixels / 10) = the distance / x-velocity ratio you can use

Add a slight amount of randomness to each throw and that's probably good enough that nobody will ever complain. if there are lots of circumstances where the thrower is above the player, you can figure out a similar ratio that decreases the x-velocity if the y-distance is positive.

This is a better solution in some ways because it's super easy to add maximum and minimum x-velocities, so your skeleton whiffs bones in the air if the player is too far away.

Yeah I agree a lot here. The work involved in making this "AI" be perfect is a lot, but the player will understand that all they have to do is move. If you compare that to Hammer Bros. in Mario or Skeleton Throwers in Castlevania, they throw things relatively close but mostly randomly, and the player's response becomes much different and is more about judging the minute differences in stimuli.


GlyphGryph posted:

I really want to play... whatever this is. That's quite an interesting aesthetic you've got going on.

Thanks man! Have another gif :)



An older version of the game is up on itch.io as Super Combat Jr 2. That version is multiplayer only and mostly controller based, but we're working on ideas for single player and KBM. We made quick two week game using a similar art style earlier this month, too: https://interdimensional.itch.io/guulbusters-ii. It's, uh, not exactly fully fleshed out, but we tested a lot of the ideas we wanted to get done for the Combat Jr revision.

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

Thanks to everyone for all the feedback so far. It's given me a lot to chew on.


Dang, that is quite the article.

Unfortunately, there may still be a bunch of maths in my future, as it covers:
  • Given a projectile with fixed speed S and launch angle θ...
  • Given a projectile with fixed speed (S) and gravity (G)...
  • Given a projectile with lateral speed (S) and peak height (y_peak)...
  • Some crazy stuff involving Quartics and, among other knowns, projectile speed...

I still feel like somebody ought to have the formulas re-arranged for unknown speeds, but apparently it's not the most common of use cases.

Polo-Rican posted:

Honestly, for this use case, I'd just solve it using a little guess and check. If you were making a golf game or a tank game or something, then it would be worth really hitting the books. A skeleton throwing a bone?... I dunno...

1. pick a y-velocity and gravity value for the projectile that feel good
2. do a test throw with x-velocity=10 and see the distance it travels in pixels
3. (x-distance in pixels / 10) = the distance / x-velocity ratio you can use

Add a slight amount of randomness to each throw and that's probably good enough that nobody will ever complain. if there are lots of circumstances where the thrower is above the player, you can figure out a similar ratio that decreases the x-velocity if the y-distance is positive.

This is a better solution in some ways because it's super easy to add maximum and minimum x-velocities, so your skeleton whiffs bones in the air if the player is too far away.

The skeleton throwing a bone was just the first representation. I expect to have many types of projectiles that are subject to gravity, and therefore follow parabolic arcs. They'll all be trying to hit the player, who has free mobility and therefore is unlikely to be level with them. And it doesn't make sense to me to solve for the angle.

Maybe I want to have wall-mounted cannons that clearly adjust their angle slowly and fire periodically -- if I don't solve for velocity, then most of their shots are unlikely to go anywhere near the player. If I solve for the angle, then it's as if the cannons are always pointed directly at the player, which strikes me as unsavory. If I fix the travel time, then dodging them becomes a very routine and mechanical act; jump every N seconds.

(Actually, now that I've thought it out, I do want a high tower of oscillating cannons that you have to jump your way to the top of safely. So I should continue hunting for the general solution.)

anothergod posted:

Yeah I agree a lot here. The work involved in making this "AI" be perfect is a lot, but the player will understand that all they have to do is move. If you compare that to Hammer Bros. in Mario or Skeleton Throwers in Castlevania, they throw things relatively close but mostly randomly, and the player's response becomes much different and is more about judging the minute differences in stimuli.

That's what surprises me. This ought to be a solved issue. Indeed it is solved, just most of the solutions are in terms of different variables than I want to use. I feel like if my fundamentals weren't so ancient, it would be easy to derive the formula I'm looking for.

And this is honestly the kind of thing I lose sleep over. Stupid micro-perfectionism.

xzzy
Mar 5, 2009

It's easy to do if you want to fake it without physics, the distance from skeleton to player is a diameter. Midpoint of that line is the center of a circle/ellipse and the path of the projectile is the circumference. Now you make a sin/cos call at each step to generate a new X,Y coordinate for the projectile.

From an old script where I did that once upon a time:

code:
for($i = 0; $i <= 3.1; $i += 0.2) {
    
    $newY = $cY + ($r2 * sin(-$i));
    $newX = $cX + ($r1 * cos(-$i));
    
}
(r1/r2 were set to different values to make an ellipse)

Splat
Aug 22, 2002
I'll try and remember to write it out later but:

You can solve for time t w/ the x axis t = Dx / Vx;

Assuming there's some ratio between X and Y, call it C, you can let Vx = C(Vy) and t = Dx/(C(Vy));

then substitute that into the equation:

Dy = VYi * t + 0.5*a* (t^2)

and solve for VYi. One you have Vy, you can mult by C for Vx

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

Splat posted:

I'll try and remember to write it out later but:

I received a similar suggestion to that elsewhere, but either I'm applying it wrong or it fundamentally doesn't work.

If I have an initial velocity V at angle theta, which is what I want to solve, then that can be broken down into its X and Y components:

code:
Vx = V * cos(theta)
Vy = V * sin(theta)
We can also say, by trigonometric identities, that:

code:
Vy = Vx * tan(theta)
The equations for horizontal and vertical motion in a projectile (assuming constant downward acceleration due to gravity and no air resistance), are:

code:
x(t) = Vx * t
y(t) = (Vy * t) + ((1/2) * g * (t^2))
Since we know the horizontal and vertical distances we want to have traveled by time t (in this case, the distances to get from where the bone is launched to where the player is), we can substitute them in:

code:
Dx = Vx * t
Dy = (Vy * t) + ((1/2) * g * (t^2))
If we solve the first of these two equations for t, substitute it into the second equation, then apply our trigonometric identity from earlier, we get:

code:
t = Dx / Vx // Solve for t
Dy = (Vy * (Dx / Vx)) - (1/2) * g * ((Dx / Vx)^2) // Substitute into second equation.
(Vx ^ 2) * Dy = (Vy * Dx * Vx) + ((1/2) * g * (Dx ^2)) // Multiply both sides by (Vx ^ 2) / (Vx ^ 2) -- now the equation will fail if Vx = 0.
(Vx ^ 2) * Dy = (Vx * tan(theta) * Dx * Vx) + ((1/2) * g * (Dx ^2)) // Trigonometric substitution from earlier.
(Vx ^ 2) * Dy = ((Vx ^ 2) * Dx * tan(theta)) + ((1/2) * g * (Dx ^2)) // Simplification.
((Vx ^ 2) * Dy) - ((Vx ^ 2) * Dx * tan(theta)) = (1/2) * g * (Dx ^ 2) // Subtracted ((Vx ^ 2) * Dx * tan(theta)) from both sides.
(Vx ^ 2) * (Dy - (Dx * tan(theta)) = (1/2) * g * (Dx ^ 2) // Factored out a (Vx ^ 2).
Vx ^ 2 = (g * (Dx ^ 2)) / (2 * (Dy - (Dx * tan(theta)))) // Divided by (Dy - (Dx * tan(theta))).
Vx = sqrt((g * (Dx ^ 2)) / (2 * (Dy - (Dx * tan(theta))))) // Square root of both sides.
Given this, and our original trigonometric substitution, we should have:

code:
Vx = sqrt((g * (Dx ^ 2)) / (2 * (Dy - (Dx * tan(theta)))))
Vy = Vx * tan(theta)
I feel like this ought to be correct, but I'm having some trouble with the results. A good portion of those troubles is that the person who originally derived it for me accidentally swapped a Dx and a Dy at one point, and I didn't notice that until I was just now typing it up.

I'm hoping the rest of my troubles are just that I'm physics-frazzled right now, because all of those operations and substitutions feel legitimate to me, but my implementation is behaving badly.

Futuresight
Oct 11, 2012

IT'S ALL TURNED TO SHIT!

anothergod posted:

This gif turned out pretty OK.



That character sprite looks infinitely better with that background than any of the others you've shown so far. The shadows and movement also help I'm sure, but the floor really makes the character pop.

Looking at your next gif the character doesn't look as good on the stairs or the white floor.

I'm not enough of an artist to tell you why though.

Somfin
Oct 25, 2010

In my🦚 experience🛠️ the big things🌑 don't teach you anything🤷‍♀️.

Nap Ghost

Hammer Bro. posted:

Physics Question

The "set angle" aspect is what's fuckin' ya here. Set either the horizontal speed or the vertical launch speed- preferably the latter, for ease of level design- to a constant, and your calculations will become drat near linear. Plus it'll be much easier for players to read and counterplay.

zolthorg
May 26, 2009

Somfin posted:

The "set angle" aspect is what's fuckin' ya here. Set either the horizontal speed or the vertical launch speed- preferably the latter, for ease of level design- to a constant, and your calculations will become drat near linear. Plus it'll be much easier for players to read and counterplay.

it makes more sense to me for the vertical launch speed to be constant and the horizontal launch speed/angle to change. then they would all have a uniform hangtime before they drop

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

Physics Solution

https://vimeo.com/184962484

code:
static func get_velocity_of_arc_intercept(initial_position, target_position, angle):
	var delta_vector = target_position - initial_position
	var x_velocity = sqrt((gravity * delta_vector.x * delta_vector.x) / (2 * (delta_vector.y - (tan(angle) * delta_vector.x))))
	# Adjust for lost sign.
	if sign(x_velocity) != sign(delta_vector.x):
		x_velocity = -1 * x_velocity
	var y_velocity = x_velocity * tan(angle)
	return Vector2(x_velocity, y_velocity)
Thanks for all the comments and interest.

I may end up switching to a fixed-travel-time solution, but it's nice to have this in my pocket for when I really want things at fixed angles. I still maintain that it can be put to interesting uses.

Mercury_Storm
Jun 12, 2003

*chomp chomp chomp*
Here's another physics question, in Unity I've found out how the Drag setting for Rigidbodies works along with gravity:

code:
rigidbody.velocity += Physics.gravity * Time.fixedDeltaTime;
rigidbody.velocity *= Mathf.Clamp01(1f - rigidbody.drag * Time.fixedDeltaTime);
The above is executed every physics frame (Time.fixedDeltaTime), which I have set to .01, so that means Unity runs the above code 100 times a second, and it multiplies gravity and drag by .01 each time. Rigidbody.drag is a float value that cannot be negative, and Mathf.Clamp01 restricts the amount velocity is multiplied by between 0 and 1. In my case with Time.fixedDeltaTime at .01, and with rigidbody.drag set to 1, velocity is being multiplied by .99 every frame, reducing velocity by that much 100 times a second.

I'm trying to figure out how much extra force I need (when something jumps) to overcome not just gravity, but also gravity and drag together. The code for finding the proper force needed to reach a given height accounting for gravity alone is here, where Mathf.Sqrt is Square Root, and Physics.gravity.y would be 9.81m/s.

code:
float jumpForce = Mathf.Sqrt(2.0f * (float)height * Physics.gravity.y);
This is proving to be pretty difficult because drag is not a constant like gravity, and instead reduces velocity by a percentage every frame. Any ideas here?

Mercury_Storm fucked around with this message at 13:03 on Sep 30, 2016

Somfin
Oct 25, 2010

In my🦚 experience🛠️ the big things🌑 don't teach you anything🤷‍♀️.

Nap Ghost

zolthorg posted:

it makes more sense to me for the vertical launch speed to be constant and the horizontal launch speed/angle to change. then they would all have a uniform hangtime before they drop

Uniform drop hangtime, uniform maximum height, simple parabolic calculation for predictions. Plus they always look 'thrown.'

GlyphGryph
Jun 23, 2013

really israel could slaughter all these children without our help, I just didn't want to miss out on the chance to participate

Somfin posted:

Uniform drop hangtime, uniform maximum height, simple parabolic calculation for predictions. Plus they always look 'thrown.'

You might want a few backup equations in that case though - boost it up a bit if the player is up higher for example.

So one equation for if the player is more than "x" units below the thrower. Another equation if they are between "-x" and "+x", and a final equation for if they are more than "x" units above the thrower.

At least that's how I've seen it done before in games where you want them to pose a risk with any kind of approach, without them throwing perfectly horizontal fastballs at your guys (which don't look too good)

Edit: Or do the cool thing where it inverts the throw!

GlyphGryph fucked around with this message at 16:25 on Sep 30, 2016

Emmideer
Oct 20, 2011

Lovely night, no?
Grimey Drawer

How is the initial rigidbody.velocity determined using jumpForce?

Emmideer fucked around with this message at 14:27 on Sep 30, 2016

Mercury_Storm
Jun 12, 2003

*chomp chomp chomp*

Krunge posted:

How is the initial rigidbody.velocity determined using jumpForce?

Ah, it's just set to a new velocity instantly (from 0), also ignoring mass using this code:

rigidbody.AddForce(Vector3.up * jumpForce, ForceMode.VelocityChange);

So if jumpForce is 15, the new velocity will be Vector3(0, 15, 0)

Polio Vax Scene
Apr 5, 2009



Hammer Bro. posted:

Physics Solution

https://vimeo.com/184962484

code:
static func get_velocity_of_arc_intercept(initial_position, target_position, angle):
	var delta_vector = target_position - initial_position
	var x_velocity = sqrt((gravity * delta_vector.x * delta_vector.x) / (2 * (delta_vector.y - (tan(angle) * delta_vector.x))))
	# Adjust for lost sign.
	if sign(x_velocity) != sign(delta_vector.x):
		x_velocity = -1 * x_velocity
	var y_velocity = x_velocity * tan(angle)
	return Vector2(x_velocity, y_velocity)
Thanks for all the comments and interest.

I may end up switching to a fixed-travel-time solution, but it's nice to have this in my pocket for when I really want things at fixed angles. I still maintain that it can be put to interesting uses.

This doesn't seem to be working for me in specific circumstances. :( It looks like if the delta vector X is larger than the Y it can end up having a negative value in the sqrt.

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

Polio Vax Scene posted:

This doesn't seem to be working for me in specific circumstances. :( It looks like if the delta vector X is larger than the Y it can end up having a negative value in the sqrt.

I suspect you're passing in the wrong angle -- I did it myself far too many times. Consider this reference picture:



In Cartesian coordinates the y-axis increases as you go upward, but in computer coordinates it increases as you go downward. So intuitively if I want to throw at 45 degrees left of vertical (135 degrees, or 3 PI / 4 radians, clockwise from the horizontal), I've got to account for the inverted y axis by passing it an angle that's 3 PI / 4 radians counterclockwise from the horizontal. Which really just means pass in the negative of whatever angle (in radians) you intuitively want to give it.

All of my failures yesterday evening were due to unwittingly telling the skeletons to throw at an angle which couldn't possibly hit the player. Like down and left when the player was up and left.

Edit: I should also add that there are certain locations at which it's simply not possible to hit a target, but these make sense intuitively. If you're throwing at a 45 degree angle but the target is directly above you, of course you'll never be able to hit it. Or more generally, any time the angle from the source to the target is closer to straight up (-PI / 2 in computer coordinates) than the fixed launch angle.

Mercury_Storm posted:

This is proving to be pretty difficult because drag is not a constant like gravity, and instead reduces velocity by a percentage every frame. Any ideas here?

My Smart Brain has not recovered, but this smells strongly of Calculus II to me. Integrals (if you're not familiar with them) allow you to add up infinite infinitely-small numbers into an exact sum. Or, graphically, determine the area under an arbitrary curve.

As to what specifically to integrate in your problem, right now I've got nothin'.

Hammer Bro. fucked around with this message at 18:06 on Sep 30, 2016

anothergod
Apr 11, 2016

Mercury_Storm posted:

rigidbody.velocity *= Mathf.Clamp01(1f - rigidbody.drag * Time.fixedDeltaTime);

I don't know anything about drag physics, but this is not going to have the same results for different fixedDeltaTime values. Literally at fDT 1, 60, and 100 you will have different results.

Are you using Drag to keep things from moving too fast? Like to limit velocity vectors when you're on the ground? I was having a similar problem because I thought drag meant drag-while-moving-across-other-objects like moving something on the ground. Unity uses drag like you would for a plane or something moving through air, though. You can tell because the drag equation doesn't reference other objects or collisions. That means that dense objects want low drag and not dense objects want high drag - think throwing a baseball vs throwing a beachball. The last thing I had drag > 0 on was a smoke effect.

I only ask because I was using Drag for literally that problem. For a moment I was solving this drag problem by just applying drag when the player was on the ground and changing it to 0 when the player was in the air. It worked but I was upset that the physics weren't right. Then I just started using physics materials.

Polio Vax Scene
Apr 5, 2009



Hammer Bro. posted:

Which really just means pass in the negative of whatever angle (in radians) you intuitively want to give it.

That was exactly it, thanks! Works perfectly now.

Mercury_Storm
Jun 12, 2003

*chomp chomp chomp*

anothergod posted:

I don't know anything about drag physics, but this is not going to have the same results for different fixedDeltaTime values. Literally at fDT 1, 60, and 100 you will have different results.

Are you using Drag to keep things from moving too fast? Like to limit velocity vectors when you're on the ground? I was having a similar problem because I thought drag meant drag-while-moving-across-other-objects like moving something on the ground. Unity uses drag like you would for a plane or something moving through air, though. You can tell because the drag equation doesn't reference other objects or collisions. That means that dense objects want low drag and not dense objects want high drag - think throwing a baseball vs throwing a beachball. The last thing I had drag > 0 on was a smoke effect.

I only ask because I was using Drag for literally that problem. For a moment I was solving this drag problem by just applying drag when the player was on the ground and changing it to 0 when the player was in the air. It worked but I was upset that the physics weren't right. Then I just started using physics materials.

I'm increasing drag for all enemies and objects when they're underwater, and some objects and enemies have a bit of drag too to differentiate their movement a bit. So if an enemy is underwater it needs to know what jump force it needs to reach a platform accounting from the fluid drag and such. I'm using physics materials in the same way that you're using them too.

Mercury_Storm
Jun 12, 2003

*chomp chomp chomp*

Hammer Bro. posted:

My Smart Brain has not recovered, but this smells strongly of Calculus II to me. Integrals (if you're not familiar with them) allow you to add up infinite infinitely-small numbers into an exact sum. Or, graphically, determine the area under an arbitrary curve.

Hey thanks for this and I think I might be on to something now, as I've got an equation that gives values that are really close. What I figured was simulating a jump without drag, and then seeing how much speed would be lost on each frame with drag, and adding it up and returning a new jump force with the force lost each frame added.

code:
public float CalculateJumpForceWithDrag(float height)
{
 float jumpForce = Mathf.Sqrt(2f * height * -Physics.gravity.y);
 float jumpSpeed = jumpForce;
 float jumpTime = jumpForce / -Physics.gravity.y;
 int totalFrames = Mathf.RoundToInt(jumpTime / Time.fixedDeltaTime);
 float totalSpeedLostToDrag = 0;
 float drag = charRigidbody.drag;
 float gravity = Physics.gravity.y;
	for (int i = 0; i < totalFrames; i++)
	{
	 jumpSpeed += gravity * Time.fixedDeltaTime;
	 float jumpSpeedWithDrag = jumpSpeed * Mathf.Clamp01(1.0f - drag * Time.fixedDeltaTime);
	 float jumpSpeedDifference = jumpSpeed - jumpSpeedWithDrag;
	 totalSpeedLostToDrag += jumpSpeedDifference;
	}
 return jumpForce + totalSpeedLostToDrag;
}
This more or less works, but the jump force returned at lower drag amounts (1 through 6 or so) are slightly too large, and after that start tapering off until it's too small. I wonder what I'm missing here (or if this is even the right way to go about it)!

Mercury_Storm fucked around with this message at 20:10 on Sep 30, 2016

GlyphGryph
Jun 23, 2013

really israel could slaughter all these children without our help, I just didn't want to miss out on the chance to participate
Here it is!

An actual, playable prototype!
https://whispering-mountain-88337.herokuapp.com/

Features:
3 (almost) fully implemented species, each of which has 2 additional fully implemented subspecies!
1 kind of implemented species.
6 half-assed fragments
32 fully implemented moves (ones that are unimplemented will be marked as incomplete)
Experience gained you fight, and creatures that evolve and change based on what they've defeated
Multiplayer support! Challenge other players to fights and get your rear end kicked.
Use arrow keys to walk around, enter to select options and mouse to equip or unequip moves
NOTE: This poo poo is not optimized in the slightest, expect it to be slow. Everything is processed server side and I am on a free lovely server running really bad code that does way too many database calls!

Gonna be updating it pretty regularly the next few days.

Self imposed challenge status: COMPLETE

Now I get to spend some time polishing this up and improving it, maybe another month.

GlyphGryph fucked around with this message at 13:33 on Oct 1, 2016

Fissurefury
May 27, 2007

The results of these precious, meaty fingers.

Higsian posted:

That character sprite looks infinitely better with that background than any of the others you've shown so far. The shadows and movement also help I'm sure, but the floor really makes the character pop.

Looking at your next gif the character doesn't look as good on the stairs or the white floor.

I'm not enough of an artist to tell you why though.

I think it's simply a matter of keeping enough contrast between the player and the environment. Just needs darker floors/stairs/walls as an unbreakable rule if the player can overlap them.

Somfin
Oct 25, 2010

In my🦚 experience🛠️ the big things🌑 don't teach you anything🤷‍♀️.

Nap Ghost

GlyphGryph posted:

You might want a few backup equations in that case though - boost it up a bit if the player is up higher for example.

So one equation for if the player is more than "x" units below the thrower. Another equation if they are between "-x" and "+x", and a final equation for if they are more than "x" units above the thrower.

At least that's how I've seen it done before in games where you want them to pose a risk with any kind of approach, without them throwing perfectly horizontal fastballs at your guys (which don't look too good)

Edit: Or do the cool thing where it inverts the throw!

Or, that enemy is simply not a threat if you have sufficient high ground on them. So they usually only appear if they have guaranteed high ground, but the player can gain huge advantage by securing an even higher route.

In a randomised game, enemies need to be flexible and general, but if the game is designed then limits can help to guide your design.

Tann
Apr 1, 2009

GlyphGryph posted:

Self imposed challenge status: COMPLETE

Nice job for finishing! I enjoyed seeing my doodledad and its abilities. I tried challenging someone but no response yet; get your butt on, Ms butts@hotbutts.com! There's a lot of stats and stuff, can I fight an ai baddie?

GlyphGryph
Jun 23, 2013

really israel could slaughter all these children without our help, I just didn't want to miss out on the chance to participate
Just walk around for wild encounters. I plan on adding a boss and stuff a little later for a bit more of an AI challenge but he's not in yet. You can also capture additional team members.

GlyphGryph fucked around with this message at 13:33 on Oct 1, 2016

Adbot
ADBOT LOVES YOU

HMS Boromir
Jul 16, 2011

by Lowtax
This is neat! I'd seen your screenshots around but I didn't realize this was an online game.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply