• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 19:45
CET 01:45
KST 09:45
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Foreign Brood War Data analysis on 70 million replays BW General Discussion MBCGame Torrents
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile ZeroSpace Megathread The Perfect Game
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
I decided to write a webnov…
DjKniteX
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1285 users

Student Game Dev Part Five - More Physics Things

Blogs > Soan
Post a Reply
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
December 13 2013 01:58 GMT
#1
Part One - It begins
Part Two - Technical Foundation
Part Three - Game Design
Part Four - Input and Physics

This Week
Hello again TeamLiquid!

Welcome back to my blog about the development of The Adventures of Sam the Pirate, the 2D platformer I'm creating as the final game project for my Bachelor of Software Engineering degree. Apologies for the lack of a blog last week, I came down with the flu and didn't get much done, which has put me a bit behind! Last week I covered how I was handling input, and some of the work I started on doing the games physics. This week I'll be going over where I'm now at with the physics.

Movement
Since the last blog, basic left and right movement is in and working, complete with acceleration and deceleration. Jumping is in, as is some basic collision detection/response. You cannot control left/right directional movement while in the air, but that's next on the list. The intent is definitely that you'll be able to change direction at will while jumping. Jumping itself feels slow and wrong at the moment, but hopefully that just requires tweaking the numbers over the next couple of months until it feels better and looks more natural when compared to the rest of the movement.

At its simplest, the movement is calculated, using 2D vectors, like this:
velocity += acceleration * deltaTime;
position += velocity * deltaTime;


With deltaTime being the time taken to process a frame, and there are a bunch of other considerations like capping velocity to certain values to prevent craziness, and checking if the character has come to a halt or not. Acceleration is calculated whenever a force is applied to the physics actor, sort of using the trusty old f=ma equation that you may recognise if you ever studied physics at all.

acceleration += force / mass;


There are checks in here as well, to cap the acceleration to predefined values. Now this all looks really simple, and if you're better at physics than I am (the more advanced stuff especially has never been my strong point), you might be kind of horrified at how I'm doing things! In fact just now I realised I've got a plus equals in my acceleration, so I'm probably doing it all wrong, but it works, and that's the most important thing. It doesn't matter too much how it works, just that it does, and allows me to move on with production.

Collision Detection
Collision detection is also pretty simplistic. Everything in the game is represented in my physics code as a rectangle, or an Axis Aligned Bounding Box, AABB. Luckily for me SDL comes with a function for testing whether or not two rectangles are intersecting, so I don't even have to do any maths. The downside to this, is that it purely uses integers, rather than floats, which makes it kind of inaccurate. However I don't need accurate, so it's probably alright.

Using this method, there's some clear intersection going on when my player character falls onto the ground from a jump, rather than simply standing on top of it, but I was kind of expecting that. The SDL function does give me the position and dimensions of the intersecting rectangle, so I should be able to use that to detect what direction the collision is coming from, and adjust the moving character appropriately. Right now all I'm doing is halting the vertical velocity of the moving object, and ensuring that stays zero for as long as the player is on the ground.

If doing things so simply comes back to bite me in the ass in the future, well, I'll just have to deal with it.

What's next?
I have a milestone due next week, to meet it all I need to do is add some more platforms and make sure the movement and physics is all fine and hopefully not buggy. So over the next week I'll add some more platforms to test with, add a moving platform, and then potentially look at adding a swinging vine, as that is a game play element I want to have in the game. I've done some basic physics code with springs before, so I'm going to look at using that to do swinging vines with.

So next week I'll cover my progress with that, and possibly look at doing a super early pre alpha game play video to go with the milestone. Also spoke to one of my artists today, and hopefully I should also have some new art to show off next week as well.

Keep up to date!
Be sure to follow me on Twitter, and like the Facebook page to stay up to date on future content and blog posts when they happen. If you have any questions don't hesitate to ask, either through Twitter or Facebook!

****
Please log in or register to reply.
Live Events Refresh
OSC
22:00
Masters Cup #150: Playoffs
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
davetesta69
Liquipedia
BSL 21
20:00
RO16: Group A
Sziky vs OyAji
Gypsy vs eOnzErG
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft399
White-Ra 287
Nathanias 101
ROOTCatZ 6
StarCraft: Brood War
Shuttle 689
NaDa 44
Dota 2
canceldota139
League of Legends
C9.Mang0384
Counter-Strike
minikerr37
Heroes of the Storm
Khaldor165
Other Games
tarik_tv12119
summit1g7770
Grubby6507
shahzam371
XaKoH 124
ViBE61
Chillindude29
Organizations
Other Games
gamesdonequick729
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• RyuSc2 41
• HeavenSC 24
• Freeedom8
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• Ler75
Upcoming Events
Sparkling Tuna Cup
9h 15m
WardiTV 2025
11h 15m
OSC
14h 15m
IPSL
16h 15m
Bonyth vs KameZerg
BSL 21
19h 15m
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
1d 8h
Wardi Open
1d 11h
StarCraft2.fi
1d 15h
Monday Night Weeklies
1d 16h
Replay Cast
1d 23h
[ Show More ]
WardiTV 2025
2 days
StarCraft2.fi
2 days
PiGosaur Monday
3 days
StarCraft2.fi
3 days
Tenacious Turtle Tussle
3 days
The PondCast
4 days
WardiTV 2025
4 days
StarCraft2.fi
4 days
WardiTV 2025
5 days
StarCraft2.fi
6 days
RSL Revival
6 days
IPSL
6 days
Sziky vs JDConan
Liquipedia Results

Completed

Proleague 2025-12-04
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
WardiTV 2025
META Madness #9
Light HT
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.