top of page

Bullet Physics Integration on Source SDK

Writer: Doğa
Doğa
Feb 8, 2019
2 min read

Introduction

That was mostly a spare time experiment for me to have some idea about Source SDK's capabilities. The repository can be found on https://github.com/dyanikoglu/source-sdk-bullet-physics


The Story

While browsing through game developement related repositories in Github, I've found someone was able to inject a different physics engine into Source SDK https://github.com/DrChat/Gmod-vphysics. After playing around with the project, I've decided to take over the project, and make further improvements. That was nice opportunity for me to discover Source SDK.

​

As first step, I had to remove whole Bullet SDK source code from upstream repository, and add Bullet SDK Github repository https://github.com/bulletphysics/bullet3 as a git submodule into my fork. With that way, Bullet SDK related commits will be completely separated from the actual work on Source SDK, and at the same time, I will be able to merge recent changes from upstream Bullet SDK repository easily. Talking about recent changes of Bullet SDK, the upstream repository was using an ancient version of Bullet, so I had to update the version, and fix lots of API change related compile errors in injection code.

​

As second step, I've tried to get more clean & well defined workflow for building the binaries for Bullet SDK & Source. To achieve a faster build workflow, I've utilized CMake to automate majority of Bullet's building process.

​

After setting up the new workflow, I've started investigating the existing physics injection source code by debugging, and tried to find bottlenecks on various scenarios. Since the injection is highly experimental, it had lots of under the hood issues as expected.

​

The biggest problem with existing injection code was the utilization of old multithreaded modules of Bullet. Those modules were deprecated like 4-5 years ago, and was replaced with more powerful and modern techniques later. I've had to rewrite physics environment initialization part of the injection source with those new multithreaded modules: https://github.com/dyanikoglu/source-sdk-bullet-physics/commit/154fff24f15e30ec130f3262a3f191793671d839 & https://github.com/dyanikoglu/source-sdk-bullet-physics/commit/d62c5870792c3e66c4750c63e9b3a4c8b6ed307d

​

After getting new multithreaded modules working, I've did some stress tests, and discovered some bottlenecks on the injection source code. I've did various commits to increase performance during scenes with lots of physics objects:

​

Results

As the final result, I was able to have somewhat stable gameplay with lots of physics bodies flying around, and was able to maintain 200+ FPS most of the time (I was probably jamming during the recording, please ignore the music if it's not your style 🙂):



... and of course, the injection didn't work in some cases, and caused some funny ragdoll physics 🙂 :

At the end, it was an interesting experiment for me to see an ancient game engine running a modern physics SDK, but of course with serious amount of issues.

 
 
 

5 Comments


Guest
Oct 15

rổ phim dạo này mình thấy hay xuất hiện trên feed nên cũng bấm thử cho biết. Mình không có thời gian ngồi lọc phim kỹ đâu, chủ yếu vào xem trang họ sắp xếp thế nào thôi. Cảm giác đầu tiên là giao diện khá “dễ thở”, nhìn phát biết ngay chỗ tìm phim mới với mấy mục phim hay, không phải bấm qua lại nhiều. Lướt xuống cũng ổn vì họ chia nội dung theo từng khối rõ ràng, dạng thẻ nên nhìn không bị ngợp. Có cái mình thích là trên mỗi phim hay có gắn nhãn kiểu HD 4K ngay gần phần thông tin, nên đỡ phải mở ra rồi mới biết chất lượng. Nói chung…

Like

Guest
Oct 15

https://soicaulodechuan.net/ hôm trước mình lướt thấy bạn bè nhắc nên ghé thử cho biết, kiểu tò mò thôi chứ không định ngồi đọc kỹ. Vào cái là thấy trang làm khá dễ nhìn, nền thoáng nên mắt đỡ mỏi. Mình để ý nhất là cách họ chia nội dung thành từng khung riêng, kéo xuống vẫn không bị lẫn lộn giữa các phần. Mấy bảng số họ canh hàng cột thẳng thớm nhìn gọn, không bị dồn chữ sát nhau như vài site mình từng xem. Menu cũng đặt chỗ dễ thấy nên bấm qua lại vài mục không phải mò. Nói chung mới vào vài phút là quen tay vì các khối thông tin và bảng dữ liệu được…

Like

Guest
Aug 27

keo nha cai mình thấy mọi người nói hoài nên cũng ghé thử cho biết, kiểu vào xem giao diện có dễ dùng không thôi. Vừa mở lên là thấy trang nhìn khá sáng sủa, khoảng trắng vừa đủ nên không bị bí hay rối mắt. Mình lướt xuống một chút thì thấy họ chia nội dung theo từng khối rõ ràng, đoạn nào ra đoạn đó nên đọc nhanh vẫn bắt được ý. Cái mình thích là mấy chỗ trình bày dạng bảng cột nhìn gọn, không phải căng mắt dò từng dòng. Thanh menu đặt ngay chỗ dễ thấy nên bấm qua lại cũng nhanh, không cần tìm nhiều. Nói chung cảm giác dùng vài phút là quen…

Like

Guest
Aug 21

Bài viết dễ đọc, ví dụ minh họa thực tế nên mình hiểu nhanh hơn, cảm ơn bạn đã chia sẻ. Mình thì hay xem thống kê XSMB mỗi ngày, cần tra lại cho tiện nên tự gom thông tin vào một trang riêng để khỏi phải tìm nhiều nơi. Bạn nào cũng quan tâm dữ liệu cập nhật theo ngày thì ghé xem thử https://graph.org/Soi-Cầu-XSMB-08-02-2

Like

Guest
Aug 11

Mình mua vé số chủ yếu cho vui thôi, kiểu có cái để hóng kết quả mỗi ngày chứ không đặt nặng chuyện đổi đời. Trước đây nghe bạn bè bàn về “cầu kèo” này nọ, mình tò mò thử theo dõi, lúc đầu thấy rối rắm nhưng xem dần thì cũng nhận ra vài chỗ hay bị lặp. Có khi mình đọc mấy bài nhận định như https://soicauxsmb.io/phan-tich-xsmb.html rồi tự note lại vài ý, sau đó đem so với kết quả để kiểm tra xem có phải mình đang tự tưởng tượng ra quy luật không. Trúng được chút thì vui thật, nhưng nhiều lần sai bét nên mình luôn tự nhắc đừng tin quá. Nói chung coi dự…

Like

© 2026 Doğa Can Yanıkoğlu

Follow

  • Twitter
  • LinkedIn
  • GitHub-Mark
bottom of page