TIGSource Forums

Developer => Technical => Topic started by: sublinimal on July 15, 2013, 01:18:10 PM



Title: Platformer physics twiddler
Post by: sublinimal on July 15, 2013, 01:18:10 PM
(https://dl.dropboxusercontent.com/u/75065952/twiddler_scr2.png)

https://dl.dropboxusercontent.com/u/75065952/charctrl_pub.swf

About:
This is a tool for graphically adjusting platformer physics variables in real-time. I was wondering why I couldn't find something like this, so I went and wrote one myself. It was initially meant for fine-tuning AIME's physics, but I figured it could be helpful to others too, so I'm making it public right here.

It's got some fancy mathy things like being able to set the desired jump height and the duration until the peak, which are meant to save you some tedious manual balancing.

How to use:
The character starts out with all forces zeroed, so drag some sliders around with your mouse. Then use the left/right keys to move the red box around and the up key to jump. There's three red lines around the controlled box, one for predicting your jump height, and two for predicting how far one tap will slide you (which isn't all that useful to be honest).

Here's what all the variables do exactly:
-xacc: added to the player's dx (horizontal movement) every frame a key is pressed
-maxspeed: dx is capped to this
-xslow: dx is divided by this every frame a key isn't pressed, causing smooth sliding instead of a quick stop
-yacc: added to dy (vertical movement) every frame
-jumpacc: the jump boost, subtracted from dy once when the jump key is pressed
-jumpheight: sets the jump height while keeping the same duration
-jumptime: sets the jump duration while keeping the same height

If you're wondering how you'd implement those in your game, you can find base code of my suggested use case over here (http://pastebin.com/2JPTzvch).

Known bugs/improvements:
-The jump height/time sliders get stuck when the predicted jump hits a wall; move other sliders to refresh them for now
-The jumptime slider snaps when dragged really fast
-I guess you people would like a larger screen to work with, maybe different sizes of rectangles.
-More sliders?!


Title: Re: Platformer physics twiddler
Post by: raigan on July 15, 2013, 04:16:22 PM
Thanks so much for making this, it's a really awesome tool/idea!

Do you have any plans to add basic level-editing (e.g click to toggle tile on/off)? ;)


Title: Re: Platformer physics twiddler
Post by: oh ok on July 15, 2013, 05:06:19 PM
gravity, slopes?
friction or something?


good idea tho.


Title: Re: Platformer physics twiddler
Post by: sublinimal on July 15, 2013, 05:17:48 PM
Do you have any plans to add basic level-editing (e.g click to toggle tile on/off)? ;)

Updated, you can do that now.

gravity, slopes?
friction or something?

Oboy. I might add more complex movement features as they're requested, but I think I'll worry about getting the basics perfect first. As in fixing the ceiling bug and having variable size rectangles/play area.

When I run out of space I might need to use some sort of tab system. GUI stuff's not my forte, though, so bear with me...


Title: Re: Platformer physics twiddler
Post by: dto1138 on July 15, 2013, 05:22:20 PM
This is awesome subliminal :)


Title: Re: Platformer physics twiddler
Post by: sublinimal on July 16, 2013, 03:03:53 AM
(https://dl.dropboxusercontent.com/u/75065952/twiddler_scr2.png)

Since there aren't much graphics beyond sliders, I might as well invest in them. This (https://dl.dropboxusercontent.com/u/75065952/twiddler_scr.png) is how ugly they looked in case you missed it.


Title: Re: Platformer physics twiddler
Post by: jmptable on July 16, 2013, 04:43:50 AM
Neat tool. Reminds me of the sort of tools that were demoed in this talk: http://vimeo.com/36579366 (10:40 for the most relevant part).


Title: Re: Platformer physics twiddler
Post by: sublinimal on July 16, 2013, 06:29:03 AM
Neat tool. Reminds me of the sort of tools that were demoed in this talk: http://vimeo.com/36579366 (10:40 for the most relevant part).

Thanks for this, I totally get where he's coming from. I mean, just today I was ranting on IRC about how programming languages don't really allow you to work with ideas, how weird is that?

He talked about being able to make a jump around 12 minutes in. Made me think about something I tried when making a platformer with generated levels. I wanted the generator to place blocks so that the player always has a route to the finish, but I didn't manage to calculate which blocks the player could reach. I got it later and I think visualizing it would make a great addition for this.


Title: Re: Platformer physics twiddler
Post by: Kurt on July 16, 2013, 11:43:44 AM
Thanks a lot!