]> git.tdb.fi Git - libs/game.git/log
libs/game.git
5 months agoMiscellaneous minor cleanups master
Mikko Rasa [Tue, 22 Apr 2025 21:43:10 +0000 (00:43 +0300)]
Miscellaneous minor cleanups

5 months agoImplement a VR mode for the playground example
Mikko Rasa [Tue, 22 Apr 2025 21:40:07 +0000 (00:40 +0300)]
Implement a VR mode for the playground example

Currently grabbing toys only works with left hand because Input::Bindings
does not support multiple devices of the same type.

5 months agoAdjust destruction order of Application members
Mikko Rasa [Tue, 22 Apr 2025 21:38:09 +0000 (00:38 +0300)]
Adjust destruction order of Application members

The VR system needs to be destroyed before the GL device because it
holds some Vulkan images created using the latter.

5 months agoRefactor layer and collision mask logic in PhysicsSystem
Mikko Rasa [Tue, 22 Apr 2025 21:36:58 +0000 (00:36 +0300)]
Refactor layer and collision mask logic in PhysicsSystem

Collisions between moving and incorporeal were not two-way, and the
chained ternary was a bit hard to read.

5 months agoAdd missing event observation to PhysicsSystem
Mikko Rasa [Tue, 22 Apr 2025 21:34:55 +0000 (00:34 +0300)]
Add missing event observation to PhysicsSystem

5 months agoClarify names of some functions
Mikko Rasa [Tue, 22 Apr 2025 21:18:32 +0000 (00:18 +0300)]
Clarify names of some functions

5 months agoTrigger reflected base class discovery from the pool allocator
Mikko Rasa [Tue, 22 Apr 2025 21:15:40 +0000 (00:15 +0300)]
Trigger reflected base class discovery from the pool allocator

This makes it run when a previously unseen intermediate base class is
requested, even if it does not own any components.

5 months agoRedesign reflected base class discovery
Mikko Rasa [Tue, 22 Apr 2025 21:06:07 +0000 (00:06 +0300)]
Redesign reflected base class discovery

It now uses subobject layout to find out which classes can be bases of
which other ones.  This allows the discovery to work even when an object
of the exact type is not available, such as intermediate base classes.

5 months agoUpdate body generation when setting motion type
Mikko Rasa [Fri, 18 Apr 2025 22:29:43 +0000 (01:29 +0300)]
Update body generation when setting motion type

5 months agoInitialize expected generations to nonzero
Mikko Rasa [Fri, 18 Apr 2025 22:27:51 +0000 (01:27 +0300)]
Initialize expected generations to nonzero

If a component is only modified during initialization its generation
values remain as zero.

5 months agoDon't autogenerate mesh if the shape has no technique name
Mikko Rasa [Fri, 18 Apr 2025 22:27:30 +0000 (01:27 +0300)]
Don't autogenerate mesh if the shape has no technique name

6 months agoUse fresh parent state when propagating transforms
Mikko Rasa [Thu, 17 Apr 2025 20:35:57 +0000 (23:35 +0300)]
Use fresh parent state when propagating transforms

6 months agoAdd components for defining joints between rigid bodies
Mikko Rasa [Tue, 15 Apr 2025 21:54:13 +0000 (00:54 +0300)]
Add components for defining joints between rigid bodies

6 months agoAllow overriding the base class of BufferedComponent
Mikko Rasa [Tue, 15 Apr 2025 21:50:57 +0000 (00:50 +0300)]
Allow overriding the base class of BufferedComponent

It still has to ultimately derive from Component, but this allows
inserting an intermediate base class.

6 months agoAdd a setup flag to make rigid bodies incorporeal
Mikko Rasa [Mon, 14 Apr 2025 10:34:07 +0000 (13:34 +0300)]
Add a setup flag to make rigid bodies incorporeal

It can be used to create triggers which report collisions but don't
affect the physics simulation.

