• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:43
CEST 22:43
KST 05:43
  • 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
[ASL21] Ro8 Preview Pt2: Progenitors5Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid
Tourneys
StarCraft Evolution League (SC Evo Biweekly) 2026 GSL Season 2 Qualifiers Sparkling Tuna Cup - Weekly Open Tournament $1,400 SEL Season 3 Ladder Invitational RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
[ASL21] Ro8 Preview Pt2: Progenitors ASL21 General Discussion Why there arent any 256x256 pro maps? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Ro8 Day 3 [Megathread] Daily Proleagues [ASL21] Ro8 Day 2 Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread OutLive 25 (RTS Game) Daigo vs Menard Best of 10 Dawn of War IV Nintendo Switch Thread
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread European Politico-economics QA Mega-thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1740 users

Physics Engine - Game Programming

Blogs > CecilSunkure
Post a Reply
Normal
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-03-28 02:05:25
March 28 2013 02:00 GMT
#1
Hello all! I've been wanting to create another TL KnowHow article to go over a topic of interest: creating a custom physics engine. My last one talked a lot about high level summaries without too much implementation details. The physics engine one was going to be all about the implementation details.

[image loading]


However TL KnowHow pretty much shut down, so I don't really have the option anymore. Instead I put them up on my website and they will just chill out there forever.

So is anyone here interested in reading up a bit on what it is like to code your own custom physics engine? It happens to be a lot of geometry and linear algebra, and a lot of interesting details. I started up an article series that will be going over all the details involved in creating a small custom 2D physics engine. Here's the list of what I've finished so far:

  • Impulse Resolution
  • Manifold Generation

Just wanted to share the articles I'm creating here in case anyone was going to miss them, since TL KnowHow is a goner. I'll of course be adding more articles to the series as time passes. Since everyone loves pictures I'll share a few from the posts.

[image loading]


[image loading]
Change of basis from left to right.


[image loading]
Stacked oriented boxes from my own physics engine.


And lastly here's a sweet equation I wrote in code comments! + Show Spoiler [code] +
Eq 14:
Impulse = -(1 + Restitution) * (VelocityRelativeAtoB dot n)
-------------------------------------------------
1 1 (rA cross n)^2 (rB cross n)^2
----- + ----- + -------------- + --------------
MassA MassB InertiaTensorA InertiaTensorB


**
micronesia
Profile Blog Joined July 2006
United States24771 Posts
Last Edited: 2013-03-28 02:15:25
March 28 2013 02:11 GMT
#2
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
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 02:23 GMT
#3
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.
jrkirby
Profile Blog Joined August 2010
United States1510 Posts
March 28 2013 02:41 GMT
#4
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.


I think collision detection or arbitrary shapes is a bit harder in 3d than in 2d, but a lot of the concepts are the same.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-03-28 03:06:50
March 28 2013 03:02 GMT
#5
On March 28 2013 11:41 jrkirby wrote:
Show nested quote +
On March 28 2013 11:23 CecilSunkure wrote:
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.


I think collision detection or arbitrary shapes is a bit harder in 3d than in 2d, but a lot of the concepts are the same.

Yeah that's one area that gets more difficult. Another one is friction.
corpuscle
Profile Blog Joined April 2011
United States1967 Posts
March 28 2013 03:06 GMT
#6
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.


Do software firms that do a lot of physics modeling (like game companies) hire physicists as consultants, or anything like that? I can understand physicists not being the best at programming, but as far as I know, many of them at least know the basics of coding, and could advise programmers on more efficient ways to implement physics problems.

I took a scientific computing class that was pretty much a mix of physics and CS majors, and the CS majors had devised some of the most unwieldy and awkward numerical techniques to solve problems that can be simplified with math because they simply didn't know how, it was pretty ugly. The physics majors, of course, had ugly and poorly-organized code, so it's not like we were any better, but when we worked in pairs, we ended up with some pretty solid work, considering the level of expertise we were at.
From the void I am born into wave and particle
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 03:15 GMT
#7
On March 28 2013 12:06 corpuscle wrote:
Show nested quote +
On March 28 2013 11:23 CecilSunkure wrote:
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.


