Skip to content
A-MC Creative Development

A-MC Creative Development

Programming, Music, Tech, Hardware, Amiga, Commodore, Retrogaming and probably much more :)

  • Home
  • SOFTWARE
    • Hollywood Source & Libraries
    • APPBuilder Tool
    • HFinder 2017
    • HGUI
    • GEMZ
    • White Dot
  • Allanon’s Music Corner
  • About Me
  • Hire Me!
  • Privacy Policy
  • Toggle search form

Particle Engine

Posted on November 19, 2022 By allanon No Comments on Particle Engine

INTRODUCTION

As promised here is a tutorial on how to build a Particle Engine, I will describe it in general terms so that anyone will be free to implement it in his preferred language, then we will implement it for Hollywood-MAL using the SDL plugin to speedup objects drawing and achieve high frame rates.

I’ve already implemented it in the upcoming game CryptoMages.
Source code will be available for all Patrons in a Patrons only post.

WHAT IS A PARTICLE ENGINE

A Particle Engine is an object that is used handle a so-called Particle System which is able to draw hundreds or thousands of small graphical objects (particles) concurrently to create various graphical effects like fire, explosions, water, smoke, bullets, sparks and so on.

Each particle has its very own life with some semi-random properties to make it different from all the other particles. Every particle has a death time and when a particle die a new one will be generated making the effect continuos.

A Particle Engine is the code that handle all the stuff related to one (or more) Particle System which is an object instance that is generated by the Particle Engine.
A Particle is the small graphical objects generated by the Particle System that, with the proper settings and along with all the other particles, shows a visual effect.

PARTICLE SYSTEM

As just said a Particle System is an object instance generated by the Particle Engine, in the Particle System we defines how it have to behave, how many particles it has to generate, at which speed, which textures it have to use, the particles speed, direction and so on.

We are going to analyze all the parameteres that defines a Particle System, at least in my own vision and my own implementation 🙂

THE EMITTER

Every Particle System has an Emitter which is the point from where all particles are generated. Since the Emitter is basically a point it has the x and y coordinates, but it also has the following properties :

  • Delay
    Since the Particle System is updated every rendering cycle, the Delay property specify how many cycles we have to skip to generate one or more particles.
    Set it to 0 to generate particles every rendering cycle, set it to 4 to generate particles every 4 cycles. If your screen refresh rate is 50 FPS every rendering cycle should be long 20 milliseconds, it means that every 20*4 milliseconds (80ms) a new particle(s) will be generated.
    The particle generation is called emission.
  • Quantity
    This property specify how many particles we have to create at each generation loop. Think about the previous property, where we have set Delay to 4: if we set Quantity to 5 means that every 4 cycles the Particle System will generate 5 particles in one go.
  • Count
    This variable is used to determine how many emissions we want to achieve, if we set this property to -1 means infinite emissions, if for example we set it to 10 the Particle System will be stopped once 10 emissions will been completed.
  • SpreadX
    This value determines the horizontal spread expressed in pixels. This can be very useful for effects like snow, rain, and so on…. To make it clear how it works here is an example :
    – Set the x coordinate to 100, this is emitter’s horizontal position
    – Set the SpreadX property to 10
    With the above settings, every time a particle is generated the particle’s horizontal coordinate will be between x-spreadX and x+spreadX => (100-10) and (100+10) => between 90 and 110.
  • SpreadY
    This is the same as SpreadX but applied to the vertical coordinate.

That’s all for now, next time we will see how we can add a basic gravity simulation for our particles and the particle’s properties that defines their behaviour.

Happy Coding!

Hollywood

Post navigation

Previous Post: What’s up? :)
Next Post: “Thank You!” thanktro source code

Related Posts

My plans Hollywood
Wow! April is almost over already! Hollywood
HGui Status Report Patreon I’m on Patreon! Hollywood
EmuLa 2.0 Tutorial : How to scan for ROMs and run them Hollywood
Dungeon Crawler RPG Engine Let’s build a Dungeon Crawler with Hollywood-MAL! (part 2) Hollywood
Resource Maker for Hollywood Hollywood

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Support me on Patreon!

My Patreon PageSupport me on Patreon!

Support with PayPal

Support me with a small donation!

Recent Posts

  • Demo time is approaching!
  • How “The Gate” looks like?
  • The Gate Development Diary
  • Sneak peek at some graphics!

Categories

Archives

Recent Comments

  • allanon on AmiCloud Beta 04 released! The DropBox alternative
  • Paul Issegalö on AmiCloud Beta 04 released! The DropBox alternative
  • allanon on AppBuilder v2.0 released

My Music Page on Facebook

My Music Page on Facebook

My Twitter

My Tweets

I’m on Spotify and Soundcloud!

My Spotify PageListen to my music!
My Soundcloud PageListen to my music!
Privacy & Cookies : This site use cookies. Please take a moment to review our privacy policy. Our Cookie and Privacy Policy

Follow me on Mastodon

Mastodon.Uno

Copyright © 2025 A-MC Creative Development.

Powered by PressBook Masonry Dark