6 months agoUse world space transforms to interface with physics simulation
Mikko Rasa [Mon, 14 Apr 2025 10:12:59 +0000 (13:12 +0300)]
Use world space transforms to interface with physics simulation

The physics library require everything to be in the same space.

6 months agoSupport setting transform values in world space
Mikko Rasa [Mon, 14 Apr 2025 10:11:19 +0000 (13:11 +0300)]
Support setting transform values in world space

6 months agoSkip propagating transforms that were not changed
Mikko Rasa [Mon, 14 Apr 2025 10:03:48 +0000 (13:03 +0300)]
Skip propagating transforms that were not changed

It saves some work and is necessary for change tracking in systems to
function.

6 months agoClear the dirty flag when updating transform order
Mikko Rasa [Mon, 14 Apr 2025 09:56:31 +0000 (12:56 +0300)]
Clear the dirty flag when updating transform order

6 months agoOnly update transform component if the physics body is dynamic
Mikko Rasa [Sun, 13 Apr 2025 15:02:37 +0000 (18:02 +0300)]
Only update transform component if the physics body is dynamic

The simulation does not affect static bodies at all and kinematic bodies
are expected to end up in the externally specified position.

6 months agoAdd an event for collisions between rigid bodies
Mikko Rasa [Sun, 13 Apr 2025 13:51:05 +0000 (16:51 +0300)]
Add an event for collisions between rigid bodies

RigidBody now takes a setup with a flag to enable collision reporting.

6 months agoSupport emitting preconstructed events without copying
Mikko Rasa [Sun, 13 Apr 2025 13:47:43 +0000 (16:47 +0300)]
Support emitting preconstructed events without copying

6 months agoOnly add colliders to the lookup if necessary
Mikko Rasa [Sun, 13 Apr 2025 13:01:31 +0000 (16:01 +0300)]
Only add colliders to the lookup if necessary

6 months agoRefactor handling of pending physics bodies
Mikko Rasa [Sun, 13 Apr 2025 10:43:50 +0000 (13:43 +0300)]
Refactor handling of pending physics bodies

This avoids the need to keep the list of pending bodies sorted.

6 months agoTake advantage of the new algorithms in mspcore
Mikko Rasa [Thu, 3 Apr 2025 12:38:43 +0000 (15:38 +0300)]
Take advantage of the new algorithms in mspcore

6 months agoDon't allow setting a zero field of view at runtime
Mikko Rasa [Wed, 2 Apr 2025 11:50:36 +0000 (14:50 +0300)]
Don't allow setting a zero field of view at runtime

6 months agoAdd a function to set the stepsize
Mikko Rasa [Wed, 2 Apr 2025 11:48:56 +0000 (14:48 +0300)]
Add a function to set the stepsize

6 months agoIgnore catch-up ticks in Renderer
Mikko Rasa [Wed, 2 Apr 2025 11:20:46 +0000 (14:20 +0300)]
Ignore catch-up ticks in Renderer

If falling behind was caused by rendering (via vsync or just complex
frames) trying to render on every tick would just make the situation
worse.

Also render on partial ticks in case the desired output framerate is
higher than the reciprocal stepsize.

6 months agoPass more information about tick timing to systems
Mikko Rasa [Wed, 2 Apr 2025 10:30:45 +0000 (13:30 +0300)]
Pass more information about tick timing to systems

They now get the remaining amount of backlog, which allows detecting if
catch up is happening or processing partial ticks.

6 months agoImplement moving toys with the mouse in the playground example
Mikko Rasa [Mon, 31 Mar 2025 12:08:46 +0000 (15:08 +0300)]
Implement moving toys with the mouse in the playground example

6 months agoAdd support for kinematic motion of rigid bodies
Mikko Rasa [Mon, 31 Mar 2025 12:03:31 +0000 (15:03 +0300)]
Add support for kinematic motion of rigid bodies

6 months agoUse a different way of determining the default transactor of a component
Mikko Rasa [Mon, 31 Mar 2025 11:59:33 +0000 (14:59 +0300)]
Use a different way of determining the default transactor of a component

