Author Topic: Breakout clone  (Read 23155 times)

0 Members and 3 Guests are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Breakout clone
« Reply #60 on: November 11, 2010, 06:30:35 pm »
More:

Code: (Axe) [Select]
:0→F
:0→N
:0→V

can be optimized into

Code: (Axe) [Select]
:0→F→N→V
And any reason you're doing

Code: (Axe) [Select]
:C*3+C→E
? It's a lot more optimized with

Code: (Axe) [Select]
:C*4→E
Saves 7 bytes, in fact.
« Last Edit: November 11, 2010, 06:32:22 pm by Deep Thought »




Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #61 on: November 11, 2010, 06:32:11 pm »

Code: (Axe) [Select]
:0→F→N→V
Lol forgot about that one :P
And any reason you're doing

Code: (Axe) [Select]
:C*3+C→E
? It's a lot more optimized with

Code: (Axe) [Select]
:C*4→E
I don't think I'm using that anywhere, just
Code: [Select]
:C*3+L2->E
« Last Edit: November 11, 2010, 06:33:34 pm by lookitsan00b »
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Breakout clone
« Reply #62 on: November 11, 2010, 06:36:34 pm »
I don't think I'm using that anywhere, just
Code: [Select]
:C*3+L2->E

It's here:

Code: (Axe) [Select]
:      !If rand^5
:P+1→P*3+L4→E
:rand^4→{E-2}
:{A-1}+4→{E-1}
:{A}→{E}
:      End
:C*3+C→E

Also, take advantage of the last calculated value. In other words,

Code: (Axe) [Select]
:If {B}-{A}≥≥‾1 and (K≠1)
:1→{B-2}

can be optimized to

Code: (Axe) [Select]
:If {B}-{A}≥≥‾1 and (K≠1)
:→{B-2}

because the If  statement results in 1 if it's true, anyway.

(Also, the If  statement can be optimized again by doing {B}-{A}+1≥≥0 instead of {B}-{A}≥≥‾1.)
« Last Edit: November 11, 2010, 06:36:56 pm by Deep Thought »




Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #63 on: November 11, 2010, 06:43:24 pm »
Well I gotta do homework... so is somebody gonna do this for me or do I need the experience? :P
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Breakout clone
« Reply #64 on: November 11, 2010, 07:07:10 pm »
We observe the mentality of pushing you in the right direction and then letting you gain some experience yourself ;) Of course if you are totally lost or if we can give a few more pointers, we'll be happy :)

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #65 on: November 11, 2010, 07:56:12 pm »
I don't think I'm using that anywhere, just
Code: [Select]
:C*3+L2->E

It's here:

Code: (Axe) [Select]
:      !If rand^5
:P+1→P*3+L4→E
:rand^4→{E-2}
:{A-1}+4→{E-1}
:{A}→{E}
:      End
:C*3+C→E


I have no idea why that didn't cause problems... the second 'C' should've been 'L2'. I was using E as the second parameter for 'Copy('  ???

Ah well.  Back to work.  I guess I have enough to optimize my code sufficiently.

Also, will somebody look at my saving routine to make sure I'm doing that right?

EDIT: does Copy( work with Y1? It would make my load routine lots smaller.
« Last Edit: November 11, 2010, 11:10:22 pm by lookitsan00b »
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #66 on: November 11, 2010, 11:30:50 pm »
I really need some answers.

Is !If X-56 also an optimisation?

What if I have compound If statements? I know splitting them up saves speed, but what about space?

Which is smaller? ClearDrawr or StorePic? (my guess is StorePic, but only by up to 5 bytes)

Also: major improvements can be made if I can Copy(xx,Y1,yy) Is this possible? I'm afraid to test it :/

Lastly, should I be using DelVar in my save routine? I do have to overwrite the appvar every time I save...

Oh and one more, am I asking too many questions? ???

Spoiler For Spoiler:
We observe the mentality of pushing you in the right direction and then letting you gain some experience yourself ;) Of course if you are totally lost or if we can give a few more pointers, we'll be happy :)
No thanks. My program uses too many already :P
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Breakout clone
« Reply #67 on: November 11, 2010, 11:35:23 pm »
Also: major improvements can be made if I can Copy(xx,Y1,yy) Is this possible? I'm afraid to test it :/
You can not store directly to archive, so that's impossible. :-\

Oh and one more, am I asking too many questions? ???
Nah, it's cool.  The more questions you ask, the more everyone learns. ;D

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #68 on: November 11, 2010, 11:38:35 pm »
Also: major improvements can be made if I can Copy(xx,Y1,yy) Is this possible? I'm afraid to test it :/
You can not store directly to archive, so that's impossible. :-\

