Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Hayleia

Pages: 1 ... 47 48 [49] 50 51 ... 239
721
TI Z80 / Re: Flappy Bird by Josiah W
« on: February 21, 2014, 11:20:24 am »
I don't know if that optimizes speed either, but if you use this, don't use the optimizations I added because this
If E<<0
->F-1->E
End

will not do the same with a E.32768.

722
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 21, 2014, 11:17:28 am »
I know it's useless but since I didn't know where that bug came from, I added that just in case. And it didn't solve anything.
Anyway, I gave up with interrupts and will only resume using them if someone solves the problem, so those unnecessary pushes/pops are nowhere (they are in comments).

723
TI Z80 / Re: Pokemon Topaze (Axe)
« on: February 21, 2014, 01:29:13 am »
They wouldn't have the same stats because level 100 Pokemons wouldn't exist ;)
I meant I'd block Pokemons to a level that doesn't cause problems, not that I'd block their health.
And I always code on computer, except in some rare cases. That allows me to have infinite backups (not really but you see what I mean) and to indent my code without that 16 chars large screen.

724
TI Z80 / Re: Pokemon Topaze (Axe)
« on: February 21, 2014, 01:25:35 am »
Yeah, but that means changing everything in my code to add those offsets, and this is easier to just add a "If" statement or two and limit leveling up :P

725
TI Z80 / Re: Pokemon Topaze (Axe)
« on: February 21, 2014, 01:19:48 am »
The problem is not Pokemon levels, but Pokemon health, which is indeed stored in one-byte values. I suppose I have to add a limit so no one gets over the problematic level. I should also make a savegame editor for the ones who encoutered problems. I'll do that this evening in the train (if I don't fell asleep).
Thanks for reporting :)

726
TI Z80 / Re: Flappy Bird by Josiah W
« on: February 21, 2014, 01:07:11 am »
Some optimizations I might have seen in your code ("might" because maybe they don't work, try at your own risks :P).

You did that: 0->Y->E->P
But for some reason, you didn't do that, just below: 1->F->Q
Moreover, +1 is more optimized than 1 (if hl=0 obviously) so you can do 0->Y->E->P+1->F->Q.

rand^35+1->R
35->S
rand^35+1->T
69->U
rand^35+1->V

You can routinize the rand^35+1->V, and maybe you can do 35->S*2-1->U to avoid loading 69, but I am not sure it saves that much space. Must save one byte at most -.-

~1->X
For(12)
Pt-On(X,43,Pic2)^^r
X+8->X
End

can be written as
~9->X
For(12)
Pt-On(X+8->X,43,Pic2)^^r
End

(where ~ is the little minus sign)

Repeat getKey(15)
<whatever>
End

is less optimized as
While 1
<whatever>
EndIf getKey(15)

if you don't mind <whatever> to be executed at least once.

If E<<0
0->E
1->F
End

can be written as
If E<<0
->F-1->E
End


!If F
E-38->E
If E<<0
->F-1->E
End
Else
E+25->E
End

is better as
!If F
If E<<0
->F-1->E
End
~38->E
Else
25
End
+E->E


A=B?? is less optimized than A-B?.

If B=9
0->F
500->E
End

is better as
!If B-9
0->F
500->E
End

and is even better as
!If B-9
->F
500->E
End


rand^35+1->R was said previously, but you still can routinize rand^35+1 ;)