Declaring the type alias in BufferedComponent results in a transactor
for BufferedComponent<T>, which does not match the actual type used in
system dependencies.

6 months agoAvoid committing systems at the wrong time
Mikko Rasa [Sun, 30 Mar 2025 13:28:27 +0000 (16:28 +0300)]
Avoid committing systems at the wrong time

Checks were missing to only commit a system after it has finished
running and not committing it a second time.

6 months agoAdd a missing include
Mikko Rasa [Sun, 30 Mar 2025 13:00:00 +0000 (16:00 +0300)]
Add a missing include

6 months agoAdd raycast functionality
Mikko Rasa [Sun, 30 Mar 2025 12:35:35 +0000 (15:35 +0300)]
Add raycast functionality

Includes a helper function in the Camera component to create rays.

6 months agoSet physics bodies on different layers based on whether they move
Mikko Rasa [Sun, 30 Mar 2025 12:07:16 +0000 (15:07 +0300)]
Set physics bodies on different layers based on whether they move

This should improve performance when there's a lot of static bodies
compared to moving ones.

6 months agoUse AffineTransform instead of Matrix in the Transform component
Mikko Rasa [Fri, 28 Mar 2025 19:13:32 +0000 (21:13 +0200)]
Use AffineTransform instead of Matrix in the Transform component

6 months agoImplement commit barriers in SystemScheduler
Mikko Rasa [Sun, 23 Mar 2025 12:10:02 +0000 (14:10 +0200)]
Implement commit barriers in SystemScheduler

In a multithreaded environment systems which write to a component must
wait until potential concurrent reads have finished before committing
the changes.

6 months agoRe-separate transaction unblock/block from prepare/commit
Mikko Rasa [Sun, 23 Mar 2025 11:38:45 +0000 (13:38 +0200)]
Re-separate transaction unblock/block from prepare/commit

Multithreaded ticks may require waiting or even running other systems in
between a system's tick finishing and the changes being committed.

Customized transactors must explicitly unblock and re-block access if
they wish to modify the component during commit.

6 months agoMove System tick bracketing to SystemScheduler
Mikko Rasa [Sun, 23 Mar 2025 11:32:48 +0000 (13:32 +0200)]
Move System tick bracketing to SystemScheduler

6 months agoRefactor dependency iteration in SystemScheduler to be more reusable
Mikko Rasa [Sun, 23 Mar 2025 11:16:12 +0000 (13:16 +0200)]
Refactor dependency iteration in SystemScheduler to be more reusable

6 months agoMake BufferedComponent's commit/prepare functions non-virtual
Mikko Rasa [Sat, 22 Mar 2025 10:29:11 +0000 (12:29 +0200)]
Make BufferedComponent's commit/prepare functions non-virtual

Customizing these should be handled through transactors.

6 months agoConvert TransformPropagator to a Transactor
Mikko Rasa [Sat, 22 Mar 2025 10:28:16 +0000 (12:28 +0200)]
Convert TransformPropagator to a Transactor

The propagation is now done automatically after any system modifies
transforms.

6 months agoRewrite System tick bracketing with a Transactor class
Mikko Rasa [Sat, 22 Mar 2025 10:25:34 +0000 (12:25 +0200)]
Rewrite System tick bracketing with a Transactor class

This allows components to better customize their transactions.

6 months agoRename Stage::get_system to find_system
Mikko Rasa [Thu, 20 Mar 2025 16:23:40 +0000 (18:23 +0200)]
Rename Stage::get_system to find_system

It can return null so this is more appropriate.

6 months agoPrevent concurrent write access to unbuffered components
Mikko Rasa [Tue, 18 Mar 2025 22:03:04 +0000 (00:03 +0200)]
Prevent concurrent write access to unbuffered components

6 months agoAllow read-only accesses to a component to occur in parallel
Mikko Rasa [Tue, 18 Mar 2025 13:48:17 +0000 (15:48 +0200)]
Allow read-only accesses to a component to occur in parallel