Do software firms that do a lot of physics modeling (like game companies) hire physicists as consultants, or anything like that? I can understand physicists not being the best at programming, but as far as I know, many of them at least know the basics of coding, and could advise programmers on more efficient ways to implement physics problems.

I took a scientific computing class that was pretty much a mix of physics and CS majors, and the CS majors had devised some of the most unwieldy and awkward numerical techniques to solve problems that can be simplified with math because they simply didn't know how, it was pretty ugly. The physics majors, of course, had ugly and poorly-organized code, so it's not like we were any better, but when we worked in pairs, we ended up with some pretty solid work, considering the level of expertise we were at.

Not that I know of. Usually companies just use a pre-made engine (Havok or something), or hire people who are very good at physics and math and specialize in computer science. For example Erin Catto does all the physics at Blizzard all on his own. All of it. That guy however is a mathematician and an excellent computer scientist. Also, physics engine development is very low in demand. Studios have like, one guy that does it and usually this guy has been doing it for years and years. It's sort of like engine architect, or technical director; very strong professionals take these positions, and there's almost no demand for positions like such to be filled.

tldr; physics programming isn't a job position that has any demand (in my own opinion).

It is quite interesting to hear about you guys working together though! Honestly computer scientists should have an excellent understanding of math in order to be a competent game developer. Like I said, people who are good at both sides of the fence are really rare, which is why it's so hard for most programmers to get a game industry job related to computer science.
corpuscle
Profile Blog Joined April 2011
United States1967 Posts
March 28 2013 03:29 GMT
#8
On March 28 2013 12:15 CecilSunkure wrote:It is quite interesting to hear about you guys working together though! Honestly computer scientists should have an excellent understanding of math in order to be a competent game developer. Like I said, people who are good at both sides of the fence are really rare, which is why it's so hard for most programmers to get a game industry job related to computer science.


Oh, they knew the math, they just didn't really know the various ways to apply it to physics. One of the problems we did, for example, involved the Coriolis effect, so I got to introduce my partner to non-inertial reference frames and all that fun stuff, which cleaned up the actual computation by quite a bit. He could follow the math easily as I showed it to him, he just wouldn't have thought of approaching the problem that way, I guess.

That kind of sucks to hear about how (relatively) unimportant physicists are in game development, though. It's not surprising, but I guess a part of me was hoping that every game company secretly had a team of top-flight physicists stashed away in a dank basement somewhere.
From the void I am born into wave and particle
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 28 2013 03:34 GMT
#9
On March 28 2013 12:29 corpuscle wrote:
Show nested quote +
On March 28 2013 12:15 CecilSunkure wrote:It is quite interesting to hear about you guys working together though! Honestly computer scientists should have an excellent understanding of math in order to be a competent game developer. Like I said, people who are good at both sides of the fence are really rare, which is why it's so hard for most programmers to get a game industry job related to computer science.


Oh, they knew the math, they just didn't really know the various ways to apply it to physics. One of the problems we did, for example, involved the Coriolis effect, so I got to introduce my partner to non-inertial reference frames and all that fun stuff, which cleaned up the actual computation by quite a bit. He could follow the math easily as I showed it to him, he just wouldn't have thought of approaching the problem that way, I guess.

That kind of sucks to hear about how (relatively) unimportant physicists are in game development, though. It's not surprising, but I guess a part of me was hoping that every game company secretly had a team of top-flight physicists stashed away in a dank basement somewhere.

Okay well it's good that he could follow the math!

Yeah, they don't hire straight physicists as far as I know. Of course there's no reason why you couldn't pursue such a job yourself. There'd just need to be a lot of independent study done on your part.
wptlzkwjd
Profile Joined January 2012
Canada1240 Posts
March 28 2013 04:02 GMT
#10
Haha nice. Is this going to be the next CryEngine 4?
Feel free to add me on steam: http://steamcommunity.com/id/MagnusAskeland/
micronesia
Profile Blog Joined July 2006
United States24771 Posts
Last Edited: 2013-03-28 04:04:19
March 28 2013 04:04 GMT
#11
Lots of physicists become solid programmers. In fact, many people major in physics then go on to become software engineers. Others use programming in finance, astronomical modeling, etc.
ModeratorThere are animal crackers for people and there are people crackers for animals.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-03-28 04:44:39
March 28 2013 04:44 GMT
#12
On March 28 2013 13:02 wptlzkwjd wrote:
Haha nice. Is this going to be the next CryEngine 4?