Oh and one more, am I asking too many questions? ???
Nah, it's cool.  The more questions you ask, the more everyone learns. ;D

Whoops. I meant Copy(Y1,xx,yy) :P
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Breakout clone
« Reply #69 on: November 11, 2010, 11:39:20 pm »
I believe doing it that way it possible, but I'm only 80% sure as I've never tried it. :)
« Last Edit: November 11, 2010, 11:39:33 pm by ztrumpet »

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #70 on: November 11, 2010, 11:46:04 pm »
I believe doing it that way it possible, but I'm only 80% sure as I've never tried it. :)
Ok then does Unarchive return a pointer? Don't want to throw in an unnecessary GetCalc routine... :/
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #71 on: November 12, 2010, 12:40:07 am »
Ok I did a bit of optimization and added a ball cap and two-var scores (now the max score is 655359999).

The file size is: 7914.

I'm having a minor 'Return'ing  problem with the level editor, though. Seems I messed up an somewhere :P
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Breakout clone
« Reply #72 on: November 12, 2010, 03:54:01 am »
Ok so when score reaches 10000 it increases the second variable? Sounds interesting. I wonder how do you display them? I think I tried such thing before and failed. File size seems pretty nice so far. Keep up the good work and I hope you can solve the issues you are having.

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Breakout clone
« Reply #73 on: November 12, 2010, 07:11:23 am »
We observe the mentality of pushing you in the right direction and then letting you gain some experience yourself ;) Of course if you are totally lost or if we can give a few more pointers, we'll be happy :)
No thanks. My program uses too many already :P

lol...and nice job on the 32bit numbers...I hate trying to code 32 bit numbers >.<

Offline lookitsan00b

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 173
  • Rating: +37/-3
    • View Profile
Re: Breakout clone
« Reply #74 on: November 12, 2010, 11:02:12 am »
Ok so when score reaches 10000 it increases the second variable? Sounds interesting. I wonder how do you display them? I think I tried such thing before and failed. File size seems pretty nice so far. Keep up the good work and I hope you can solve the issues you are having.
Well thats why it increases the second variable when it hits 10000 instead of 65535 or 60000.
Code: [Select]
:Output(4,0,S>Dec)
:If Q
:Output(0,0,Q>Dec)
:End

I fixed the minor problems and got major. It crashes or just takes far longer than it should when using block 10.

Code: [Select]
:.blocks
:{B-3}->U
:For(D,1,C)                                        //for each block
:D*3+L2->A                                         //get pointer to block info
: If Z+1                                           //every other frame...
:  irrelevant code here
: End
: If the ball hit block D
:  do stuff with the ball's velocity and the score
:  0->F->N->V
:  C->{L2}
:Lbl DX
:  If {A-2}=0 or ({A-2}=8) or ({A-2}=9)            //destruction routines for different blocks
:   ...
:  ElseIf {A-2}=10                                 //start of problem code
:   C*3+L2->D                                      //I need to keep track of the block's info
:   Exch(D-2,A-2,3)                                //so I use Exch
:   C-1->C                                         //to destroy the block
:   For(E,1,C)                                     //for each block
:    E*3+L2->A                                     //get block info
:    If the blocks are close enough
:     N+1->N+({L2}*3)+L2->F                        //pointer to open table space
:     E->{F}                                       //store a link
:    End
:   End                                             //the destruction routines can mess up my links
:   SortD({L2}*3+L2+1,N)                           //so I have to go in order.
:   For(D,1,N)                                     //for each table entry,
:    If {{L2}*3+D+L2}*3+L2-A                       //If it doesnt link to the same block as the last one
:     +A->A                                        //store the link in A
:     V+1->V                                       //tell the destruction routine we need to return
:     sub(DX)                                      //I know it all works at least to here
:    End
:   End
:   0->D                                           //no idea as to which blocks it has & hasn't hittested...
:   ->N                                            //list is empty
:  ElseIf {A-2}<=7
:   ...
:  End
:  If V                                            //If we need to return
:   V-1->V                                         //then we return
:   Return
:  End
: End
:End
« Last Edit: November 12, 2010, 11:05:07 am by lookitsan00b »
My TI-94+SE is broken.  I used some flawed existential conditioning on it, and it crashed. :(

Activity level:
{====______}

Spoiler For Securite:
{=========_}

A couple security flaws
Need a good backdoor short of reinstalling the OS
Completely immobilized and invalidated by Zstart. And rendered incompatible.
Spoiler For FFTATIA:
{====______}

framework: mostly done
graphics engine: undergoing complete rewrite
still need character and enemy sprites!!! :P