6 months agoAdd test cases for SystemScheduler
Mikko Rasa [Tue, 18 Mar 2025 11:38:56 +0000 (13:38 +0200)]
Add test cases for SystemScheduler

6 months agoTrack individual dependencies in SystemScheduler
Mikko Rasa [Tue, 18 Mar 2025 11:21:10 +0000 (13:21 +0200)]
Track individual dependencies in SystemScheduler

Arranging the systems in groups does not provide enough flexibility for
parallelizing the execution.

7 months agoAdd texture coordinates to generated meshes
Mikko Rasa [Sat, 15 Mar 2025 22:27:21 +0000 (00:27 +0200)]
Add texture coordinates to generated meshes

7 months agoMake temporary copies of component/child vectors when synthesizing events
Mikko Rasa [Sat, 15 Mar 2025 22:24:09 +0000 (00:24 +0200)]
Make temporary copies of component/child vectors when synthesizing events

An event listener might add components or child entities, which can
invalidate iterators to the vectors.

7 months agoAdd an example application for physics
Mikko Rasa [Sat, 15 Mar 2025 18:26:13 +0000 (20:26 +0200)]
Add an example application for physics

7 months agoMinor improvements
Mikko Rasa [Sat, 15 Mar 2025 18:24:34 +0000 (20:24 +0200)]
Minor improvements

7 months agoSupport loading stage contents from files
Mikko Rasa [Sat, 15 Mar 2025 17:39:22 +0000 (19:39 +0200)]
Support loading stage contents from files

7 months agoBasic integration of physics
Mikko Rasa [Sat, 15 Mar 2025 17:36:59 +0000 (19:36 +0200)]
Basic integration of physics

7 months agoAdd an early_tick function to System
Mikko Rasa [Sat, 15 Mar 2025 15:23:49 +0000 (17:23 +0200)]
Add an early_tick function to System

7 months agoAdd utilities for keeping track of entities with specific components
Mikko Rasa [Sat, 15 Mar 2025 15:15:45 +0000 (17:15 +0200)]
Add utilities for keeping track of entities with specific components

7 months agoAdd generation number to BufferedComponent
Mikko Rasa [Sat, 15 Mar 2025 14:49:58 +0000 (16:49 +0200)]
Add generation number to BufferedComponent

7 months agoMake the data members of BufferedComponent private
Mikko Rasa [Sat, 15 Mar 2025 14:49:12 +0000 (16:49 +0200)]
Make the data members of BufferedComponent private

Derived classes should only access them through the provided functions.

7 months agoSet camera to non-VR view
Mikko Rasa [Sat, 15 Mar 2025 13:03:17 +0000 (15:03 +0200)]
Set camera to non-VR view

This accidentally got broken in 503a9c6 while working on the VR stuff.

7 months agoAdjust order of members in Renderer::RenderedEntity
Mikko Rasa [Sat, 15 Mar 2025 12:55:49 +0000 (14:55 +0200)]
Adjust order of members in Renderer::RenderedEntity

Since destroying the DynamicMeshSource triggers the destruction of the
MeshRenderer, it's important that the former is destroyed first or there
will be an invalid access to an already destroyed Owned handle.

7 months agoDrop the shape wrapper statement from ShapeSetup loader
Mikko Rasa [Sat, 15 Mar 2025 10:54:35 +0000 (12:54 +0200)]
Drop the shape wrapper statement from ShapeSetup loader

Instead use an auxiliary loader to allow the shape to be specified
inline with the rest of the setup.

7 months agoMake the shape component available for generated setups
Mikko Rasa [Sat, 15 Mar 2025 10:53:46 +0000 (12:53 +0200)]
Make the shape component available for generated setups

7 months agoEnsure that a Shape's setup actually has a shape
Mikko Rasa [Sat, 15 Mar 2025 10:46:25 +0000 (12:46 +0200)]
Ensure that a Shape's setup actually has a shape

