Xmas Spirit?
|
12-25-2023, 07:51 AM
(This post was last modified: 12-25-2023 10:08 AM by komame.)
Post: #5
|
|||
|
|||
RE: Xmas Spirit?
(12-24-2023 10:28 PM)matalog Wrote: Wow, that's a nice fire :-). Thanks :-) (12-24-2023 10:28 PM)matalog Wrote: Did you experiment with making the fire pixels smaller, does it affect the overall speed of the program too much? Yes, I experimented with increased resolution, but I encountered performance issues even on the G2 (not to mention the G1, where it was a disaster). Later, I noticed an error in your program that significantly affected performance, and after correcting it, I managed to more than double the number of pixels for the fire effect (exactly 240%) while maintaining the same FPS. Your mistake was that in the loop where you draw "baubs", you were also drawing the fireplace, so it was being drawn as many times as there were "baubs". It was a considerable waste of time in each frame of the animation. After correcting this, I achieved better performance in generating the fire. Not only did I increase the resolution, but I also improved the realism of the fire. Unfortunately, on the G1, I was unable to achieve much better effects, and it is necessary to stick with a resolution of 12x10 to keep the animation smooth. The program after my revisions is below (for G2), but before you paste it into Connectivity Kit, please read the "EDIT" comment at the bottom of the post. Code: CONST width=18, height=15; It looks quite nice, doesn't it? I think that the performance can still be slightly improved because currently in your code, the function ARC_P (which is rather slow) is called 32 times in each iteration and it could be replaced with BLIT_P by referring to the buffered images that were drawn during the program initialization. This should provide an additional 15-20% gain in performance. Unfortunately, the biggest problem is that in calculations on matrices and lists, where you have to iterate over elements, PPL is very weak, and even such a small matrix as 12x10 calculated several times per second eats up all the power of this device. For such tasks, even much slower devices perform much better. This is a very annoying flaw of PPL. In Python, it looks much better. I can try to rewrite this fire effect-generating function in Python and call it from PPL. Then it will be possible to achieve an even better effect. EDIT: When you paste this program into Connectivity Kit, there's a strange issue because Prime reports a syntax error on line 87: RECT_P(G1,200,80,290,160,RGB(RANDINT(200,255),RANDINT(0,200),RANDINT(0,20))); You can see that after pasting, an additional space (blank character) appears before the last parenthesis on the Prime. This is probably a copy-paste bug in Connectivity Kit. To get the program to compile, you need to remove that space directly on the Prime. I've pasted this program many times into this post, but this error always occurs after copying it into Connectivity Kit, so remember to delete that blank character. Best wishes, Piotr |
|||
« Next Oldest | Next Newest »
|
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)