kaaengine / kaa Goto Github PK
View Code? Open in Web Editor NEWKAA - Pythonic game engine for humans.
Home Page: https://kaa.readthedocs.io/
License: MIT License
KAA - Pythonic game engine for humans.
Home Page: https://kaa.readthedocs.io/
License: MIT License
Expected: text disappears
Actual: nothing happens
Expected: query_point should return the node Y
Actual: query_point does not return the node Y
Attaching an example here: query_point.zip
Steps to replicate:
Expected - Child node is returned by query_point
Actual - it is not returned!!
Kaaengine build v. 0.11+75.gbc2555f
Add Text node and on keyboard text event we try to update text node's text. When we do that, engine crashes with
Traceback (most recent call last):
File "/home/pawel/Dev/gates-of-valhalla/demos/text_typing/main.py", line 34, in <module>
engine.run(MyScene())
File "engine.pxi", line 100, in kaa._kaa._Engine.run
kaa._kaa.KaacoreError: /host/kaacore/src/draw_unit.cpp:212 !(draw_unit_it != this->draw_units.end()) - Target draw unit not found, end of draw units vector reached.
Code to replicate the issue:
import logging
from logging import DEBUG
from kaa.fonts import TextNode
from kaa.geometry import Vector
from kaa.engine import Engine
from scenes.base import SceneBase
logging.basicConfig(level=DEBUG, format="%(levelname)s | %(asctime)s | %(module)s:%(lineno)d | %(message)s")
class MyScene(SceneBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.text_node = TextNode(font_size=40, text="", position=Vector(200, 200))
self.root.add_child(self.text_node)
def update(self, dt):
for event in self.input.events():
if event.keyboard_text:
self.text_node.text = event.keyboard_text.text
if __name__ == "__main__":
with Engine(virtual_resolution=Vector(1800, 900)) as engine:
engine.window.size = Vector(1800, 900)
engine.window.fullscreen = False
engine.window.title = "Text typing"
engine.window.center()
engine.run(MyScene())
When adding a node to scene I should have ability to set a lifetime of this node, after that time elapsed the node should autodelete and be removed from scene.
Also it would be super useful if I had a way to know that deletion is happening (so I can react and do something extra)
Very useful for scenarios like:
Trying to create a TextNode without passing font param results in engine crashing with no info.
Pls add some validation message
Expose active querying for chipmunk collisions to python layer.
Function should accept a shape (segment, circle, polygon etc.) and return a list of tuples (colliding_node, colliding_hitboxes) where colliding node should be actual node instance that colides and hitboxes should be hitboxes (can be more than one) belonging to that node which collided.
engine.virtual_resolution is always required when starting the whole show.
window.size is not
Currently the default value for window.size is unknown. Looks like hardcoded something but it doesn't make sense. It should initialize with a value identical to engine.virtual_resolution until changed programatically.
Steps to replicate:
Expected: node is not get returned (as it is outside view's render area)
Actual: node is returned
Suggestion: add a flag to all spatial query methods to allow to explicitly query for nodes outside of the view's render area. But by default that flag should be disabled - queries should return only the nodes in the render area of the view.
Ocurred on windows 10 which suffered from audio device malfunction - apparently no drivers for the sound card or other issue resulting in an issue with no audio device present in the system.
The crash ocurred when trying to load music (calling Music() constructor)
Stack trace of the error:
Traceback (most recent call last):
File "main.py", line 74, in
File "controllers\assets_controller.py", line 20, in init
File "audio.pxi", line 30, in kaa._kaa.Music.init
kaa._kaa.KaacoreError: ......\kaacore\src\audio.cpp:140 !(raw_music != nullptr)
When creating an bject such as Font, Sprite, etc. outside engine context engine crashes silently with no error message. Please add a validation and a meaningful error message.
Instantiating new objects, especially assets happens just once and does not affect game performance so it deserves a proper validations.
query_shape_overlaps function needs the same hitbox filtering set of params like hitboxes have
I mean: group, mask and collision_mask
They would represent the property of colliding shape (passed as parameter).
The logic would be identical like with colliding hitboxes.
The default values would also be identical like with hitboxes.
My brain is bleeding every time I call query_shape_overlaps(), knowing that it's trying to match passed shape with every hitbox on the scene! It's killing da performance of my game! Plus it's returning results I'm not even interested in!
There should be a way of finding out that a music track ended, so I can play another track.
Suggested API:
Add MouseManager.cursor property. Make it read/write.
Default value is None. None value works like now - shows system cursor.
MouseManager.cursor accepts a Node instance. When setting it to a Node, system cursor is hidden, replaced with image shown by the node. origin_alignment of the node should set the active 'pixel' of the node (the pixel whose position is 'click' position). It should be possible for this node to have transitions, animations and other normal features of a Node.
That would help for demos and simple apps that don't have graphical backogrund.
Expose SDL's universal pad input to python.
Engine needs ability to query for HitboxNodes intersecting a Segment instance.
Currently it's not possible to efficiently calculate if there is a clean line of fire for a unit in a top-down shooting game.
Need more input features from mouse:
Try to add BodyNode directly under scene root node. The whle game crashes without any message whatsoever. Please add some check and human-readable message.
Suppose I have a short sfx file which is designed to be played in a loop - it is a sound of footsteps.
As player moves the character around the screen I want that footsteps sound to be played in a loop. When player stops moving (which can be in the middle of the loop) I want the sfx to stop playing immediately.
Please add support for this use case.
Please add camera transitions, to autoamte stuff like camera going to position (x, y) or camera zooming in / out, or camera rotating or a combination of any of the three.
I need to know to which scene a node belongs.
Expected: whitespace rendered i.e. node not visible
Actual: engine crashing with
error File "fonts.pxi", line 65, in kaa._kaa.TextNode.text.set
kaa._kaa.KaacoreError: D:\a\1\s\kaacore\src\shapes.cpp:27 !(classify_polygon(this->bounding_points) == PolygonType::convex_ccw) - Invalid shape - expected convex counterclockwise polygon.
Need ability to transform node programatically, not just node shape
We need a way to access node's absolute values for all transformations such as position, rotation or scale.
If node is a child (any levels of depth in the tree) those methods should return absolute values of given transformation.
I want to be able to get a list of nodes under position (x, y).
A classical scenario is someone clicks a mouse and we want to know node(s) that he clicked. There can be many overlapping nodes in that (x, y) so it'd be nice to get a sorted list.
If any of the colliding body nodes got deleted, don't call the collision handler function.
It leads to error "node already marked for deletion" when node.delete() is being called from within the collision handler and the deleted node collided with two other nodes in the same frame.
Node.absolute_rotation and Node.absolute_rotation_degrees don't return correct values, many times the value returned is math.pi or 180 instead of an actual value.
This is super big topic.
Currently kaa's tree-like node structure creates an illusion that any given node in the structure can interact physically. However it is not possible, a Hitbox must be directly under BodyNode and must be directly under Space node.
In other words, visual representation of the scene in kaa is a tree-like structure while physical representation of the scene must be a flat list of BodyNodes assigned to Space.
This leads to a problem when we want physical structure to be a chain of connected objects.
The solution to this problem is to create a flat list of BodyNodes connected with chipmunk joints. This is more understandable for programmers.
Kaa users will need to understand that kaa's node tree is applicable only for visual purpose, i.e. when nodes somewhere deep down in the tree won't need hitboxes. If a node deep down the tree structure needs a HitboxNode, it means you should not have used a tree at all! You should have built this object as a series of peer BodyNodes connected with joints.
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.