Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411196 Posts in 69314 Topics- by 58380 Members - Latest Member: feakk

March 18, 2024, 10:38:31 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperPlaytestingMovement Prototype
Pages: [1]
Print
Author Topic: Movement Prototype  (Read 16263 times)
JLJac
Level 10
*****



View Profile
« on: November 18, 2011, 10:41:26 PM »

Hi! It's been a while since I was active here, but some of you might know me.
I've been playing a little bit with some code, and am putting it here just to
get some general input from you guys. This is what it looks like so far:




Here you can try it out:
http://dl.dropbox.com/u/50146906/runnMaze2.rar

Controls: P1 - Arrows and K, L. P2 - EDSF and Q, W.
Exit - ESC. Please don't click the mouse, there's some
level editor stuff that will crash then.

Pixel characters are most often a square moving against other squares, with
fluid animation painted onto it. However, you can still somewhat feel that
the character is a box, mathematically. I have tried to create a character
that looks like pixel art, but moves much more fluently, and has a body that
actually is affected by the surroundings. I still want to keep the levels blocky
and grid based though, to create an interesting contrast and put emphasis on
the softness of the character. Please tell me what you think.

Everything is under construction, so I apologize for the weird stuff you'll
see. The (probably completely unorthodox) psuedo-3D code I use for the
level is a bit off still, and some of the character animations aren't finished
yet, such as the wall gripping and the climbing on vertical beams.

Thank you for testing!
Logged
IzzyReggie
Level 1
*


View Profile
« Reply #1 on: November 20, 2011, 08:50:11 PM »

Hey there!

I really enjoyed toying around with this and watching the character climb around. I think you have something really neat here and would like to see a full game made with it!
Logged

Twitter: @fistpuncher (no relation to the game)
ink.inc
Guest
« Reply #2 on: November 20, 2011, 09:01:39 PM »

This is really nifty.
Logged
sevn
Level 0
***


Game design student


View Profile WWW
« Reply #3 on: November 21, 2011, 01:07:47 AM »

Thats awesome.

What helped you the most? I've been ponding movement algorithms recently but it seems very hard to find good articles about it, and since I've just started out in game design, 80 hours of self learning so far, it'll be a long time before I start implementing and understanding such advanced stuff such as yours.
Logged

JLJac
Level 10
*****



View Profile
« Reply #4 on: November 21, 2011, 02:32:46 AM »

Thanks! Since I'm self taught or "rouge" or whatever I don't know much of the terms, but if you by algorithm simply mean method, I can give you a few tips. The fact that my code is self-developed and made for only myself to read also means that it's extremely unorthodox and ugly, I go with a solution if it works, even if the code looks like ****. However, if you're interested in how I reached this result the keyword is trigonometry.

Technobabble
If you have to mathematical points, each with their velocity vectors, you can easily create a "stick" with different elasticity. You do this by locking the distance between the points. If the points are further away from each other than your set distance, you move their positions and velocities towards each other, if too close you separate them. By making the force they're bound to each other with weaker, you get an elastic "rubber band", and you can also let one point do 70% of the movement and the other 30%, creating different weights for them. What you need is a function to determine the distance between points, and a function to create a vector pointing from one point towards the other. This is the basis of what you see in my demo(the creatures are mathematically boxes moving like this). From there I just improvise, and fine-tune the numbers like crazy.

If you are interested I can produce some more in-depth explanations with psuedo-code.

What did you find when searching for movement algorithms?
Logged
sevn
Level 0
***


Game design student


View Profile WWW
« Reply #5 on: November 21, 2011, 10:33:00 AM »

What did you find when searching for movement algorithms?

Very little. The best I've found is a Sonics Physics guide

If you are interested I can produce some more in-depth explanations with psuedo-code.

If you could, that would be very helpful.
Logged

XRA
Level 4
****

.


View Profile WWW
« Reply #6 on: November 22, 2011, 03:50:57 AM »

this is sooo awesome, I really appreciate the care and attention to detail you've put in to the control / animation aesthetics.  Everything felt great and seemed to control as I'd expect.
 Beer!
Logged

JLJac
Level 10
*****



View Profile
« Reply #7 on: November 23, 2011, 04:24:20 AM »

@XRA: Thanks! I've really tried to make the control and the animation flow together, to make it feel like whatever the creature does it does at your command. Did you find the control intuitive? Are the transitions from different movement types such as running, tunnelcrawling, climbing, jumping smooth enough and easy enough to follow? I get terribly home blind with my projects, so spotting problems is hard for me. Any parts you'd change?

@Sevn: Alright, I'm making the text small because it should be in the technical forum and people here might not be interested.

