samdze / godot-native-bullets-plugin Goto Github PK
View Code? Open in Web Editor NEWEfficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more.
License: MIT License
Efficiently spawn and move high amounts of objects like bullets for bullet hells, particles and more.
License: MIT License
Wow... This is super nice, great job!
I just started moving my projects over to 4 and was wondering if you had any plans in the near future to add a v4 branch for this?
Assigning a BulletKit without a collision_shape
to a BulletsEnvironment and playing the scene crashes the game, even if the BulletKit has collisions disabled.
The fix is ready but it will take a while for me to update the repository.
Temporary workaround: assign a collision shape to BulletKits even if they should have collisions disabled.
Check collisions_enabled
, assign a collision shape and uncheck it.
Can we have an Android version too?
The way to set up the bullet kits seems to have changed, current docs confused me a little while setting it up.
I've made some changes locally but I'm not sure how to create a pull request.
# "target_node": self,
"transform": Transform2D(bullet_rotation, spawner.global_position \
+ bullet_velocity * recover_seconds \
+ bullet_velocity.normalized() * bullets_spawn_distance),
"velocity": bullet_velocity,
"health":health
}
```
returns null during get property
On macos, when calling obtain_bullet
from C# using Godot.Object.Call()
, the bullet is successfully created and shows up on screen, but the BulletID
is marshalled as a System.Int32[] of value (-1, 0, 0).
While I'm not getting errors in subsequent calls to the API using a (-1, 0, 0) BulletID (e.g. set_bullet_property
, which is a bit confusing), these calls have no effect.
Being new to both Godot and the plugin, it looks like the only two avenues to remedy to this would be:
Or maybe I missed something.
I'm building the plugin on my Windows machine.
My compilation Pipeline uses VIsual Studio 2022 (rather, its build tools) and scons 4.7.
I have several errors where private members of Bullet
are being referenced.
Many of those instances can be "fixed" by making those members as protected
rather than private
. In some cases I'm having to invoke the corresponding getters/setter. (I've actually added a method to increase the value of lifetime
directly.
Does that make sense? I'll draft a PR once I'm done and I have something that builds and looks to perhaps work right.
Hi, I would like to use this plugin (I guess it's not a module) and I failed. And I'm using linux.
First, it try to just download the file and launch the project.godot
that include an example, hit [F5]
and nothing appear.
Then, I try to compile the plugin myself but you didn't explain what is needed for that, or reference the official documentation for that.
Trying to compile the plugin give me include error like Physics2DServer.hpp: No such file or directory
.
I also discover from the source code of godot that this file is now renamed to PhysicsServer2D.hpp
.
I tried with the official gdnative example and it's working but it don't include files from the source of godot.
So, what is the require steps to be able to make your plugin?
Lets say we had a test bullet hell in pure gdscript and also another test using your plugin and both exported to HTML5 for the web. How much more powerful would the C++ plugin be compared to just using gdscript? It would help me to know how much more critical performance using C++ number crunching compared to just using regular gdscript.
In file included from src\register_types.cpp:3:
src\kits/basic_bullet_kit.h: In member function 'virtual void BasicBulletsPool::_enable_bullet(Bullet*)':
src\kits/basic_bullet_kit.h:46:25: error: 'float Bullet::lifetime' is private within this context
46 | bullet->lifetime = 0.0f;
| ^~~~~~~~
In file included from src\bullet_kit.h:14,
from src\native_bullets.h:15,
from src\register_types.cpp:2:
src\bullet.h:27:15: note: declared private here
27 | float lifetime;
| ^~~~~~~~
src\kits/basic_bullet_kit.h:51:88: error: 'godot::RID Bullet::item_rid' is private within this context
51 | RenderingServer::get_singleton()->canvas_item_add_texture_rect(bullet->item_rid,
| ^~~~~~~~
src\bullet.h:22:13: note: declared private here
22 | RID item_rid;
| ^~~~~~~~
src\kits/basic_bullet_kit.h: In member function 'virtual bool BasicBulletsPool::_process_bullet(Bullet*, float)':
src\kits/basic_bullet_kit.h:59:25: error: 'godot::Transform2D Bullet::transform' is private within this context
59 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/basic_bullet_kit.h:59:54: error: 'godot::Transform2D Bullet::transform' is private within this context
59 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/basic_bullet_kit.h:59:87: error: 'godot::Vector2 Bullet::velocity' is private within this context
59 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/basic_bullet_kit.h:61:51: error: 'godot::Transform2D Bullet::transform' is private within this context
61 | if(!active_rect.has_point(bullet->transform.get_origin())) {
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/basic_bullet_kit.h:67:33: error: 'godot::Transform2D Bullet::transform' is private within this context
67 | bullet->transform.set_rotation(bullet->velocity.angle());
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/basic_bullet_kit.h:67:64: error: 'godot::Vector2 Bullet::velocity' is private within this context
67 | bullet->transform.set_rotation(bullet->velocity.angle());
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/basic_bullet_kit.h:70:25: error: 'float Bullet::lifetime' is private within this context
70 | bullet->lifetime += delta;
| ^~~~~~~~
src\bullet.h:27:15: note: declared private here
27 | float lifetime;
| ^~~~~~~~
In file included from src\register_types.cpp:4:
src\kits/dynamic_bullet_kit.h: In member function 'godot::Transform2D DynamicBullet::get_transform()':
src\kits/dynamic_bullet_kit.h:21:46: error: 'godot::Transform2D Bullet::transform' is private within this context
21 | Transform2D get_transform() { return transform; }
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h: In member function 'void DynamicBullet::set_transform(godot::Transform2D)':
src\kits/dynamic_bullet_kit.h:24:23: error: 'godot::Transform2D Bullet::transform' is private within this context
24 | this->transform = transform;
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h: In member function 'godot::Vector2 DynamicBullet::get_velocity()':
src\kits/dynamic_bullet_kit.h:32:41: error: 'godot::Vector2 Bullet::velocity' is private within this context
32 | Vector2 get_velocity() { return velocity; }
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h: In member function 'void DynamicBullet::set_velocity(godot::Vector2)':
src\kits/dynamic_bullet_kit.h:35:23: error: 'godot::Vector2 Bullet::velocity' is private within this context
35 | this->velocity = velocity;
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h: In member function 'virtual void DynamicBulletsPool::_enable_bullet(DynamicBullet*)':
src\kits/dynamic_bullet_kit.h:133:25: error: 'float Bullet::lifetime' is private within this context
133 | bullet->lifetime = 0.0f;
| ^~~~~~~~
src\bullet.h:27:15: note: declared private here
27 | float lifetime;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:138:88: error: 'godot::RID Bullet::item_rid' is private within this context
138 | RenderingServer::get_singleton()->canvas_item_add_texture_rect(bullet->item_rid,
| ^~~~~~~~
src\bullet.h:22:13: note: declared private here
22 | RID item_rid;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h: In member function 'virtual bool DynamicBulletsPool::_process_bullet(DynamicBullet*, float)':
src\kits/dynamic_bullet_kit.h:146:51: error: 'float Bullet::lifetime' is private within this context
146 | float adjusted_lifetime = bullet->lifetime / kit->lifetime_curves_span;
| ^~~~~~~~
src\bullet.h:27:15: note: declared private here
27 | float lifetime;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:153:33: error: 'godot::Vector2 Bullet::velocity' is private within this context
153 | bullet->velocity = bullet->velocity.normalized() * bullet->starting_speed * speed_multiplier;
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:153:52: error: 'godot::Vector2 Bullet::velocity' is private within this context
153 | bullet->velocity = bullet->velocity.normalized() * bullet->starting_speed * speed_multiplier;
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:159:33: error: 'godot::Vector2 Bullet::velocity' is private within this context
159 | bullet->velocity = bullet->velocity.rotated(absolute_rotation - bullet->transform.get_rotation());
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:159:52: error: 'godot::Vector2 Bullet::velocity' is private within this context
159 | bullet->velocity = bullet->velocity.rotated(absolute_rotation - bullet->transform.get_rotation());
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:159:97: error: 'godot::Transform2D Bullet::transform' is private within this context
159 | bullet->velocity = bullet->velocity.rotated(absolute_rotation - bullet->transform.get_rotation());
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h:162:25: error: 'godot::Transform2D Bullet::transform' is private within this context
162 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h:162:54: error: 'godot::Transform2D Bullet::transform' is private within this context
162 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h:162:87: error: 'godot::Vector2 Bullet::velocity' is private within this context
162 | bullet->transform.set_origin(bullet->transform.get_origin() + bullet->velocity * delta);
| ^~~~~~~~
src\bullet.h:26:17: note: declared private here
26 | Vector2 velocity;
| ^~~~~~~~
src\kits/dynamic_bullet_kit.h:164:51: error: 'godot::Transform2D Bullet::transform' is private within this context
164 | if(!active_rect.has_point(bullet->transform.get_origin())) {
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
| ^~~~~~~~~
src\kits/dynamic_bullet_kit.h:170:33: error: 'godot::Transform2D Bullet::transform' is private within this context
170 | bullet->transform.set_rotation(bullet->velocity.angle());
| ^~~~~~~~~
src\bullet.h:25:21: note: declared private here
25 | Transform2D transform;
....
src\bullets_pool.inl: In instantiation of 'void AbstractBulletsPool<Kit, BulletType>::_release_bullet(int32_t) [with Kit = BasicBulletKit; BulletType = Bullet; int32_t = int]':
src\bullets_pool.inl:184:5: required from 'int32_t AbstractBulletsPool<Kit, BulletType>::_process(float) [with Kit = BasicBulletKit; BulletType = Bullet; int32_t = int]'
src\bullets_pool.inl:159:9: required from here
src\bullets_pool.inl:269:96: error: 'int32_t Bullet::shape_index' is private within this context
269 | PhysicsServer2D::get_singleton()->area_set_shape_disabled(shared_area, bullet->shape_index, true);
| ~~~~~~~~^~~~~~~~~~~
src\bullet.h:24:17: note: declared private here
24 | int32_t shape_index = -1;
| ^~~~~~~~~~~
src\bullets_pool.inl:272:17: error: 'int32_t Bullet::cycle' is private within this context
272 | bullet->cycle += 1;
| ~~~~~~~~^~~~~
src\bullet.h:23:17: note: declared private here
23 | int32_t cycle = 0;
| ^~~~~
src\bullets_pool.inl:274:41: error: 'int32_t Bullet::shape_index' is private within this context
274 | _swap(shapes_to_indices[bullet->shape_index - starting_shape_index], shapes_to_indices[bullets[available_bullets]->shape_index - starting_shape_index]);
| ~~~~~~~~^~~~~~~~~~~
src\bullet.h:24:17: note: declared private here
24 | int32_t shape_index = -1;
| ^~~~~~~~~~~
src\bullets_pool.inl:274:124: error: 'int32_t Bullet::shape_index' is private within this context
274 | _swap(shapes_to_indices[bullet->shape_index - starting_shape_index], shapes_to_indices[bullets[available_bullets]->shape_index - starting_shape_index]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
src\bullet.h:24:17: note: declared private here
24 | int32_t shape_index = -1;
| ^~~~~~~~~~~
=====
scons: *** [src\register_types.o] Error 1
I think I'll end up replacing a lot of my particle systems with this... one bullet question though: this seems to all be area2d and not kinematic right?
I made a Bullet scene, made it an autoload, attached bullets.gdns and added the bullet kit resource as shown:
At this point trying to load the main scene (which is empty) causes the preview to crash without logging an error. If I don't add the resource, the scene loads. basic_bullet_kit.tres looks like this in the inspector:
I'm using the godot icon.png as a test bullet if it matters.
I wasn't able to find a Bullets node when searching the Create New Node dialog.
I suspect this is not intended? Sorry if I am wrong.
Steps to reproduce:
-Create new bulletkit per readme instructions
-Assign bulletkit the animated_texture.gdshader resource instead of a new material
-Use bulletkit in a BulletsEnvironment
-Play Scene: will CTD when launched with no debug info or errors
I'm sure the crash is to be expected, but some kind of error output would be good. Better yet, limiting the selection options to shader materials only in the Material script variable for Bulletkit resources would prevent this entirely.
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.