Author Topic: Flames tutorial  (Read 48770 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Flames tutorial
« Reply #45 on: October 02, 2011, 10:15:55 am »
May someone of you please write and upload the code for a program:
I can write [Pic1]->GDB1 or something like that at the beginning! (but always with "->GDB1")
The program should load the pic, show it on the screen and then, please everything there should burn
I mean, the black parts should please burn!
not a special point/line/object, which is always the same!!
It should react on the pic I store as GDB1 and make that burning!
Will that be possible?
*insert supercool signature*

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Flames tutorial
« Reply #46 on: October 02, 2011, 12:01:52 pm »
try redrawing the black parts every frame...
this should make the black parts stay there and flame.
also, remove the one Line command in the program

Offline p2

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 849
  • Rating: +51/-11
  • I'm back :)
    • View Profile
Re: Flames tutorial
« Reply #47 on: October 03, 2011, 07:27:38 am »
Could you please upload the complete code?
(I don't really understand how everything is working in the code)  :-\
*insert supercool signature*

Offline turiqwalrus

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 840
  • Rating: +51/-2
  • Wheeeeeee~!
    • View Profile
Re: Flames tutorial
« Reply #48 on: October 03, 2011, 08:07:32 am »
Code: [Select]
.Axe
ClrDraw
[FFFFFFFFFFFFFFFF]->Pic1  //This is the black object(sample)
[FEFDFBF7EFDFBF7F]->Str1  //Each Byte here has 7 bits set and 1 bit not set (like FE is 11111110 in binary)
                      //This is so that we can erase a random pixel, since Axe has no built in way to do that
Repeat getKey(15)    //until we press clear

Pt-On(35,35,Pic1)   //this is the black object that you want to draw... redraw every frame
For(F,L6,L6+767       //loop through all of the screen pixels except the last 12
{F} and {rand^8+Str1}->{F-12}   //take the byte, use AND to erase a single bit from it, and then store it into the byte directly *above* it
End                     //this makes it so that as the byte rises, each frame a pixel is erased from it

DispGraph

End
modified code on first page to fit your needs ;)
« Last Edit: October 03, 2011, 08:59:39 am by turiqwalrus »

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #49 on: January 18, 2012, 05:47:21 pm »
Awesome o.o This was short and simple and very easy to port to assembly o.o

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Flames tutorial
« Reply #50 on: January 18, 2012, 05:52:26 pm »
Thanks :D It's one of my simplest tutorials, but still by far one of the most popular, probably because of the high results/effort ratio XD

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #51 on: January 18, 2012, 06:02:54 pm »
Okay, here is a Grammer version, so this shows your tutorial here is easily ported to other languages :D

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Flames tutorial
« Reply #52 on: January 18, 2012, 06:06:30 pm »
Nice!  It seems to be using slightly different rules, as the fire isn't as prolific, how are you going about it?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #53 on: January 18, 2012, 06:07:43 pm »
I used an RNG that thepenguin77 offered. It appears to be much more evenly distributed...

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Flames tutorial
« Reply #54 on: January 18, 2012, 06:11:25 pm »
Do you do the flame masking in the same way?  In my code each pixel only has a 1/8 chance of death alive each frame

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #55 on: January 18, 2012, 06:16:25 pm »
Oh, oops, I accidentally forgot to mask the upper 5 bits of the random number I produced XD Now the fire isn't working nicely :( (I have about 3/8 of the columns all white)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Flames tutorial
« Reply #56 on: January 18, 2012, 08:23:37 pm »
Hmm could you post the source?  I'm no Grammer expert but I will take a look ^^

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #57 on: January 18, 2012, 08:42:21 pm »
Oh, jee, I finally figured it out. I accidentally some of my code when I went to fix the random number generator last time XD. Sorry about that, here is a better screenie :)

Also, the code to actually do the flames is written in assembly and I just use the AsmPrgm command, but the other parts were in Grammer.


EDIT: Source:
(beware, it is mostly hex)
Code: [Select]
.0:Return
ClrDraw
ㅠ8800[(0102040810204080
ㅠ86ED[(4C931140930103F4CD0888B612231310F70D20F4060CAF121310FCC9
ㅠ8808[(E5D52AFE87ED5F86230F86230FAE230F0F22FE87E60716885F1AD1E1C9
Repeat getKey(15
AsmPrgm21      ;normally don't ever do this >.>
DispGraph
End
Stop

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Flames tutorial
« Reply #58 on: January 18, 2012, 09:39:40 pm »
The very beginning is very interesting, as there are some patterns that emerge in the smoke.  Perhaps due to patterns in the RNG?

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Flames tutorial
« Reply #59 on: January 18, 2012, 09:57:00 pm »
yes, most of the RNGs that I have used or seen do have a pattern that you can see when you bring it to the graph screen. I like it on one level, but I don't like it when I need to use it for a game XD