Technobabble #2
I won't go into how to make a box collide with rectangles, beacuse I know that you can find a lot of stuff like that all over, and my solutions for this are a bit horribad. I will also assume that you know what a vector is, and that you know how to implement gravity and stuff like that. What I'm going to show you is how to create "atoms" or whatever you want to call them, that is points that are connected to each other to create a simple physics simulation.

So, assume that you have two points, Ax, Ay and Bx, By. These points also have velocity vectors, sAx, sAy and sBx, sBy. By adding the vectors to the positions you get movement, as you probably know.

You now need to create two functions, one to determine the distance between two points(I'm going to call mine diag, from diagonal) and one to create direction vector pointing towards a point. That is a vector with a total length of 1.0, only indicating direction. This can also be used for a lot of fun stuff, such as gravity wells and so on. I'm gonna call mine moveToPoint. These functions are heavy on the processor, so use them sparsely.

So this is what we have so far:

function diag(point1x, point1y, point2x, point2y)
  rectHeight = ABSOLUTE(point1y - point2y)
  rectWidth = ABSOLUTE(point1x - point2x)
  diagonal = SQUAREROOT((rectHeight * rectHeight) + (rectWidth * rectWidth))
  return diagonal
function end

function moveToPoint(point1x, point1y, point2x, point2y)
  point2x = point2x - point1x
  point2y = point2y - point1y
  diag = diag(0,0, point2x, point2y)
  if diag>0 then
    dirVecX = point2x/diag
    dirVecY = point2y/diag
  else
    dirVecX = 0
    dirVecY = 1
  end if
  return [dirVecX, dirVecY]
function end

Alright, let's move on. This part is simple, every frame do this:

function newFrameMovePoints()
  Ax = Ax + sAx
  Ay = Ay + sAy
  Bx = Bx + sBx
  By = By + sBy

  sAx = sAx*0.98
  sAy = (sAy*0.98) + 1.2
  sBx = sBx*0.98
  sBy = (sBy*0.98) + 1.2

  diag = diag(Ax, Ay, Bx, By)
  rtrn = moveToPoint(Ax, Ay, Bx, By)
  dirX = rtrn[1]
  dirY = rtrn[2]
  getToDiag = 17

  Ax = Ax - (getToDiag-diag)*dirX*0.5
  sAx = sAx - (getToDiag-diag)*dirX*0.5
  Ay = Ay - (getToDiag-diag)*dirY*0.5
  sAy = sAy - (getToDiag-diag)*dirY*0.5
  Bx = Bx + (getToDiag-diag)*dirX*0.5
  sBx = sBx + (getToDiag-diag)*dirX*0.5
  By = By + (getToDiag-diag)*dirY*0.5
  sBy = sBy + (getToDiag-diag)*dirY*0.5
function end

What you see is, separated by the empty rows: Adding the velocities to the positions, applying air friction and gravity to the velocities, retrieving the data necessary for the "binding" of the two points, and finally applying the bond. The points are now freely moving, but will always keep the same distance to each other, and forces applied to one point will realistically transfer into the other. As long as you draw the points after this has been done, they will always be displayed with the correct distance between them.

You see the "0.5"s after each row in the last section? Those mean that if there is a difference between the desired distance and the actual distance between the points, this point will stand for  50% of the movement made to correct the distance. If you tilt those numbers, so that for example point A stands for 85% of the movement and point B for 15% it will appear that B is significally heavier than A. If you make it so that the sum is less than 100% you will get an elastic bond, like a rubber band. You might want to tone down the movement of the actual positions in this case, and focus on the velocities. Other interesting choices you can toy with is to only affect the points if they are further away from each other than the desired distance, or only if they are closer.


Once you get the basics to work you can start connecting bigger structures of dots together, playing with the parameters. This is created with this technique only. For example you can create an array of dots, each connecting to the next one, and you have a rope! Fix the first node at your mouse position and whip away. This is also the tech behind my unfinished mega project freethinker, which brings me to another very important piece of advice; never start a mega project!

I hope this is helpful to you, and that I hit the right level (don't really know how much 80 hours is, it depends a lot on what you're using). Please do not hesitate to ask further questions.
Logged
Alec S.
Level 10
*****


Formerly Malec2b


View Profile WWW
« Reply #8 on: November 23, 2011, 11:10:57 AM »

I really like this.  The movement looked smooth and everything had a proper sense of feedback.   I think jumping could use a little bit of tweaking, though, although it depends really on what you want to do with this. 

My main problem with jumping is that, while there seems to be wall jumping, it only works if you're pressing the arrow key towards the wall in question.  However, if you're against the wall, visually you're sliding down it whether you're pressing towards it or not, so there's not really a visual connection between pushing towards the wall and wall jumping.  I think as long as you're sliding down a wall, you should be able to wall jump.

However, all the other movement felt really good and intuitive.  I love the feet animation as it tries to scamper up tough pathways.  Nice job.
Logged

PompiPompi
Level 10
*****



View Profile WWW
« Reply #9 on: November 23, 2011, 11:28:37 AM »

Even now at it's current state I had a lot of fun moving that little guy around. Looks promising.
Logged

Master of all trades.
EtiennePerin
Level 0
***


Muscle !


View Profile WWW
« Reply #10 on: November 24, 2011, 09:39:10 AM »

Hey, nice work, nice feeling.
Do you already have an idea for game? Or is it just "test"?
Logged

verticalvertex
Level 1
*



View Profile
« Reply #11 on: November 24, 2011, 12:39:12 PM »

Real nice movement.
Logged

It's all good.
JLJac
Level 10
*****



View Profile
« Reply #12 on: November 27, 2011, 12:18:41 AM »

Thank you people for playing!

I really like this.  The movement looked smooth and everything had a proper sense of feedback.   I think jumping could use a little bit of tweaking, though, although it depends really on what you want to do with this. 

My main problem with jumping is that, while there seems to be wall jumping, it only works if you're pressing the arrow key towards the wall in question.  However, if you're against the wall, visually you're sliding down it whether you're pressing towards it or not, so there's not really a visual connection between pushing towards the wall and wall jumping.  I think as long as you're sliding down a wall, you should be able to wall jump.

However, all the other movement felt really good and intuitive.  I love the feet animation as it tries to scamper up tough pathways.  Nice job.

Thanks for the feedback! I've worked a little on this issue now, the main change being that the character is now animated with a special wall grabbing animation when you press towards the wall, hopefully making it clearer to the player that there is a difference between just being close to a wall and actually grabbing it. After I've done some other stuff I'll reupload, and hopefully you'll like the new system better. Also adressed some conflicts when the player slides down a wall and contacts the ground.

I have a question for you guys, and that's simply what direction I should take this? It started out only as an environment for testing this movement system, but it would of course be fun to make it a real game. The original idea that was lingering in the back of my head was a simple myltiplayer maze game where you'd steal some objects from each other and try to keep three of them in your base for a certain time to win, much like the multiplayer of Matt Thorsons excellent "An Untitled Project". A skeleton for these game mechanics is present in the uploaded version.

However, my last project was a multiplayer game, and I feel that maybe I missed some of my potential audience because of this. So I'm thinking about making it a puzzle-platformer or something like that instead, or maybe some kind of single/multiplayer hybrid...

What kind of game would you like to play this character in? I'm not making an explorational platformer, as I already have a project like that, only something small and quick but fun.

Please, give me your ideas!
Logged
Ninja Dodo
Level 4
****



View Profile WWW
« Reply #13 on: November 28, 2011, 02:19:03 AM »

Cool!

I really like the feel of the movement and how you can climb freely in narrow passages. Makes for some unexpected navigational options.

Animation-wise I think I would have him turn around if you go far enough backwards, unless you assume there isn't enough space (in screen depth) to turn around in. Though in certain situations (like if there's a threat outside the tunnel) it would make more sense to keep going backwards.

