• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:27
CEST 10:27
KST 17:27
  • 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
[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris30Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
Weekly Cups (Aug 18-24): herO dethrones MaxPax A Eulogy for the Six Pool Geoff 'iNcontroL' Robinson has passed away 2v2 & SC: Evo Complete: Weekend Double Feature The GOAT ranking of GOAT rankings
Tourneys
WardiTV Mondays Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
Joined effort [ASL20] Ro24 Preview Pt2: Take-Off No Rain in ASL20? BW General Discussion Flash On His 2010 "God" Form, Mind Games, vs JD
Tourneys
[ASL20] Ro24 Group F [ASL20] Ro24 Group E [Megathread] Daily Proleagues [IPSL] CSLAN Review and CSLPRO Reimagined!
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Nintendo Switch Thread Dawn of War IV Path of Exile
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1925 users

Physics Engine - Game Programming - Page 2

Blogs > CecilSunkure
Post a Reply
Prev 1 2 All
adwodon
Profile Blog Joined September 2010
United Kingdom592 Posts
March 28 2013 17:31 GMT
#21
My masters project involved a contribution to this:

https://rivet.hepforge.org/

Not that deep inelastic scattering is likely to find itself in a physics engine for a game hah.

I've said it before in the big programming thread that at least here in the UK physicists / electrical engineers are prized higher than CS graduates in more technical positions (obviously as far as graduate employment goes) in software.

I work for a company that makes graphics / capture cards as a software engineer and they only hire physicists / electrical engineers, a CS degree wouldn't have even got me an interview.
To be honest though, most of the stuff in a physics engine isn't all that complicated in terms of the pure physics involved, but actually getting it into a fully working model in a simulation is a different matter entirely.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 18:12 GMT
#22
On March 29 2013 02:31 adwodon wrote:
My masters project involved a contribution to this:

https://rivet.hepforge.org/

Not that deep inelastic scattering is likely to find itself in a physics engine for a game hah.

I've said it before in the big programming thread that at least here in the UK physicists / electrical engineers are prized higher than CS graduates in more technical positions (obviously as far as graduate employment goes) in software.

I work for a company that makes graphics / capture cards as a software engineer and they only hire physicists / electrical engineers, a CS degree wouldn't have even got me an interview.
To be honest though, most of the stuff in a physics engine isn't all that complicated in terms of the pure physics involved, but actually getting it into a fully working model in a simulation is a different matter entirely.

I was under the impression that lagrangian mechanics were very high level physics?
micronesia
Profile Blog Joined July 2006
United States24698 Posts
Last Edited: 2013-03-28 18:15:27
March 28 2013 18:15 GMT
#23
Lagrangians aren't that difficult to set up, and once you apply the euler-lagrange equation you get the differential equations (second order) which give the equations of motion. You can simply plug them into any DSolve equivalent to get numerical solutions for the equations of motion (in simple cases they can just be solved using typical undergraduate ODE solving methods).

Of course, some software like Mathematica will do the whole thing for you as long as you can come up with the actual expression for the Lagrangian, which for simple systems isn't that difficult. You just need to express the kinetic and potential energy in terms of some useful variables (generalized coordinates), and then say L = T - U. Punch it into your software and the work is done for you!
ModeratorThere are animal crackers for people and there are people crackers for animals.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 18:26 GMT
#24
On March 29 2013 03:15 micronesia wrote:
Lagrangians aren't that difficult to set up, and once you apply the euler-lagrange equation you get the differential equations (second order) which give the equations of motion. You can simply plug them into any DSolve equivalent to get numerical solutions for the equations of motion (in simple cases they can just be solved using typical undergraduate ODE solving methods).

Of course, some software like Mathematica will do the whole thing for you as long as you can come up with the actual expression for the Lagrangian, which for simple systems isn't that difficult. You just need to express the kinetic and potential energy in terms of some useful variables (generalized coordinates), and then say L = T - U. Punch it into your software and the work is done for you!

Interesting. Might I point you to this? http://twvideo01.ubm-us.net/o1/vault/gdc09/slides/04-GDC09_Catto_Erin_Solver.pdf

I would like to learn to understand why this sort of math setup works for modelling and solving constraint equations. The general process for modelling and solving a constraint goes like this:
  • Create equation of position to model the constraint.
  • Derive equation to end up with one in terms of velocity.
  • Isolate velocity terms.
  • Identify Jacobian by inspection.

Then the rest is just a programmer using the Jacobian in a few lines of code (10-20 or so) in order to model complex behavioral constraints.

Could you perhaps shed some light on where all this is mathematically grounded?
micronesia
Profile Blog Joined July 2006
United States24698 Posts
Last Edited: 2013-03-28 18:39:53
March 28 2013 18:37 GMT
#25
On March 29 2013 03:26 CecilSunkure wrote:
Show nested quote +
On March 29 2013 03:15 micronesia wrote:
Lagrangians aren't that difficult to set up, and once you apply the euler-lagrange equation you get the differential equations (second order) which give the equations of motion. You can simply plug them into any DSolve equivalent to get numerical solutions for the equations of motion (in simple cases they can just be solved using typical undergraduate ODE solving methods).

Of course, some software like Mathematica will do the whole thing for you as long as you can come up with the actual expression for the Lagrangian, which for simple systems isn't that difficult. You just need to express the kinetic and potential energy in terms of some useful variables (generalized coordinates), and then say L = T - U. Punch it into your software and the work is done for you!

Interesting. Might I point you to this? http://twvideo01.ubm-us.net/o1/vault/gdc09/slides/04-GDC09_Catto_Erin_Solver.pdf

I would like to learn to understand why this sort of math setup works for modelling and solving constraint equations. The general process for modelling and solving a constraint goes like this:
  • Create equation of position to model the constraint.
  • Derive equation to end up with one in terms of velocity.
  • Isolate velocity terms.
  • Identify Jacobian by inspection.

Then the rest is just a programmer using the Jacobian in a few lines of code (10-20 or so) in order to model complex behavioral constraints.

Could you perhaps shed some light on where all this is mathematically grounded?

That is going in depth with more specific examples than I am used to, but I will help as much as I can. Remember how I said you set up the Lagrangian using generalized coordinates? Sometimes you can choose generalized coordinates such that position constraints are build into the coordinates. For example, if modeling a simple pendulum, instead of using x, y, and a constraint equation (effectively reducing two variables to one), you can use the generalized coordinate theta, which is the angle between the string and the -y axis. The length of the string can be treated as a constant, and you no longer need to worry about constraints... you build them IN TO your Lagrangian by using a smart coordinate transformation (x = Lsin(theta), y=-Lcos(theta)).

Unfortunately you can't always get away with this trick so you need to actually come up with the constraint equation(s). The constraint equation is always of the form f(x1,x2,...xn) = 0, where x1, x2, etc are each of the variables. The Euler-Lagrange equation usually says:

dL/dx - d/dt(dL/dx_prime) = 0, once for x1, again for x2, etc through all your variables (often it's just 1 or 2 variables)

However, when you have explicit constraint equations (unlike the pendulum example where we avoided it) you actually do:

dL/dx - d/dt(dL/dx_prime) - df/dx = 0, again once for each variable x1, x2, etc... just substitute xn for x in that equation

I'm doing this from memory so I would look it up in a classical mechanics textbook before taking my word for it. I'm not sure if the built-in Euler-Lagrange functions in software like Mathematica will handle the constraint equations for you or if you need to set up the Euler-Lagrange equations yourself by hand.

If you (or anyone else) is interested in a more in-depth guide to lagrangian mechanics I could probably write it, and I would actually reference my texts to be sure I was using proper notation and not making mistakes.

edit: btw I neglected to mention that the Euler-Lagrange equation is basically a summary of the calculus of variations, which is a very useful mathematical tool for classical mechanics, but it can be used in other places as well.
ModeratorThere are animal crackers for people and there are people crackers for animals.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 18:46 GMT
#26
On March 29 2013 03:37 micronesia wrote:
If you (or anyone else) is interested in a more in-depth guide to lagrangian mechanics I could probably write it, and I would actually reference my texts to be sure I was using proper notation and not making mistakes.

Yes I'd be very interested in seeing that!
micronesia
Profile Blog Joined July 2006
United States24698 Posts
March 28 2013 18:49 GMT
#27
Okay I'll plan to put something together. Once again, it won't be geared towards as detailed of an application as how that Blizzard guy was working. It should provide a good basis provided the reader has a math background, however.

The hardest part is going to be writing out the math in an easy to read way since I'm not that familiar with latex.
ModeratorThere are animal crackers for people and there are people crackers for animals.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 18:52 GMT
#28
On March 29 2013 03:49 micronesia wrote:
Okay I'll plan to put something together. Once again, it won't be geared towards as detailed of an application as how that Blizzard guy was working. It should provide a good basis provided the reader has a math background, however.

The hardest part is going to be writing out the math in an easy to read way since I'm not that familiar with latex.

Exciting, thanks for putting something together, I appreciate it a lot
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
March 28 2013 21:20 GMT
#29
ooooh I would love to read that, please do!
Comprehensive strategic intention: DNE
i.of.the.storm
Profile Joined April 2009
United States795 Posts
March 29 2013 03:45 GMT
#30
On March 28 2013 20:35 Otolia wrote:
Show nested quote +
On March 28 2013 12:15 CecilSunkure wrote:
tldr; physics programming isn't a job position that has any demand (in my own opinion).

Like micronesia said, a physics programming is the mother of all computational science bar computational mathematics (but mathematicians are always secluded). Weather forecast, Finance, behavior modelling all of this is done by physicists.

For example, the best programmers in my theoritical physics class have written projects like : behavioral spreading of diseases, chaotic rebound (that was mine) or weather propagation. Those were simplistic but for most of us that was our first real code ever and we all wrote in C.


Yeah, I think the above statement was meant to be scoped by the games industry in particular. In research labs that kind of talent is very in demand.
Maru - The Terran hope is alive!
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 29 2013 03:54 GMT
#31
On March 29 2013 12:45 i.of.the.storm wrote:
Show nested quote +
On March 28 2013 20:35 Otolia wrote:
On March 28 2013 12:15 CecilSunkure wrote:
tldr; physics programming isn't a job position that has any demand (in my own opinion).

Like micronesia said, a physics programming is the mother of all computational science bar computational mathematics (but mathematicians are always secluded). Weather forecast, Finance, behavior modelling all of this is done by physicists.

For example, the best programmers in my theoritical physics class have written projects like : behavioral spreading of diseases, chaotic rebound (that was mine) or weather propagation. Those were simplistic but for most of us that was our first real code ever and we all wrote in C.


Yeah, I think the above statement was meant to be scoped by the games industry in particular. In research labs that kind of talent is very in demand.

Ah yes, to clarify I meant for the games industry only. I don't know about the state of other industries.
Thienan567
Profile Blog Joined November 2010
United States670 Posts
March 29 2013 04:15 GMT
#32
I think this kind of blog really puts into perspective how much hard work you have to put into a physics program. That said kudos to blizz for putting in its physics engine that sometimes honestly does wow me.
Danglars
Profile Blog Joined August 2010
United States12133 Posts
March 29 2013 07:11 GMT
#33
On March 28 2013 11:23 CecilSunkure wrote:
Show nested quote +
On March 28 2013 11:11 micronesia wrote:
Something to keep in mind about coding physics engines (and other things like that): it's more effective to have a science specialist learn coding in order to apply expertise to a program than it is to try to teach the scientific expertise to someone who purely knows how to code.

For a simple 2d engine this may not be the case, but it is true in the 'working world' for the most part.

Thank you for sharing this... sounds interesting.

edit: you might want to suggest how people can learn the physics necessary to come up with their own engines! We can't all have degrees in physics :p

I would tend to agree. Most people aren't capable of writing this sort of thing on their own. And the funny thing is, is that in 2D the complexity isn't all that much simpler than in 3D. They are actually very similar, and often times just "adding another dimension" is all that is required to make such a transition.

However scientists and mathmaticians are absolutely terrible at programming. They can't really be used for any commercial products because of this. So what is really needed, is someone that is great with mathematics and specializes in computer science. These types of people however are quite rare.

Engineers can be pretty good though. I took a three programming classes while learning chemical engineering and it was easy as pie. Some of the purely engineering software you basically have to have a minor in computer science to just interact with it (most older-generation, some of the newer ones have reversed the trend). Side note on the scientists since I saw so many friends go from a mechanical or chemical engineering over to programming jobs and software engineering.

Sad about know-how, but cool article & pictures!
Great armies come from happy zealots, and happy zealots come from California!
TL+ Member
BisuDagger
Profile Blog Joined October 2009
Bisutopia19246 Posts
March 29 2013 10:54 GMT
#34
Just write an article about the dot product and cross product and you just solved all your problems for physics in game development. Add in matrices if you want to be more advanced.
ModeratorFormer Afreeca Starleague Caster: http://afreeca.tv/ASL2ENG2
Teoita
Profile Blog Joined January 2011
Italy12246 Posts
March 29 2013 11:22 GMT
#35
Lagrangians are fucking awesome i remember being completely blown away when i first figured them out lol.

If you need help with Latex i can ask a friend of mine. He's also helped with sorting out the pdf for the PvZ guide.
ModeratorProtoss all-ins are like a wok. You can throw whatever you want in there and it will turn out alright.
LaNague
Profile Blog Joined April 2010
Germany9118 Posts
Last Edited: 2013-03-29 12:34:27
March 29 2013 12:32 GMT
#36
i dont think you would need that much knowledge for basic engines.

1 semester in physics is all i had regarding classical mechanics and analysis I+II gets you differential equations, manifolds and minimizing/maximizing with conditions. What more could you possibly want for an engine :D



I think the point where its easier to use a physics guy over a computerscience/programmer guy would be for labs that go much beyond those things.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-03-29 20:13:55
March 29 2013 17:03 GMT
#37
On March 29 2013 21:32 LaNague wrote:
i dont think you would need that much knowledge for basic engines.

1 semester in physics is all i had regarding classical mechanics and analysis I+II gets you differential equations, manifolds and minimizing/maximizing with conditions. What more could you possibly want for an engine :D

I think the point where its easier to use a physics guy over a computerscience/programmer guy would be for labs that go much beyond those things.

On March 29 2013 19:54 BisuDagger wrote:
Just write an article about the dot product and cross product and you just solved all your problems for physics in game development. Add in matrices if you want to be more advanced.

It's not that simple. Things start to get very complicated very fast. Having things bounce off one another and rotate with friction is very complicated, and joints are equally so in terms of mathematics. The computer science aspect of creating a high-quality robust physics engine usable in a game is also equally as difficult.

So when I see people say things like what I've quoted above, it's really that you guys just don't know what you're talking about unless you're referring to the simplest of simulations.

Edit: On a more light-hearted note, yeah you use a ridiculous amount of dot/cross products You even use dot product in crazy places where it's not actually a dot product in theory, but the computation is the same haha
Rollin
Profile Joined March 2011
Australia1552 Posts
March 30 2013 04:22 GMT
#38
Wow this looks complex, glad my game won't need to have this stuff in it :D. Collision detection is so easy in comparison

By the way I love your stuff cecil, your game layout TL knowhow article is an amazing reference.
Throw off those chains of reason, and your prison disappears. | Check your posting frequency timeline: http://www.teamliquid.net/mytlnet/post_activity_img.php
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 30 2013 04:26 GMT
#39
On March 30 2013 13:22 Rollin wrote:
Wow this looks complex, glad my game won't need to have this stuff in it :D. Collision detection is so easy in comparison

By the way I love your stuff cecil, your game layout TL knowhow article is an amazing reference.

Awe why thank you for the compliments
Prev 1 2 All
Please log in or register to reply.
Live Events Refresh
Next event in 1h 33m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Sea 2607
Horang2 1924
Stork 471
Larva 247
Tasteless 228
Pusan 219
Backho 195
ggaemo 174
Nal_rA 150
PianO 127
[ Show more ]
Soulkey 73
soO 54
TY 51
ToSsGirL 46
Sacsri 19
Sharp 12
ivOry 5
Dota 2
Fuzer 134
XcaliburYe77
NeuroSwarm75
BananaSlamJamma53
XaKoH 40
Counter-Strike
Stewie2K424
Other Games
summit1g8201
singsing1040
ceh9536
WinterStarcraft442
SortOf154
Happy148
trigger7
Organizations
Other Games
gamesdonequick594
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH345
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo686
• Stunt674
• Jankos541
Upcoming Events
Afreeca Starleague
1h 33m
hero vs Alone
Royal vs Barracks
Replay Cast
15h 33m
The PondCast
1d 1h
WardiTV Summer Champion…
1d 2h
Clem vs Classic
herO vs MaxPax
Replay Cast
1d 15h
LiuLi Cup
2 days
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
2 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
2 days
Team Hawk vs Team Dewalt
BSL Team Wars
2 days
Team Hawk vs Team Bonyth
SC Evo League
3 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
[ Show More ]
Maestros of the Game
3 days
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[BSL 2025] Weekly
3 days
SC Evo League
4 days
Maestros of the Game
4 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
4 days
Team Bonyth vs Team Sziky
BSL Team Wars
4 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
5 days
Replay Cast
5 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

CSLAN 3
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSL Season 18: Qualifier 2
SEL Season 2 Championship
WardiTV Summer 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 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.