What is Blood Engine?
Blood Engine is a versatile resource that can be utilized for various applications, including creating effects like paint, water, blood, and more. It offers numerous methods tailored to meet your specific needs.
One of its key features is the ability to emit “droplets” - these are meshes that can take on the appearance of “Decals” [ ] or “Spheres” [ ]. These droplets can be emitted from any given origin point with a given velocity. Upon landing on a surface, such as a wall or floor, they transform into a pool.
This entire process is highly customizable, with 24 options at your disposal to tweak and adjust according to your requirements. This ensures that Blood Engine can adapt to a wide range of scenarios and use-cases, providing you with the flexibility to create the exact effect you’re aiming for.
(a small note here; the overall quality of the videos is poor due to my laptop’s specs)
Usage
Initialization
Firstly, you’ll need to initialize BloodEngine with your preferred settings. This can be done in either a client or server script. However, it’s generally more advisable to do this on the client side, so we’ll proceed with that approach.
The settings provide you with control over various aspects of droplets and pools. These include the maximum number of droplets that can be created, the type of droplets to use, the velocity of droplets upon emission, and much more.
-- Import the BloodEngine module
local BloodEngine = require(PathToModule)
-- Initialize BloodEngine with desired settings
local Engine = BloodEngine.new({
Limit = 100, -- Sets the maximum number of droplets that can be created.
Type = "Default", -- Defines the droplet type. It can be either "Default" (Sphere) or "Decal",
RandomOffset = false, -- Determines whether a droplet should spawn at a random offset from a given position.
OffsetRange = {-20, 10}, -- Specifies the offset range for the position vectors.
DropletVelocity = {1, 2}, -- Controls the velocity of the emitted droplet.
DropletDelay = {0.05, 0.1}, -- Sets the delay between emitting droplets in a loop (for the EmitAmount method).
StartingSize = Vector3.new(0.01, 0.7, 0.01), -- Sets the initial size of the droplets upon landing.
Expansion = true, -- Determines whether a pool can expand when a droplet lands on it.
MaximumSize = 1, -- Sets the maximum size a pool can reach.
})
Emitting Droplets
After initializing the module, you’re all set to emit droplets. There are two key methods available for droplet emission: EmitAmount
and Emit
.
-- Emit a specific amount of droplets from a given origin in specific or nil direction
-- (Setting the Direction to nil will make droplets go in random directions)
Engine:EmitAmount(Origin, Direction, Amount)
-- Emit a single droplet from a given origin in a specific or nil direction
Engine:Emit(Origin, Direction)
In this instance, we’ll be utilizing the EmitAmount
method. Typically, you’d use the Emit
method when you want to create your own loop instead of relying on the built-in loop of EmitAmount
. This gives you more control over the emission process.
Example
Now that we’ve covered all the necessary steps, it’s time to see the results in action. The following video provides a showcase of what we have done.
And that’s all there is to it! It’s really that simple to use this module. Feel free to explore all the different settings to customize it to your needs.
Changelog
Version 0.X.X
# 0.0.1
↳ General Changes
- Official Release
# 0.0.2
↳ General Changes
- Bouncing is now removed due to its instability.
- You can now make drips go in random directions more efficiently.
- Added the ability to make blood drips ignore certain descendants of parts efficiently.
# 0.0.3
↳ General Changes
- Revamped how settings work/get applied.
- Added an option to make pools expandable if collided by droplets.
- Added the option to change the default size of a pool.
# 0.0.4
↳ General Changes
- Improved drip raycast accuracy.
- Added
DecayDelay
, manages the decay time for each pool.- Pools can now get on walls and attach/get welded to parts.
- Support for decals/images for pools. Includes PBR Materials.
# 0.0.5
↳ General Changes
- A showcase has been included on the GitHub Repository.
- An efficient method,
UpdateSettings
, has been added for changing settings.- Resolved an issue that prevented the proper removal of excess droplets.
# 0.0.6
↳ General Changes
• Accurate Raycasting: Implemented accurate raycasting using FastCast for improved precision.
• Splash Effects: Introduced splash/impact effects to enhance visuals, includes the
SplashAmount
option, which manages how many particles to emit.• Ignore Players: Added the ability for the droplets to ignore players with the
IgnorePlayers
option, prevents any interaction between them.• Removal of Features: Temporarily removed the
PoolExpansion
feature. It is planned to be reintroduced in a future update following a rewrite to clean things up.
↳ Other Notes
The system’s feature set has grown unexpectedly, leading to cluttered and sorta hard-to-read code. A module rewrite is planned, including a complete rewrite of this post.
Version 1.X.X
# 1.0.0
↳ General Changes
• Comprehensive Rewrite: The module has undergone a complete rewrite, enhancing its readability and ease of modification. This overhaul also improves the organization of the code, making it easier to locate specific elements.
• Pool Expansion: Reintroducing the Pool Expansion feature, now enhanced with effects and new options such as:
Expansion
: A toggle switch for this feature.Distance
: Defines the distance (in studs) within which a droplet should check for nearby pools.ExpanseDivider
: Controls the rate of pool size increase. Higher values result in a slower increase.MaximumSize
: Sets the maximum size a pool can reach.• Ignore Players: The
IgnorePlayers
option has been permanently removed. However, a guide on how to make droplets ignore players will be released in the future.• Splashing: Expanded the options for the splashing feature, providing more customization possibilities:
SplashName
: The name of the attachment that releases particles on surface contact.SplashByVelocity
: If true, sets the number of particles based on the velocity of the droplet.VelocityDivider
: Controls the extent to which velocity can influence the splash amount. Higher values will lessen the effect.• Additional Options: Added and revamped several options to provide you with more control over the appearance of the droplets, pools and effects, as well as the functionality of the module:
FolderName
: Specifies the name of the folder containing the droplets.Type
: Defines the droplet type. It can be either “Default” (Sphere) or “Decal”.DefaultTransparency
: Specifies the default transparency range of a pool.Trail
: Controls the visibility of the trail during droplet emission.StartingSize
: Sets the initial size of the droplets upon landing.ScaleDown
: Determines whether the pool should scale down when decaying.Tweens
: Contains all the tweens used by the module:Decay
,Land
andExpand
↳ Other Notes
With this major release, both the Github Repository’s page and this post have been thoroughly revised and rewritten.
# 1.0.1
↳ General Changes
• Bugfixes: The Pool Expansion feature had this bug where it would unexpectedly expand beyond its limit. This occurred due to a droplet interacting with a pool mid-expansion, which expands it twice as much.
# 1.0.2
↳ General Changes
• Different Settings Upon Emission: You can now apply different settings to the droplets using EmitAmount or Emit instead of manually changing it.
# 1.0.3
↳ General Changes
• Small Fixes: There weren’t really any changes to the code, this update is more focused on assets. A certain decal was removed due it bugging out, and I made some changes to the properties of the droplets for a certain upcoming bugfix.
# 1.1.0
↳ General Changes
• Improvements to Emission: You can now emit mixed droplets (decal & default) without making a new emitter instance!
• Droplet Color: There’s a newDropletColor
setting to change the color of your droplets/pools.
↳ Other Notes
While this was a minor update, what you can do with it is anything but.
Here’s a showcase to show what you can do with this new release:
You can now do a mix of Droplets and Decals. And without creating multiple emitter instances that might eat out your performance.Here’s the code behind it:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local BloodEngine = require(ReplicatedStorage.BloodEngine) local Engine = BloodEngine.new({ Limit = 500, }) local EMIT_AMOUNT = 50 local EMIT_DELAY = 5 local function Emit() -- A random chance of the droplet being a decal local IsDecal = math.random(0, 1) == 1 -- Emits a droplet in a random direction relative to a part, and there's a chance that it could be a decal. Engine:Emit(script.Parent, nil, { Type = IsDecal and "Decal" or "Default", DefaultSize = IsDecal and { 1, 1.4 } or { 0.4, 0.7 } }) end -- A custom iteration of the EmitAmount method while true do for Index = 1, EMIT_AMOUNT, 1 do local DropletDelay = math.random(0.05, 0.1) Emit() task.wait(DropletDelay) end task.wait(EMIT_DELAY) end
# 1.1.1
↳ General Changes
• Fixes: Fixed an issue where if no Data/Settings table was provided, the module would error. This is in reference to this issue: Blood Engine - A droplet emitter system - #224 by Necro_las
# 1.1.2
↳ General Changes
• A new Destroy method: Added a
Destroy
method, that I admit should have been there in the beginning. This is for developers who especially useStarterCharacterScripts
. (Reference to issue: Blood Engine - A droplet emitter system - #233 by Lukeskyroblox1)
# 1.1.3
↳ General Changes
• A new size setting: Added a new setting:
YSize
, which controls the range of the y size of the pool, giving you the ability to make it flat or thick. (Reference to suggestion: Blood Engine - A droplet emitter system - #239 by RIP_Bombs)
Misc
If you have any feedback or encounter any issues, please feel free to leave a reply below this post. In-depth guides for specific scenarios will be available soon on the Github Repository’s wiki. Stay tuned.