Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Xeda112358 on October 04, 2011, 05:00:34 pm

Title: BASIC Particles
Post by: Xeda112358 on October 04, 2011, 05:00:34 pm
Recently, I got a request to add particle effects to Grammer and I was originally going to just avoid this, thinking it would be too complex. However, the idea started bugging me and so I thought back to a post by Builderboy. So during class, naturally, I started trying to code a water-like particle effect... and it works! The only issue is that it can only do a few cycles a second once it has to handle 100 particles, so this is where I am:

I am going to work on an assembly particle engine that BASIC users can use. I plan to add this to Grammer, too, but for now, I want to make it for BASIC users. For the first version, I plan to use non-user RAM (saveSScreen in this case) to store particle data and it will handle up to a few hundred particles. There will be a command to add or remove particles as well as a command to run a cycle (or multiple cycles?) I also want to add the ability to save particle states, eventually, too.

So what do y'all think? I will try to come up with some working code before I have to go to work (so in the next 45 minutes 3:-) )
Title: Re: BASIC Particles
Post by: LincolnB on October 04, 2011, 05:12:12 pm
Cool! Sounds awesome.
Title: Re: BASIC Particles
Post by: Xeda112358 on October 04, 2011, 05:44:35 pm
Blegh, so I am not going to finish in time, but I have these commands finished:

Clearing all particles
The water particle engine

What I need to add:
A command to add particles
A command to delete particles

These should be doable in under 10 minutes, so these will be attended to after I get out of work in about 4 hours :D
Title: Re: BASIC Particles
Post by: LincolnB on October 04, 2011, 06:22:11 pm
Hey, are you using cellular automata for your water engine, like in my water simulation? (thanks to BuilderBoy)
Title: Re: BASIC Particles
Post by: boot2490 on October 04, 2011, 07:23:46 pm
Hey sorry my idea "bugged you", I actually thought it was a stupidly hard suggestion *after* I posted it. But it is awesome to see you actually doing it! I wouldn't (after I thought about it) have thought it would be plausible to make a usable dynamic particle system for the Z80.
Title: Re: BASIC Particles
Post by: Xeda112358 on October 05, 2011, 01:17:44 am
Okay, that took a bit longer than expected, but here is version 1 :)
It has a few commands:
0 or {0 will "freeze" existing particles and no longer interact with them
1 or {1 will execute a cycle (computes the location of all the particles
{2,Y,X will add a new particle at pixel position (Y,X)
99 or {99 will display the graph buffer

So an example of how to use this is:
Code: [Select]
0:Asm(prgmPARTICLE     ;Clears all particles
{2,1,3:Asm(prgmPARTICLE  ;Adds a particle at (1,3)
For(A,0,99
{1,99:Asm(prgmPARTICLE    ;Cycles through the particles, then display the graph buffer
End

For those familiar with my libraries, you can chain commands together in a list :)
Another note is that this will handle up to 383 particles (And it handles this without a problem).

So here is an example and a screeny as well as the program :)

EDIT: I can't wait 'till I add this to Grammer :devil:
Title: Re: BASIC Particles
Post by: Yeong on October 05, 2011, 07:04:05 am
O.O
So there's a chance that grammer will only go to math/science programming D:
Title: Re: BASIC Particles
Post by: Xeda112358 on October 05, 2011, 07:23:51 am
O.O
So there's a chance that grammer will only go to math/science programming D:
No, but this is a neat graphics effect :D You could add this, say, to the tip of a volcano or something :)
Title: Re: BASIC Particles
Post by: DJ Omnimaga on October 05, 2011, 02:57:38 pm
Wow that looks cool Xeda!