Sup y'all. Been working on a lot of Touhou stuff, but never bothered to post them here:
This information is OUTDATED. It will be updated soon. Please wait warmly!DanmakU Alpha v0.6.0DanmakU is an open source, generalized, high performance, and lightweight development kit and library for 2D danmaku games in Unity based on Danmakufu.
I thought that Danmakufu was a bit restrictive in some of it's uses, and since it's not completely open source, I couldn't make changes to parts that were irking me, so I made my own danmaku dev kit.
Features:
- Has access to all other Unity features: deploy to multiple platforms, GPU acceleration, etc.
- Interacts well with all 2D Unity objects.
- Written in Momo C#, entirely object oriented.
- Very high performance - was able to get 20,000 bullets moving and rendering at near 60fps on my desktop.
- Lightweight - 20,000 bullets added only 30-50MB of allocated RAM. Runs decent on mobile devices.
- Open source: anyone is open to edit the code, push changes as they wish.
Planned Features (in order by priority):
- More documentation and video tutorials
- Lasers (yeah, haven't implemented them yet.)
- More Extension packages to make other parts of Danmaku game dev easier
Currently in an alpha state. There are a number of large bugs that I need to squash. If you find any bugs, don't post them here, list them under the github issue tracker: found
here.
This project is open source under the MIT license. It used to be GPL, but now you don't need to open source your works using it, so it can be used easily, even in commercial applications, if you are so inclined.
At it's core DanmakU is a simple package that allows for creating and manipulating large numbers of similar objects that need to
rendered, moved, and have collision checks made. The traditional Unity way of creating a GameObject and adding functionality via attached scripts/components carries far too much overhead since they were more intended for general purpose systems. DanmakU provides an interface for quickly and efficiently creating and controlling hundreds of generic objects. These objects, while less dynamic than traditional GameObjects, are very lightweight, yet still contains support for rendering, bullet collision, and basic physics. These generic objects, for lack of a better name, are simply referred to as
Danmaku, Since there is no specific function other than to work as generic manipulable objects, they can be used for a variety of purposes: be it bullets, item pickups, special effects, etc.
Each Danmaku has several parts:
- Sprite - This is the sprite used to display the Danmaku object.*
- Color - the vertex color of the bullet. This allows a single grayscale sprite to create a variety
- Material - this is used to affect exactly how the bullets of a certain type are rendered. Contains shader information.*
- Position - a 2D Vector position in absolute world coordinates of where the Danmaku object currently is.
- Rotation - a floating point value to describe which way the bullet is currently facing. Measured in degrees.
- Scale - allows the bullet to be scaled to different sizes.
- Speed - linear speed. The number of units traveled in the direction the object is currently facing over the period of one second. **
- Angular Speed - The number of degrees the object will rotate in one second. Setting this to positive = turn to the right, negative = to the left. **
- Collider Information - different collider types can be applied to each bullet, and used to handle collision detection.
* - shared information, changing this value will change it for all bullets of that type.
** - One "game second" which can vary depending on a number of settings.
DanmakU's core package is purely focused providing a usable code interface for spawning, controlling, and handling collisions with these Danmaku objects. There are several key components:
Danmaku Prefabs
This is the way to create bullet/object types in DanmakU. This part requires zero coding, but will be required to spawn any bullets/objects, instead these prefabs are easily made in the Unity Editor. They are your standard Unity Prefabs, but have a renderer and the Danmaku Prefab script attached. From here it is easy to manipulate how the object looks and behaves. The way the object looks in the scene view is exactly as how they will look when spawned using DanmakU functions. Tweaking the renderer functions will act exactly as one would normally expect.
On the actual Danmaku Prefab script, the dev can tweak several options:
- Danmaku System Prefab - the underlying Shuriken Particle System used to spawn bullets created from this prefab. For the most part, the default value provided works just fine and doesn't need to be changed.
- Collision Type, Collider Size, Collider Offset - Information pertaining to how collisions are handled. The collider for the bullet can be seen drawn in a green line in the scene view. In the above example, it is the green circle superimposed on top of the sprite.
- Fixed Angle - when moving objects spawned from this prefab, will they rotate visually? Can be useful for item drops or other similar object types.
- Extra Controllers - additional Danmaku Controllers (see below) that affect the behavior of the objects spawned by the prefab
If the scale is adjusted on the prefab's Transform, the resultant spawned objects will also inherit the same scale changes.
Lastly, make sure to save this object as a prefab in the project, not a object in the scene. I only made these GameObjects and not ScriptableObjects because it is easier to visualize in both the scene view and in the project view. Danmaku Prefabs are for data use only!
Danmaku ControllersDanmaku Controllers are a parametric, compositable, and high performance way of expanding bullet functionality. Each Danmaku can have multiple controllers, and each Danmaku Controller can control multiple Danmaku objects. To apply the behavior associated with a controller to Danmaku object(s), use the AddController functions, to remove them, use the RemoveController. Alternatively one can create a concrete class that implement the IDanmakuController interface which ensures compatibilty with Danmaku Controller functionality.
Examples of Danmaku Controllers:
- Acceleration Controller - Speeds up or slows down objects affected by it by a specified acceleration value.
- Speed Limit Controller - limits the speed of objects affected by it. Preventing them from moving faster or slower than a specified limit
- Color Change Controller - changes the color of the objects affected by it. Some examples of use include creating bullets that undergo a gradient color change
- Homing Controller - forces the object to always face and move toward a specified GameObject
- Speed Curve Controller - changes the speed of the object based on an Animation Curve. Allows for fairly complex control over the movement affected objects.
More information can be found on the Github repo/wiki, found
here.
For Danmakufu Users:Example Images:

Public video tutorials will come as soon as the beta is ready for public release.
TouhouBots Just a bunch of bots for the Touhou subreddits on Reddit. Does random things around there.
Github link[/list]