Author Topic: Axe Q&A  (Read 592127 times)

0 Members and 1 Guest are viewing this topic.

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: Axe Q&A
« Reply #1095 on: November 27, 2011, 06:24:35 pm »
How do I put parts of a code as an appvar?
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline jacobly

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 205
  • Rating: +161/-1
    • View Profile
Re: Axe Q&A
« Reply #1096 on: November 27, 2011, 06:43:42 pm »
I'm pretty sure it's like that, just have the second line of hex under/part of the first one.

...
Ok, I was optimizing last night and wrote down a bunch of Q's as I went.

Do the ?/?? conditionals save space in the executable in relation to conventional If loops?  How about speed?

Can they be nested?  like B?(A++5?-1→A),→A works, nvm that

Which is faster: If (commonly true) / If (sparsely true) ?

So it's optimized to put the constants at the end...what if it's like L2+2?  Would a different order influence anything?

1. ? and ?? are just convenience notation, so they are probably the same as If statements.
2. The speed of an If statement depends on what conditionals you use. However, for If / Else statements, the Else is generally faster due to one fewer jump. This is why I generally put the commonly true branch in the else part.
3. L₂+2 and 2+L₂ both optimize to 35388 :)

Offline parserp

  • Hero Extraordinaire
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1455
  • Rating: +88/-7
  • The King Has Returned
    • View Profile
Re: Axe Q&A
« Reply #1097 on: November 27, 2011, 06:47:38 pm »
How do I put parts of a code as an appvar?
lol I was just about to ask that, I need it for some optimizations :D
does anyone have an answer?

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Axe Q&A
« Reply #1098 on: November 27, 2011, 07:01:56 pm »
If you mean something like external levels, you could create a new appvar then copy to it.
Say you have the stuff to be stored to the appvar in L1:
"appvNAME"→Str1
GetCalc(Str1,768)→P
Copy(L1,P,768)

and now you have an external appvar that has the contents of whatever was in L1 :)
Vy'o'us pleorsdti thl'e gjaemue

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #1099 on: November 27, 2011, 07:12:02 pm »
How do I put parts of a code as an appvar?
Do you mean "run" code in an appv?

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1100 on: November 27, 2011, 07:12:11 pm »
How do I put parts of a code as an appvar?

This is extremely difficult to get working, because of the way assembly works.  Assembly code only works at a specific location, if it is moved to anywhere else in memory, it will cause horrible crashes.  The issue with running code in an appvar, is that you need to copy that code to $959D, which is where your current program is!  It becomes a bit easier if your current program is an appvar, but even then it requires custom asm and Bcall knowledge.  I am not an expert on getting it to work, so I can't provide the details.  So the most I can say is try to fit all your code in 1 program, and use a program like Fullrene or Crabcake to surpass the execution limits. 

Offline saintrunner

  • Custom Spriter: You ask it! I'll Make it!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1787
  • Rating: +115/-11
  • Flogging Molly
    • View Profile
    • Jonny K Music
Re: Axe Q&A
« Reply #1101 on: November 27, 2011, 07:17:40 pm »
ok so what I meant was, How do I save a level in one of my games as an appvar, and how do I get it into my games main program later? In Axe?

but I figured it out
« Last Edit: November 27, 2011, 07:17:50 pm by saintrunner »
My Sprites Thread   :Updated often :) for your viewing pleasure

GAMES:

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1102 on: November 27, 2011, 09:05:47 pm »
Problem that's had me stuck for a few days:

I honestly cant find what's wrong with it D:

