aszkid / milsim Goto Github PK
View Code? Open in Web Editor NEWC++ game engine—one day, an open-source ARMA.
C++ game engine—one day, an open-source ARMA.
We call Hermes::clear()
, which deletes the message queue, at every main-thread update tick (fixed 60Hz rate). In parallel, the render thread runs for a single render-frame, so it sees the message queue disappear a few times. It's a miracle that we are catching (from the render-thread perspective) all messages we care about.
Fix: have a double-buffered message queue. Pushing a message writes to the "hot" (writing) queue, while reading messages fetches from the "cold" (reading) queue. Hermes::swap()
should clean the cold queue, and be assigned std::move(hot_queue)
. This has benefits and drawbacks.
The good: no synchronization. The queue implementation we use is lock-free to begin with, and no read-write locks are necessary using double-buffering.
The bad: one frame (16ms) of reaction delay. Game entities react to events that happened on the previous frame.
Looking at my system's task manager, it seems like a fresh milsim
instance (no assets LOADED
, pipeline created) acquires 0.2MB of memory every second or so, while truly doing nothing.
That's clearly bad. Look it up.
In the same vein as #1, sanitize flags detect a bunch of indirect leaks related to my radeongpu
open-source driver.
Indirect leak of 4 byte(s) in 1 object(s) allocated from:
# 0 0x7fe7b4894b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
# 1 0x7fe7acc542c3 (/usr/lib/x86_64-linux-gnu/dri/radeonsi_dri.so+0x2912c3)
etc, which add up to
SUMMARY: AddressSanitizer: 365299 byte(s) leaked in 758 allocation(s).
As far as I know, we clean up all OpenGL resources, and I have seen these reports since I added sanitize flags to the build.
In
milsim/engine/src/sys/render.cpp
Line 333 in 001acd2
Alexandria
essentially runs on the main thread, so we might be inserting or removing assets while the render thread requests for one.
We should either change the architecture of things or synchronize access to Alexandria
(and in either case, eventually move Alexandria
to its own "asset" thread).
Adding and removing assets is not such a common thing (it's in our best interest to batch loading at start-up), but I imagine that accessing them is a relatively frequent task. An initial implementation will of course use a simple mutex, until further benchmarking.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.