7 months agoSupport declaring external types for generated setups
Mikko Rasa [Sat, 15 Mar 2025 10:44:02 +0000 (12:44 +0200)]
Support declaring external types for generated setups

7 months agoAlways check pool relationships when a new pool is created
Mikko Rasa [Sat, 15 Mar 2025 10:41:48 +0000 (12:41 +0200)]
Always check pool relationships when a new pool is created

7 months agoUse the auto type to hold the result of dynamic_handle_cast
Mikko Rasa [Thu, 6 Mar 2025 13:10:07 +0000 (15:10 +0200)]
Use the auto type to hold the result of dynamic_handle_cast

It's clear enough what the type will be so no need to repeat it.

7 months agoPut simple constructor definitions in headers
Mikko Rasa [Thu, 6 Mar 2025 13:09:04 +0000 (15:09 +0200)]
Put simple constructor definitions in headers

8 months agoRework virtual reality initialization
Mikko Rasa [Wed, 12 Feb 2025 16:48:12 +0000 (18:48 +0200)]
Rework virtual reality initialization

VR mode must now be requested when creating the Application object,
because it may need to interact with graphics initialization.

8 months agoFix .gitignore
Mikko Rasa [Fri, 31 Jan 2025 21:01:31 +0000 (23:01 +0200)]
Fix .gitignore

8 months agoUse the aligned form of operator delete
Mikko Rasa [Fri, 31 Jan 2025 21:00:34 +0000 (23:00 +0200)]
Use the aligned form of operator delete

By the language spec the form of new and delete must match

8 months agoClean up MeshRenderer when DynamicMeshSource is destroyed
Mikko Rasa [Fri, 31 Jan 2025 21:00:08 +0000 (23:00 +0200)]
Clean up MeshRenderer when DynamicMeshSource is destroyed

8 months agoAdd some missing VR calls
Mikko Rasa [Fri, 31 Jan 2025 20:59:45 +0000 (22:59 +0200)]
Add some missing VR calls

8 months agoRewrite the VR code to match changes in mspvr
Mikko Rasa [Thu, 30 Jan 2025 17:34:22 +0000 (19:34 +0200)]
Rewrite the VR code to match changes in mspvr

There now needs to be an entity tagged with a TrackingAnchor component
to designate the location of the tracking area within the game world.
A player character entity or something closely related should generally
be suitable.

8 months agoAdjust to different way of accessing VR::MotionController type constant
Mikko Rasa [Sun, 26 Jan 2025 23:21:17 +0000 (01:21 +0200)]
Adjust to different way of accessing VR::MotionController type constant

8 months agoExport TransformValues in the API
Mikko Rasa [Sun, 26 Jan 2025 20:49:01 +0000 (22:49 +0200)]
Export TransformValues in the API

8 months agoAdd missing includes
Mikko Rasa [Sun, 26 Jan 2025 20:48:19 +0000 (22:48 +0200)]
Add missing includes

8 months agoUse different allocation functions for pools
Mikko Rasa [Sun, 26 Jan 2025 20:47:12 +0000 (22:47 +0200)]
Use different allocation functions for pools

It appears using alignas with new is a gcc extension.

8 months agoExplicitly declare special members of certain classes
Mikko Rasa [Sun, 26 Jan 2025 20:43:06 +0000 (22:43 +0200)]
Explicitly declare special members of certain classes

MSVC tries to generate them for DLL export and that fails because of
vectors of unique pointers.

8 months agoAdjust for changes in mspnet
Mikko Rasa [Sun, 26 Jan 2025 18:43:41 +0000 (20:43 +0200)]
Adjust for changes in mspnet

8 months agoHide thread-local data behind accessor functions
Mikko Rasa [Sun, 26 Jan 2025 20:42:00 +0000 (22:42 +0200)]
Hide thread-local data behind accessor functions

MSVC doesn't like them as static members of classes with DLL interface.

8 months agoAdd a component for creating meshes via geometry definitions
Mikko Rasa [Sun, 26 Jan 2025 16:33:10 +0000 (18:33 +0200)]
Add a component for creating meshes via geometry definitions