Haha probably not! However it will be used next year in a game I'm devoting a year of my life (at least one year, maybe two) to
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
March 28 2013 06:06 GMT
#13
On March 28 2013 12:02 CecilSunkure wrote:
Show nested quote +
On March 28 2013 11:41 jrkirby wrote:
On March 28 2013 11:23 CecilSunkure wrote:
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.


I think collision detection or arbitrary shapes is a bit harder in 3d than in 2d, but a lot of the concepts are the same.

Yeah that's one area that gets more difficult. Another one is friction.

Yep, friction's a bitch.

The thing about mathematically demanding computer science projects in a commercial environment is that most of the math has already been figured out, and algorithms can be found in research papers or for more generic problems, on the internet. If you've taken the required math for a CS degree at a UC it's not very hard to determine how to properly implement these solutions. Game engine physics require a good bit of science knowledge as well as good programming skills and complete control of whatever language you're writing in to get it right. The physics engine in games needs to run in real-time and be consistent. This means the "correct" mathematical solution might not work because it runs too slowly, so you need to modify it to run quicker without losing too much accuracy. This makes a giant mess if you don't completely understand the math, the physics, and the programming. Bringing together just 2 of the three disciplines is pretty manageable, but all three require a very specific skill set and lots of experience to get right. The place where these skills are the most valuable i probably in medical simulation research facilities, and I think there's a lot more jobs out there for people with this skillset than you might think, but you're correct in that they aren't in the entertainment industry.
Heyoka
Profile Blog Joined March 2008
Katowice25012 Posts
March 28 2013 06:08 GMT
#14
On March 28 2013 13:04 micronesia wrote:
Lots of physicists become solid programmers. In fact, many people major in physics then go on to become software engineers. Others use programming in finance, astronomical modeling, etc.


My brief experiences in academia have lead me to believe this is a really smart career move. In all the labs I've worked with or had friends in they were constantly looking for people who could program with the tools they had to get the kinds of simulations and models they needed for publications, making the guys who knew both the science aspect as well as the technical side really valuable. I'd guess that someone who is highly skilled in mathmatics as well as being a good computer science specialist has a lot of opportunities so they don't often land in video games (which I guess would explain why there are a few well known engines out there that handle most of it this for the majority of studios).
@RealHeyoka | ESL / DreamHack StarCraft Lead
CatNzHat
Profile Blog Joined February 2011
United States1599 Posts
March 28 2013 06:09 GMT
#15
On March 28 2013 13:02 wptlzkwjd wrote:
Haha nice. Is this going to be the next CryEngine 4?


I would so play a 2d crysis platformer. Someone please do this and post to cryengine developer forum...

Seriously though, nice work cecil, I really appreciate that you spend the time to create the educational content, especially since I've moved from the CS academic world to a digital media and design trade school.

Teaching others what you have learned ensure you won't forget it, this has been shown in many studies, keep up the great work!
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
March 28 2013 06:38 GMT
#16
Ah this lead to a cascade of link clicking and article/blog reading, resulting in the consumption of many tasty tidbits of useful info I had not come across before. Thanks!
Comprehensive strategic intention: DNE
wei2coolman
Profile Joined November 2010
United States60033 Posts
March 28 2013 09:26 GMT
#17
Correct me if I'm wrong, but the issue with physics coding is more often than not the game engine doesn't actually code for physics, so much as it codes the "effects" of physics, if you know what I mean.
liftlift > tsm
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
March 28 2013 09:54 GMT
#18
On March 28 2013 12:15 CecilSunkure wrote:
Show nested quote +
On March 28 2013 12:06 corpuscle wrote:
On March 28 2013 11:23 CecilSunkure wrote:
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.


Do software firms that do a lot of physics modeling (like game companies) hire physicists as consultants, or anything like that? I can understand physicists not being the best at programming, but as far as I know, many of them at least know the basics of coding, and could advise programmers on more efficient ways to implement physics problems.

