Post Reply 
Xmas Spirit?
12-26-2023, 07:39 AM (This post was last modified: 12-26-2023 07:58 AM by komame.)
Post: #7
RE: Xmas Spirit?
(12-25-2023 03:13 PM)matalog Wrote:  That's brilliant.
Thanks

(12-25-2023 03:13 PM)matalog Wrote:  I wasn't worrying about performance in my program, as you saw, I was even slowing it down with WAIT()
I also use a slowdown, but I do it using a timer (ticks), which gives better results than WAIT, because WAIT does not take into account the drawing time, which can vary in individual frames of animation, causing them to appear at different intervals. By using a timer, you ensure that regardless of the drawing time, the next frame will always start at the same time after the previous one, and thus you also don't need to worry about the hardware speed on which the program is run. For instance, on the real Prime and on the emulator, it will operate at exactly the same speed, which is impossible with WAIT (this is especially noticeable when the calculation time is quite long and the emulator performs them much faster than the real Prime).
In the case of this program, the variable T is responsible for the time after which the next frame should appear, and it is currently set to 80ms, and with each frame, it is increased by another 80ms (T:=T+80). This guarantees the same smoothness of the animation, of course, provided that the computation time is not longer than the time allocated for a single frame.

(12-25-2023 03:13 PM)matalog Wrote:  [...] Your fire now looks so real [...]
Yes, but unfortunately, the resolution is still very low. 18x15 pixels is a comically small size. It would be ideal to generate a fire effect that covers the entire fireplace in a 1:1 pixel ratio. To achieve this, an image would need to be generated over an area of 70x60 pixels, which means that there are 4200 pixels to calculate (which is over 15 times more than so far). With such poor performance of PPL, this is unrealistic.

At the moment, I've made a few more optimizations (attached) that have saved a few additional milliseconds, but that doesn't change much in this sea of needs. I'll try to rewrite it in Python over the weekend, and perhaps then it will be possible to at least reach a size of 36x30, which should significantly improve the quality.

(12-25-2023 03:13 PM)matalog Wrote:  What do you call the technique you are using to simulate the fire, or if it is something you created from your own imagination, how would you describe it in words?
Well, I don't know what to call it, but it's a very simple algorithm. It's certainly safe to say that it works similarly to a cellular automaton (like Conway's Game of Life). Iterating over each pixel for the new frame, the algorithm calculates an average from the neighboring pixels of the previous frame with a slight attenuation, which causes the brightness of the fire to smoothly diminish as it propagates upward.


Attached File(s)
.zip  XMAS.zip (Size: 1.67 KB / Downloads: 18)

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Xmas Spirit? - matalog - 12-22-2023, 09:26 PM
RE: Xmas Spirit? - DéFCoM - 12-23-2023, 06:37 AM
RE: Xmas Spirit? - komame - 12-24-2023, 03:38 PM
RE: Xmas Spirit? - matalog - 12-24-2023, 10:28 PM
RE: Xmas Spirit? - komame - 12-25-2023, 07:51 AM
RE: Xmas Spirit? - matalog - 12-25-2023, 03:13 PM
RE: Xmas Spirit? - komame - 12-26-2023 07:39 AM
RE: Xmas Spirit? (fire effect) - komame - 12-30-2023, 04:04 PM
RE: Xmas Spirit? - komame - 12-31-2023, 10:59 AM
RE: Xmas Spirit? - tjurij - 01-02-2024, 05:46 AM
RE: Xmas Spirit? - komame - 01-02-2024, 06:39 AM
RE: Xmas Spirit? - StephenG1CMZ - 01-03-2024, 12:16 AM



User(s) browsing this thread: 1 Guest(s)