The beginning part that works.
Spoiler For Spoiler:
Code: (beginning) [Select]
:.AAHOOK
:DiagnosticOff
:[1028103854382828]➔Pic1
:[102A123C50B82828]
:[FFFFFFFFFFFFFFFF]➔Pic2
:1➔R−1➔H➔Q➔B➔P
:256➔X
:12288➔Y
:Fix 5
:Repeat getKey(15)
:ClrDraw
:If X∕256<<1
:256➔X
:End
:If X∕256>88
:22528➔X
:End
:If (H=0) or (H=1)
:If getKey(3)
:X+256➔X
:1➔R
:End
:If getKey(2)
:X−256➔X
:0➔R
:End
:End
:If H>40
:If getKey(2)
:0➔R
:End
:If getKey(3)
:1➔R
:End
:End
:For(A,0,11)
:Pt-On(A∗8,1,Pic2
:Pt-On(A∗8,56,Pic2)
:End
Where it starts to not work
Code: [Select]
:If (getKey(54))∗((H=0)+(H>40))∗(B=0) ;works
:If Y∕256=48 ;works
:1➔H
:Else
:2➔H
:End
:End
:If H=1 ;works
:Y−256➔Y
:If Y∕256=26
:2➔H
:End
:End
:If H=2
:X∕256➔S
:Y∕256➔T
:R➔θ
:Repeat pxl-Test(S,T) ;all this works
:T++
:If θ
:S++
:Else
:S−−
:End
:End
:If H>1
:If H≤40
:1➔P ;works
:Line(X∕256+7,Y∕256,S,T) ;this flashes on, but just once, so doesn't work much
:Else
:0➔P
:End
:If H<15
:Y+256➔Y ;doesnt work
:If θ
:X+256➔X ;but this does (1 time)
:Else
:X−256➔X
:End
:H++ ;i think this only works once.
:If Y∕256=48
:0➔H➔P➔S➔T
:10➔B
:End
:End
I cant tell if this part works or not.
Spoiler For Spoiler:
Code: [Select]
:If H≥15 and (H≤25)
:If H<21
:Y+(256−((H−15)∗25))➔Y
:Else
:Y−((H−15)∗25)➔Y
:End
:H++
:End
:If H≥25 and (H≤40)
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:Y−256➔Y
:If Y∕256<9
:56➔H
:0➔P
:End
:H++
:End
:!If H≤40
:If H≤50
:H++
:If θ
:X+(384−(H−40)∗10)➔X
:Else
:X−(384+(H−40)∗10)➔X
:End
:If Y∕256<9
:56➔H
:0➔P
:End
:Y−−
:ElseIf (H≥50)∗(H≤60)
:H++
:If H<56
:Y+(256−((H−50)∗25))➔Y
:Else
:Y−((H−50)∗25)➔Y
:End
:End
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:End
:If H>55
:If Y∕256<48
:Y+256➔Y
:If θ
:X+256➔X
:Else
:X−256➔X
:End
:Else
:0➔H➔S➔T
:End
:End
:End
:End
Code: [Select]
Then just
:Pt-On(X∕256,Y∕256,P∗8+Pic1)
:If B
:B−−
:End
:DispGraph
:End
(which works)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Axe Q&A
« Reply #1103 on: November 27, 2011, 09:09:05 pm »
It would help a lot if you told us what wasn't working.  Throwing a whole bunch of code into a post and asking us what is wrong is not going to help much D:

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1104 on: November 27, 2011, 09:14:29 pm »
Good idea :P

In the middle section, the guy jumps into the air and freezes. I believe that H gets stuck at 3 even though I have an H++.
At the line,
:1➔P ;works
:Line(X∕256+7,Y∕256,S,T) ;but this only flashes on for 1 frame!

The guy is supposed to move, here
By the time it gets here, H is succesfuly at 2, so it works
(If H>1 is also here)

:If H<15
:Y+256➔Y ;doesnt work
:If θ
:X+256➔X ;but this does, but only 1 time for some reason
:Else
:X−256➔X
:End
:H++ ;This H++ only works once, to get H to 3. Its supposed to take it up to 15, though.
:If Y∕256=48 ;This is if the guy hits the ground early, but not really important right now.
:0➔H➔P➔S➔T
:10➔B
:End
:End

Afterwards, there is

:If H≥15 and (H≤25)

But I obviously cant get that to work since H gets stuck at 3 :/
I don't know if there is something preventing it from changing
« Last Edit: November 27, 2011, 09:17:16 pm by epic7 »

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Axe Q&A
« Reply #1105 on: November 27, 2011, 09:54:01 pm »
You may have already tried this, but whenever I get stuck like that, I just slow down the main loop a ton, and then have it display the value of the var in question. Can I see a full download of the source?

Offline epic7

  • Chopin!
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2200
  • Rating: +135/-8
  • I like robots
    • View Profile
Re: Axe Q&A
« Reply #1106 on: November 27, 2011, 10:09:25 pm »
I tried exactly that ;)

I can't get to a computer right now, so I'll have to upload the calc file Tommorow. However, the full code is posted above.

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Axe Q&A
« Reply #1107 on: November 29, 2011, 05:43:34 am »
In my game I added interrupts.
I put 'it' to 6(slowest speed 118 times a second).
My interrupt label is this:
Code: [Select]
lbl m
text(doesnt matter)
dispgraphrr
But this way the grayscale is very pretty but my games goes insanely slow. Am I doing something wrong?


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me

Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Axe Q&A
« Reply #1108 on: November 29, 2011, 08:49:53 am »
Try removing your text?
I'm not a nerd but I pretend:

Offline Stefan Bauwens

  • Creator of Myst 89 - סטיבן
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1799
  • Rating: +162/-24
  • 68k programmer
    • View Profile
    • Portfolio
Re: Axe Q&A
« Reply #1109 on: November 29, 2011, 09:00:15 am »
Nope :(
It helps a bit i think but moving left and right is really slow and I think it's because it has to draw a part of the map then.


Very proud Ticalc.org POTY winner (2011 68k) with Myst 89!
Very proud TI-Planet.org DBZ winner(2013)

Interview with me