8 months agoAdd a missing include and forward declaration
Mikko Rasa [Sun, 26 Jan 2025 16:27:37 +0000 (18:27 +0200)]
Add a missing include and forward declaration

8 months agoAdd virtual reality support
Mikko Rasa [Sun, 26 Jan 2025 16:26:37 +0000 (18:26 +0200)]
Add virtual reality support

8 months agoRework the relationship between renderers and the view
Mikko Rasa [Sun, 26 Jan 2025 16:20:03 +0000 (18:20 +0200)]
Rework the relationship between renderers and the view

A renderer can't just associate itself with the view in its constructor
since stages may get activated multiple times during the application's
lifetime and the renderer for each stage is only created the first time.

8 months agoInclude the input device in the LocalPlayerArrived event
Mikko Rasa [Sun, 26 Jan 2025 15:16:30 +0000 (17:16 +0200)]
Include the input device in the LocalPlayerArrived event

8 months agoAdd factory function from a matrix to TransformValues
Mikko Rasa [Sun, 26 Jan 2025 15:14:15 +0000 (17:14 +0200)]
Add factory function from a matrix to TransformValues

8 months agoRemove more unnecessary uses of std::ref
Mikko Rasa [Sun, 19 Jan 2025 10:08:33 +0000 (12:08 +0200)]
Remove more unnecessary uses of std::ref

These didn't get caught the last time since they lacked the namespace
prefix.

20 months agoAdd polymorphism discovery for systems
Mikko Rasa [Sat, 27 Jan 2024 09:19:54 +0000 (11:19 +0200)]
Add polymorphism discovery for systems

20 months agoCheck bases of intermediate base classes
Mikko Rasa [Sat, 27 Jan 2024 09:13:55 +0000 (11:13 +0200)]
Check bases of intermediate base classes

Without this iterating objects of such an intermediate base type does
not work.

20 months agoAllow reflection to detect polymorphic bases from a type alias
Mikko Rasa [Sat, 27 Jan 2024 08:59:11 +0000 (10:59 +0200)]
Allow reflection to detect polymorphic bases from a type alias

20 months agoImplement queueing for remote calls
Mikko Rasa [Sun, 21 Jan 2024 18:10:50 +0000 (20:10 +0200)]
Implement queueing for remote calls

This allows received calls to be dispatched in a controlled order during
a frame.

20 months agoConsolidate the remote call classes
Mikko Rasa [Sun, 21 Jan 2024 17:47:16 +0000 (19:47 +0200)]
Consolidate the remote call classes

Global and entity calls are now declared using the same class.  If the
entity type is void (the default), the call is global.

21 months agoAdjust network code for changes in the mspnet library
Mikko Rasa [Tue, 16 Jan 2024 21:15:35 +0000 (23:15 +0200)]
Adjust network code for changes in the mspnet library

21 months agoUse iterate_objects in Renderer::tick
Mikko Rasa [Sat, 13 Jan 2024 12:51:53 +0000 (14:51 +0200)]
Use iterate_objects in Renderer::tick

21 months agoCosmetic changes
Mikko Rasa [Sat, 13 Jan 2024 12:50:56 +0000 (14:50 +0200)]
Cosmetic changes

21 months agoCheck that clients only do calls on entities they possess
Mikko Rasa [Sat, 13 Jan 2024 12:30:05 +0000 (14:30 +0200)]
Check that clients only do calls on entities they possess

21 months agoMove an include to where it's actually needed
Mikko Rasa [Sat, 13 Jan 2024 12:10:40 +0000 (14:10 +0200)]
Move an include to where it's actually needed

21 months agoAdd some network state checks
Mikko Rasa [Sat, 13 Jan 2024 12:09:18 +0000 (14:09 +0200)]
Add some network state checks

21 months agoDon't filter by target players when sending from a client
Mikko Rasa [Sat, 13 Jan 2024 12:08:24 +0000 (14:08 +0200)]
Don't filter by target players when sending from a client