Very good start on the movement. Cute and funny!


My first association with this was hamsters so maybe you could make it about escaping one of those hamster-mazes with tubes and things, except the level continues into the outside, the room, the house, etc... (though maybe that's too much like exploration)
Logged

JLJac
Level 10
*****



View Profile
« Reply #14 on: December 04, 2011, 04:25:03 PM »

Thanks everyone for ideas and feedback!

Just wanted to say that now I, as many others I guess, enter finals mode and won't be doing much else, but I'm coming back to this. Next up I'm gonna start working on a level editor, which I have some ideas for and which will be useful whatever direction I take this.
Logged
Naufr4g0
Level 0
**



View Profile
« Reply #15 on: December 07, 2011, 04:09:31 AM »

Congratulations, very smooth and controllable movements! Smiley
Great innovation in pixel-art graphics.
Logged

Juha Kangas
Level 0
***


Scandalous!


View Profile WWW
« Reply #16 on: December 07, 2011, 03:23:29 PM »

Very cool, I love how the movement feels.

I randomly jumped out off one of the ledges and managed to jump across stuff in an very smooth way, and that got me thinking that it would be very cool if you would implement stuff like autograbbing ledges and such, to make it feel a bit like Assassins Creed when you're scampering across rooftops.
Logged

TNERB
Level 5
*****


gamez stink


View Profile WWW
« Reply #17 on: December 18, 2011, 11:43:32 PM »

The movement in this is pretty much perfect.The controls are smooth and the characters feel very soft and alive. If your still looking for suggestions on which direction to take this, I think it would be pretty neat to have two players working cooperatively to get through some sort of lab rat maze. Whatever direction you choose to take this I really hope you keep working on it and develop it into a full game, it's awesome so far!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic