Experimental Physics & Better Audio Update
This release is a massive quality-of-life + capability jump: a brand-new Box2Dv3-powered physics module, a modernized audio backend (now SDL3_mixer), and a bunch of new drawing + tilemap conveniences.
Major Additions
Physics
- Added a new
physicssubmodule built on Box2D v3, centered around physics.World and physics.Body APIs. - Physics function include:
get_fixed_deltaandset_fixed_deltafor managing physics steppingadd_fixed_updateandfixed_callbackdecorator to register a function to be called per physics step.clear_fixed_updatesto deregister all currently registered function callbacks.
- Added body subtypes to match common gameplay needs:
RigidBodyfor simulating solid objects with mass, velocity, and forces.StaticBodyfor immovable objects that can still collide with other bodies.CharacterBodyfor simulating character-like movement with floor detection and snapping.
- Added joint support with an abstract Joint base and multiple joint subtypes and point/AABB queries and cast helpers:
DistanceJointfor maintaining a fixed distance between two bodies.FilterJointfor filtering collisions between two bodies.MotorJointfor applying a motor force to maintain a relative position between two bodies.PrismaticJointfor allowing relative movement along a specified axis between two bodies.RevoluteJointfor allowing relative rotation between two bodies.MouseJointfor dragging a body with the mouse cursor.WeldJointfor rigidly connecting two bodies together.WheelJointfor allowing relative rotation and translation along a specified axis between two bodies.
- Worlds have per-body collision filtering (collision_layer / collision_mask) and TileMap → physics helpers to form a static body out of a tile map's object group layer.
Collisionclass representing collision information between two physics bodies, obtained via theWorld.get_collisionsmethod.CastHitclass representing the result of a ray or shape cast in physics space.
Audio
- Introduced a new
mixersubmodule withAudioPriority(MUSIC, UI, SFX), priority-based track stealing, and global master volume control. mixer.Audiobase class with subtypes that replace the old API:Audio→mixer.Samplefor short sound bites to be played polyphonically.AudioStream→mixer.Streamfor long sound tracks, like music, with more playback control.
- Samples and streams must be loaded with the
mixer.load_sampleandmixer.load_streamfunctions.
Drawing & Geometry
- New shape drawing functions:
draw.ellipsesdraw.linesdraw.capsuleanddraw.capsulesdraw.bezier(3 and 4 point)draw.sector(with thickness parameter for arcs)draw.polyline
- New
Capsuleshape object for drawing and use with physics implementations. Polygon.is_concaveandis_convexmethods for checking shape convexity.Circleconstructor can now accept just a radius (position initializes at (0, 0))draw.rectanddraw.rectsfunctions now accept five new arguments for rounded corners (in order):border_radiusto set all corner radii uniformlyradius_top_leftto override top left radiusradius_top_rightto override top right radiusradius_bottom_rightto override bottom right radiusradius_bottom_leftto override bottom left radius
TileMap Conveniences
- Added helper APIs in the
tilemap.Mapclass:get_layer()layers→all_layerstile_layersobject_groupsimage_layers
Refactors & Improvements
Textconstruction now allows an optional initial string.Vec2now supports element-wise division with/and/=.- Fixed a bug that I believe to have emerged from the SDL2 → SDL3 backend upgrade where textures weren't rendering at all.
Removals & Breaking Changes
Textureconstructor size parameter are now two integers instead of aVec2.AnimationController.add_sheetsize parameter now takes two integers instead of aVec2.- Removed redundant
Spriteclass,CharacterBodyrecommended instead. - Audio stream class
rewindremoved in favor of just usingseek(0).
Full Changelog: v1.6.0...v1.6.1
Thank you for using PyKraken!