Rect(83,0,10,R
Rect(83,R+24,10,39

IIRC, you have a 84+ or a 84+SE, so you can waste two bytes and close those parentheses to avoid triggering unnecessary Axe bugs :P
Matref usef to have only a regular 83+, so he used to did everything to save space, but that's not your case (and by the way, if this is the reason why he lost points in source code in the Omnimaga contest, this is stupid because his code was ten times more optimized than TipOver's. TipOver for example included that part
T++
If T=256
0->T
End

which can be optimized as
T++
If =256
0->T
End

then
T++
!If -256
0->T
End

then
T++
!If -256
->T
End

and if you think 4 seconds about 256, you even realize that this fits in 3 bytes with {°T}++).

Pic0+X is less optimized than X+Pic0. Always put constants at the end of an expression (if you can, obviously).

Text(0,0,P>Dec is better as Text(0,,P>Dec) (same for Text(0,0,"Score: ",P>Dec). And instead of calculating P at the previous line, you can include it in the Text command. I feel like P+(Q=15??(S=15??U=15))->P is optimizable but I have school in one hour :P

That's all for now :P
Once again, I advise you to backup your code and try those optimizations one after the other and try them separately in case I coined "opts" that don't work :P
And of course, those are only "basic" opts, I didn't try to figure out what the whole code did to find an algorithm that does the same in a faster/smaller way.

727
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 20, 2014, 02:17:21 pm »
Well Rainbow Dash Attack had less flickering (not less blur) but for some reason, I don't manage to apply the exact same method with interrupts to that game (that's the problem mentionned on the previous page) ???

728
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 20, 2014, 02:07:04 pm »
Thanks :)
On calc not only you have blur, but you also have diagonal lines due to greyscale not being refreshed in a smart way -.-

729
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 20, 2014, 01:21:50 pm »
+1d! ;D
Thanks, but did you try before +1ing ? :P
It's blurry as hell. I really need to get interrupts back, but I don't know how to fix the problem mentionned in the previous page.

Also, the number at the bottom is your score.

730
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 20, 2014, 01:19:06 pm »
Sorry for quadruple posting, but there was an update each time. And this time, I am even releasing the game.
So enjoy if you like it, hate if you don't. Compiled for Ion.
Note that I got rid of interrupts in that version, I just put the DispGraphrr in the loop.

Use up to flap, clear to quit, 2nd to pause, +/- to change contrast (set back to normal when you quit).

731
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 20, 2014, 03:30:01 am »
I just noticed on the screenshot that there was an unwanted white outline around "pipes" so I removed it here, but that still doesn't answer my interrupt question, so if anyone has a clue, please share. The code is in spoiler too.

Spoiler For Spoiler:
.AFLAPPY
L2+00->°BirdY
L2+10->°BirdV
L2+02->°GreyMode
.the second argument to fnInt()
L2+04->°GreyTimer
L2+06->°GreyTimerMax
L2+12->°Key4

[]->°BirdSprites
[1C72F6301BFC7C00].dark grey and black
[0000040C03000000].light grey and black
[1C7EFEFFFFFF7C00].mask (white, both grey and black)

.-------------
Lbl Code
LnReg
."frees" L2
Fix 5
ExprOn

FnOff

1->GreyMode
{+°Delays}->GreyTimerMax->GreyTimer
0->BirdV->X

Calibrate()
FnOff

FillEdge()
16*256->BirdY
Copy(°BG1,L6)
Copy(°BG2,L3)
TurnGreyOn()

While 1
 X++Select(,Select(,-96??->X) and 7??FillEdge()) and 31
 !If
  rand and 15+1Asm(45).->b
  L1-1Asm(EB).->de
  L1+64
  .->hl
  Asm(AF).->a
  .PipeBody
  Asm(F5237EE681F67677EB237EE681F66E77EBF13C10EB)
  Asm(0604)
  .PipeHead (with b=4)
  Asm(2336EFEB2336DFEB3C10F5)
  .PipeTop
  Asm(2336FFEB2336FFEB)
  .Add24
  Asm(011800)
  Asm(09EB09EB)
  .PipeTopAgain
  Asm(2336FFEB2336FFEB)
  Asm(C60E).add a,14
  .PipeHeadAgain
  Asm(0604)
  Asm(2336EFEB2336DFEB3C10F5)
  Asm(F5)
  .PipeBodyAgain (with push af first)
  Asm(237EE681F67677EB237EE681F66E77EBF13CF5EE3820E9)
  Asm(F1)
 End
 L1+63-5Asm(EB)L6+767-60Shift()
 L1+127-5Asm(EB)L3+767-60Shift()
 Key4 xor (getKey(4)->Key4) and Key4?~220,BirdV+(<<256*2*2*2*2)
 .->BirdV<<256??256,BirdV
 .maybe use max() here
 ->BirdV*2+BirdY->BirdY
 .DispGraph^^r^^r
EndIf getKey(15)

Lbl RET
LnReg
ClrHome
Return

Lbl FillEdge
L1-1->r1
L1+64-1->r2
X/8Select(,+°BG1-12->r3)+°BG2-12->r4
For(64)
 {r3+12->r3}->{r1+1->r1}
 {r4+12->r4}->{r2+1->r2}
End
Return

Lbl Shift
Asm(0640C5EBCB16EB1B060CCB162B10FBC110F0)
Return

Lbl EraseBird
BirdY/256+(*2)*2*2Select(,+L6+1-12->A)+L3+1-12->B
L1+128->C
For(7)
 {C++}->{A+12->A}
 {C++}->{B+12->B}
End
Return

Lbl DrawBird
BirdY/256+(*2)*2*2Select(,+L6+1-12->A)+L3+1-12->B
L1+128->C
For(7)
 {A+12->A}->{C++}
 {B+12->B}->{C++}
End
Pt-Change(8,BirdY/256,°BirdSprites+16)^^r
.now the area used by the bird is white
Pt-On(8,BirdY/256,°BirdSprites)
Pt-On(8,BirdY/256,°BirdSprites+8)^^r
Return

Lbl TurnGreyOn
fnInt(GreyOn,GreyMode*2)
Return

Lbl GreyOn
Asm(F5C5D5E5)
.push everything
.!If GreyTimer+1^GreyTimerMax->GreyTimer
!If GreyTimer--
 GreyTimerMax->GreyTimer
 sub(DrawBird)
 DispGraph^^r^^r
 sub(EraseBird)
End
Asm(E1D1C1F1)
.pop everything
Return

[]->°Nums
[FFE7D3D3D3C3E7FF]
[FFE7C7C7E7E7E7FF]
[FFE7D3F3E7CFC3FF]
[FFC3B9E3E3B9C3FF]

[0A040302]->°Delays
Lbl Calibrate
Fill(L6,6,255)
Fill(+1,6,0)
L3-1
For(2)
 Fill(+1,3,255)
 Fill(+1,3,0)
End
Copy(L6,+12,768-12)
Copy(L3,+12,768-12)
FnOff
Pt-Off(0,,GreyMode*8+°Nums)
TurnGreyOn()
While 1
 If getKey(3)-getKey(2)
  {+GreyMode^4->GreyMode+°Delays}->GreyTimerMax
  ->GreyTimer
  WLP()
  FnOff
  Pt-Off(0,,GreyMode*8+°Nums)
  TurnGreyOn()
 End
EndIf getKey(54)
Return

Lbl WLP
While 1
 Pause 20
End!If getKey(0)
Return

[]->°BG1
.take the hex code from the previous spoiler, I removed it because it caused a scroll bar to appear
[]->°BG2
.same here

I also attached a gif so you see what I am talking about. When I choose 0, the game plays fast, but when I choose 3 it is slower. I don't even understand why the slow down is this way. I would have understood 0 to be slower than 3 because it decreases GreyTimer more often (even though it DispGraphes as often), but it's 3 who is slower.

732
Humour and Jokes / Re: Weird/funny pictures thread
« on: February 20, 2014, 02:22:24 am »
Quote
it probably has a button to instantly make a black hole

Pretty sure one of our talented z80 wizards can pull that off. Regularly.

Pretty sure thepenguin77 would then be able to have zStart "Run on black holes".

733
TI Z80 / Re: Flappy Bird
« on: February 20, 2014, 02:19:48 am »
What is this coded in?
That's also what I was wondering, because it doesn't look like Basic (no flickering at all) but it doesn't seem that fast for Axe. Mine's speed is actually annoying due to blur.


But nice job on the game overall, you got some basics like gravity and such :)

734
Other Calculators / Re: Iron Pants - ClrDraw
« on: February 20, 2014, 02:13:12 am »
Np, but as I said, don't put them all at the same time but try them one after the other, and keep a backup of your old source, because there are chances some of my "optimizations" don't work. And that's not because I said "I'm not sure" to some of them that I am sure for the other ones :P

735
TI Z80 / Re: Flappy Bird - Hayleia
« on: February 19, 2014, 06:15:52 pm »
Ok, here's the full source code for now, in spoiler. Use at your own risks.
Spoiler For Spoiler:
.AFLAPPY
L2+00->°BirdY
L2+10->°BirdV
L2+02->°GreyMode
.the second argument to fnInt()
L2+04->°GreyTimer
L2+06->°GreyTimerMax
L2+12->°Key4

[]->°BirdSprites
[1C72F6301BFC7C00].dark grey and black
[0000040C03000000].light grey and black
[1C7EFEFFFFFF7C00].mask (white, both grey and black)

.-------------
Lbl Code
LnReg
."frees" L2
Fix 5
ExprOn

FnOff

1->GreyMode
{+°Delays}->GreyTimerMax->GreyTimer
0->BirdV->X

Calibrate()
FnOff

FillEdge()
16*256->BirdY
Copy(°BG1,L6)
Copy(°BG2,L3)
TurnGreyOn()

While 1
 X++Select(,Select(,-96??->X) and 7??FillEdge()) and 31
 !If
  ->r3
  rand and 15+1Asm(45)
  .->b
  L1-1Asm(EB)
  .->de
  L1+64
  .->hl
  Asm(AF)
  .->a
  Asm(233676EB23366EEB3C10F5)
  Asm(0604)
  Asm(2336EFEB2336DFEB3C10F5)
  Asm(2336FFEB2336FFEB)
  Asm(011800)
  Asm(09EB09EB)
  .PipeTopAgain
  Asm(2336FFEB2336FFEB)
  Asm(C60E).add a,14
  .PipeHeadAgain
  Asm(0604)
  Asm(2336EFEB2336DFEB3C10F5)
  .PipeBodyAgain
  Asm(F5)
  Asm(F1233676EB23366EEB3CF5EE3820F1)
  Asm(F1)
 End
 L1+63-5Asm(EB)L6+767-60Shift()
 L1+127-5Asm(EB)L3+767-60Shift()
 Key4 xor (getKey(4)->Key4) and Key4?~220,BirdV+(<<256*2*2*2*2)
 .->BirdV<<256??256,BirdV
 .maybe use max() here
 ->BirdV*2+BirdY->BirdY
 .DispGraph^^r^^r
EndIf getKey(15)

Lbl RET
LnReg
ClrHome
Return

Lbl FillEdge
L1-1->r1
L1+64-1->r2
X/8Select(,+°BG1-12->r3)+°BG2-12->r4
For(64)
 {r3+12->r3}->{r1+1->r1}
 {r4+12->r4}->{r2+1->r2}
End
Return

Lbl Shift
Asm(0640C5EBCB16EB1B060CCB162B10FBC110F0)
Return

Lbl EraseBird
BirdY/256+(*2)*2*2Select(,+L6+1-12->A)+L3+1-12->B
L1+128->C
For(7)
 {C++}->{A+12->A}
 {C++}->{B+12->B}
End
Return

Lbl DrawBird
BirdY/256+(*2)*2*2Select(,+L6+1-12->A)+L3+1-12->B
L1+128->C
For(7)
 {A+12->A}->{C++}
 {B+12->B}->{C++}
End
Pt-Change(8,BirdY/256,°BirdSprites+16)^^r
.now the area used by the bird is white
Pt-On(8,BirdY/256,°BirdSprites)
Pt-On(8,BirdY/256,°BirdSprites+8)^^r
Return

Lbl TurnGreyOn
fnInt(GreyOn,GreyMode*2)
Return

Lbl GreyOn
Asm(F5C5D5E5)
.push everything
.!If GreyTimer+1^GreyTimerMax->GreyTimer
!If GreyTimer--
 GreyTimerMax->GreyTimer
 sub(DrawBird)
 DispGraph^^r^^r
 sub(EraseBird)
End
Asm(E1D1C1F1)
.pop everything
Return

[]->°Nums
[FFE7D3D3D3C3E7FF]
[FFE7C7C7E7E7E7FF]
[FFE7D3F3E7CFC3FF]
[FFC3B9E3E3B9C3FF]

[0A040302]->°Delays
Lbl Calibrate
Fill(L6,6,255)
Fill(+1,6,0)
L3-1
For(2)
 Fill(+1,3,255)
 Fill(+1,3,0)
End
Copy(L6,+12,768-12)
Copy(L3,+12,768-12)
FnOff
Pt-Off(0,,GreyMode*8+°Nums)
TurnGreyOn()
While 1
 If getKey(3)-getKey(2)
  {+GreyMode^4->GreyMode+°Delays}->GreyTimerMax
  ->GreyTimer
  WLP()
  FnOff
  Pt-Off(0,,GreyMode*8+°Nums)
  TurnGreyOn()
 End
EndIf getKey(54)
Return

Lbl WLP
While 1
 Pause 20
End!If getKey(0)
Return

[]->°BG1
[0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000F80000000000000000000003FE0000000000000000000007FF000000E00000000400000FFF803C03F80000003F80000FFF80FF0FFE0000F0FFE0001FFFF9FFDFFF000FFCFFFF81FFFFFFFFFFFF003FFFFFFFE3FFFFFFFFFFFFF07FFFFFFFF7FFFFFFFFFFFFF8FFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000000000000000000000000000000]
[]->°BG2
[FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC07FFFFFFFF81FFFFFFFFFFF803FFFE1FFE007FFFFFFFFFF001FFF807FC003FC07FFF7FE000FFE003FC003F003FFF3E0000FE2001F8001F001FF0100000780000F8001E000FC0000000600000F00000000F80000000600000000000000780000000000000000000000700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF492492492492492492492492924924924924924924924924000000000000000000000000000000000000000000000000]
Can someone explain me why setting GreyMode at 0 plays faster than setting GreyMode at 3 ? Because that sets GreyTimerMax lower, but the frequency of the interrupt is also lower so nothing should happen more often.

edit and don't tell me "Draw and Erase are very very unoptimized, you are making the same calculation several times", I know, but I planned to change everything in the drawing routine anyway so I didn't look this part very often. And r3 in the main loop is useless, you can remove it.
Same for the "LnReg FnOff FnOff" at the beginning, the initialization when testing is always the first thing subject to changes.

Pages: 1 ... 47 48 [49] 50 51 ... 239