I took a scientific computing class that was pretty much a mix of physics and CS majors, and the CS majors had devised some of the most unwieldy and awkward numerical techniques to solve problems that can be simplified with math because they simply didn't know how, it was pretty ugly. The physics majors, of course, had ugly and poorly-organized code, so it's not like we were any better, but when we worked in pairs, we ended up with some pretty solid work, considering the level of expertise we were at.

Not that I know of. Usually companies just use a pre-made engine (Havok or something), or hire people who are very good at physics and math and specialize in computer science. For example Erin Catto does all the physics at Blizzard all on his own. All of it. That guy however is a mathematician and an excellent computer scientist. Also, physics engine development is very low in demand. Studios have like, one guy that does it and usually this guy has been doing it for years and years. It's sort of like engine architect, or technical director; very strong professionals take these positions, and there's almost no demand for positions like such to be filled.

tldr; physics programming isn't a job position that has any demand (in my own opinion).

It is quite interesting to hear about you guys working together though! Honestly computer scientists should have an excellent understanding of math in order to be a competent game developer. Like I said, people who are good at both sides of the fence are really rare, which is why it's so hard for most programmers to get a game industry job related to computer science.


hehe I use Catto's 2D physics engine in all my 2d games
And all is illuminated.
Otolia
Profile Blog Joined July 2011
France5805 Posts
Last Edited: 2013-03-28 11:38:40
March 28 2013 11:35 GMT
#19
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.
Gianttt
Profile Blog Joined November 2011
Netherlands194 Posts
Last Edited: 2013-03-28 16:40:52
March 28 2013 16:40 GMT
#20
I'd love to see more of this. I am a programmer both working for a webdesign studio and freelancer and always like to learn more about these subjects.
Eventually I would love getting more known in using science in websites.

Good luck!
Winners: It is difficult, but it's possible.
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 States24771 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 States24771 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 States24771 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
Bisutopia19344 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
Normal
Please log in or register to reply.
Live Events Refresh
Monday Night Weeklies
16:00
#50
RotterdaM776
TKL 371
SteadfastSC182
BRAT_OK 178
IndyStarCraft 176
ZombieGrub95
EnkiAlexander 39
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 895
TKL 371
SteadfastSC 201
IndyStarCraft 183
BRAT_OK 178
ZombieGrub95
StarCraft: Brood War
Calm 3242
Mini 408
ggaemo 213
Hm[arnc] 22
Dota 2
Gorgc6341
monkeys_forever447
League of Legends
JimRising 311
Counter-Strike
pashabiceps2104
Super Smash Bros
Mew2King103
Heroes of the Storm
Liquid`Hasu436
Other Games
Grubby4801
summit1g2442
FrodaN1197
Liquid`RaSZi1193
Beastyqt1077
shahzam436
C9.Mang0299
mouzStarbuck175
ArmadaUGS160
KnowMe139
UpATreeSC83
Trikslyr55
Organizations
Other Games
BasetradeTV482
Dota 2
PGL Dota 2 - Main Stream42
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 16 non-featured ]
StarCraft 2
• kabyraGe 125
• Adnapsc2 13
• Reevou 5
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• imaqtpie2446
Other Games
• WagamamaTV292
• Shiphtur265
Upcoming Events
Replay Cast
3h 17m
Sparkling Tuna Cup
13h 17m
Afreeca Starleague
13h 17m
Snow vs Flash
WardiTV Invitational
14h 17m
SHIN vs Nicoract
Solar vs Nice
PiGosaur Cup
1d 3h
GSL
1d 12h
Classic vs Cure
Maru vs Rogue
GSL
2 days
SHIN vs Zoun
ByuN vs herO
OSC
2 days
OSC
2 days
Replay Cast
3 days
[ Show More ]
Escore
3 days
The PondCast
3 days
WardiTV Invitational
3 days
Zoun vs Ryung
Lambo vs ShoWTimE
OSC
4 days
Replay Cast
4 days
CranKy Ducklings
4 days
RSL Revival
4 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
4 days
Krystianer vs TriGGeR
Cure vs Rogue
uThermal 2v2 Circuit
4 days
BSL
4 days
Replay Cast
5 days
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
5 days
BSL
5 days
GSL
6 days
Afreeca Starleague
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

YSL S3
Escore Tournament S2: W6
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
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 © 2026 TLnet. All Rights Reserved.