Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 93 users online: 2 members, 62 guests and 29 bots. Members: None. Bots: VoilaBot (3), VoilaBot (3), Yahoo! Slurp (1), Googlebot (20), Ask Jeeves (1), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
0rac343

Power User

Joined: 06 Jul 2010 Posts: 304 Location: Z80 Processor
|
Posted: 21 Apr 2011 03:41:25 pm Post subject: Axe Questions/Routines *Come here!* |
|
|
This thread will be used for future Axe questions. If you have one post it here, and hopefully someone here will be able to help out or answer. Vice Versa, if you have helpful tips, explanations etc you are welcome to post here as well.
My question:
In my new project I am making, there will be a "scope" and multiple targets to shoot at, I would also like to make a scrolling background (greyscale) but I have no idea how to do any of the above...
Edit by Comic: Title was breaking saxjax, fixed. Also, sticky-fied. _________________ http://Deviantperson343.deviantart.com/?givepoints
[
^^^ plz give meh sum pointz! o.O
^^^ or just check out some of my sketches. Check periodically for new art and updates. |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2957
|
Posted: 21 Apr 2011 03:47:32 pm Post subject: |
|
|
Start by breaking it down. Do you know how to do greyscale? Do you know how to make a scrolling background? Will you use tilemaps? Do you know how to use screen masks? _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 21 Apr 2011 03:48:37 pm Post subject: |
|
|
You can make your background scroll with the Horizontal and Vertical commands. I don't remember if they work with both buffers, though.  _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
0rac343

Power User

Joined: 06 Jul 2010 Posts: 304 Location: Z80 Processor
|
Posted: 21 Apr 2011 03:50:26 pm Post subject: |
|
|
@Player No, No, No, and yes.
@ Souvik I'll try that out and then post a screenie in my project _________________ http://Deviantperson343.deviantart.com/?givepoints
[
^^^ plz give meh sum pointz! o.O
^^^ or just check out some of my sketches. Check periodically for new art and updates. |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2957
|
Posted: 21 Apr 2011 03:50:27 pm Post subject: |
|
|
Souvik, they do work with backbuffers now. Horizontal -{r}, works the same with Vertical and +.  _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55733 Location: Earth, Sol, Milky Way
|
Posted: 27 Apr 2011 11:17:02 pm Post subject: |
|
|
It seems like we got off to a good start but then stagnated. Any new questions? I don't know if a lot of Cemetechians are pursuing Axe, since we tend to have the experts in BASIC and in z80 ASM in the community, but I'd still hope we can help any Cemetech members who are stuck on Axe problems. Keep the questions coming! _________________
 |
|
| Back to top |
|
|
aeTIos

Power User

Joined: 02 Nov 2010 Posts: 491
|
Posted: 11 May 2011 09:47:46 am Post subject: |
|
|
| Maybe I can post some useful routines here? |
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2417 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 11 May 2011 03:44:21 pm Post subject: |
|
|
here are some useful routines I managed to make over time:
draw elliptical shape
inputs: r1 is the X, r2 is the Y, r3 is inverse-proportional height and r4 is inverse-proportional width
outputs: draws elliptical shape
Code: Lbl DE
257
While -1→A
Pxl-On(sin()//r3+r1,sin(A+64)//r4+r2)
A
End
Return
concatenate strings
inputs: r1 is the pointer to first string, r2 points to the second one, r3 is where to write the string
outputs: a string is stored in memory starting at r3
Code: Lbl CS
r3 -> A
For(B,0,Length(r1))
{r1+B}->{A}
A+1->A:End
For(B,0,Length(r2))
{r2+B}->{A}
A+1->A:End
Return
_________________ -Ashbad |
|
| Back to top |
|
|
bspymaster
Member

Joined: 10 Dec 2010 Posts: 131 Location: here (where else?)
|
Posted: 03 Jun 2011 05:15:13 pm Post subject: |
|
|
Hi!
I'm currently working on an AXE program, and all is going well (I would add photos/video, but the TI recording program doesn't work with it). I can't figure out the AI portion. My program is an adventure/ space shooter where you are in a spaceship flying around and you have to do... something (not sure yet) but you will go through different stages where there are obstacles on the screen and enemies you have to destroy. The only way to leave the current "arena" is to destroy all he enemies. I want the enemies to be able to just maneuver around the outside until you com within X spaces of it, then It will follow and shoot at you until you destroy it. Any suggestions? Like I said, I would show you a video of what I have, but the TI recording program doesn't work while the AXE program is running. _________________
 |
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2417 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 03 Jun 2011 07:08:49 pm Post subject: |
|
|
| bspymaster wrote: | Hi!
I'm currently working on an AXE program, and all is going well (I would add photos/video, but the TI recording program doesn't work with it). I can't figure out the AI portion. My program is an adventure/ space shooter where you are in a spaceship flying around and you have to do... something (not sure yet) but you will go through different stages where there are obstacles on the screen and enemies you have to destroy. The only way to leave the current "arena" is to destroy all he enemies. I want the enemies to be able to just maneuver around the outside until you com within X spaces of it, then It will follow and shoot at you until you destroy it. Any suggestions? Like I said, I would show you a video of what I have, but the TI recording program doesn't work while the AXE program is running. |
Sounds like a good concept I suggest using Wabbitemu to record your program, it's an actual emulator so it works just like your real life calculator, but on a computer and with features like recording on-screen things to .gif pictures.
AI isn't a simple topic, but it definitely isn't the black magic everyone makes it out to be
One thing to consider when having multiple objects on screen (or multiple enemies) is to use an object queue. An object queue is just like it sounds -- a line of objects in memory that are updated in order based on their slot positions in the queue buffer. Once you understand this, everything is a lot easier. So, I'll try and describe it to the best of my ability.
For the first example, let's say we have a queue buffer of 16 bytes, starting with the byte pointed to by L1 (SaveSScreen, for you assembly nerds). Let's start simple by filling up these 16 bytes with 4 objects, each 4 bytes in data (type of monster thing, x position, y position, and direction, each 1 byte in memory). We can set up the blank queue for this like so:
Code: 0 -> {L1}
Fill(L1,15)
To change a value for an object, yu can do it either manually, or go the unoptimized but easier way of making a subroutine for it:
Code: Lbl CHG
r3 -> {r1*4+r2+L1}
Return
the arguments for this would be r1 = which_object, r2 = which byte to edit, and r3 = what the byte would now be equal to.
Now that you have this, you can have a looping statement that will do all of the code for each object inside:
Code: For(A,0,3)
(A*4+L1) -> B
... now B = the start of data for each object,
and to do something like access byte 3 of
the current object you would simply do
{B+2}
...
.put your code here!
End
Now, you can put what you want each object to do in the loop, and it makes it pretty easy. Now, you can do simple stuff like make enemies move left (assuming the first byte for each object is the x position) by doing this in the loop:
Code: For(A,0,3)
(A*4+L1) -> B
{B}-1 -> {B}
End
This code in the loop would make each object in the queue move left at one pixel per frame.
From here, you keep adding more on and experiment around to make highly sophisticated enemy patterns
If you want more help on more specific matters, I'll be glad to explain in more depth. This was more of a nutshell of the whole idea.
For your convenience, I'll post a few examples of what object queues make look like. Here's a rather simple one, ripped from TaNF (it handles the rendering of the items like potions and the like on screen and detects collisions):
Code: :Lbl ITM
:For(A,0,1
: If {A*4+{L1}+300}
: If ((X≥({A*4+{L1}+301}-8)) and (X≤({A*4+{L1}+301}+8))) and ((Y≥({A*4+{L1}+302}-8)) and (Y≤({A*4+{L1}+302}+8)))
: !If {A*4+{L1}+300}-1
: {{L1}}+{A*4+{L1}+303}→{{L1}}
: If {{L1}}>{{L1}+1}
: {{L1}+1}→{{L1}}
: End
:Else!If {A*4+{L1}+300}-3
:{{L1}+6}+1→{{L1}+6}
:Else!If {A*4+{L1}+300}-4
:sub(EXP,50+(450*(rand^8=7))+(9950*(rand^64=63))
: ElseIf {A*4+{L1}+300}=2
: {{L1}+2}+{A*4+{L1}+303}→{{L1}+2}
: If {{L1}+2}>{{L1}+3}
: {{L1}+3}→{{L1}+2}
: End
: End
:0→{A*4+{L1}+300}
: Return
:End
:Plot1{A*4+{L1}+301},{A*4+{L1}+302}+8,{A*4+{L1}+300}-1*16+Str5
:End
:End
:Return
And here's what a more advanced enemy system may look like, also ripped from the TaNF source code:
Code: :Lbl ENE
:{L1}+400→B
:For(A,0,2
:(A*8+B)→H
:If {H}=1 or ({H}=2) or ({H}=3)
:!If {H+7}
:!If {H+6}
:rand^4→{H+5}
:0→C
:{H+1}/8→F
:{H+2}/8→G
:!If {H+5}
:!If {G-1*12+F*2+θ+1}
:1→C
:End
:Else!If {H+5}-1
:!If {G*12+F+1*2+θ+1}
:1→C
:End
:Else!If {H+5}-2
:!If {G+1*12+F*2+θ+1}
:1→C
:End
:Else
:!If {G*12+F-1*2+θ+1}
:1→C
:End
:End
:If C
:8→{H+6}
:End
:Else
:!If {H+5}
:{H+2}-1→{H+2}
:Else!If {H+5}-1
:{H+1}+1→{H+1}
:Else!If {H+5}-2
:{H+2}+1→{H+2}
:Else
:{H+1}-1→{H+1}
:End
:{H+6}-1→{H+6}
:!If {H}-1
:8→{H+7}
:Else!If {H}-2
:5→{H+7}
:Else
:2→{H+7}
:End
:
:If ({{L1}+216}{^r})
:{H+7}*2→{H+7}
:End
:
:End
:Else
:{H+7}-1→{H+7}
:End
:If X≥{H+1}
:If X≤({H+1}+8)
:If Y≥{H+2}
:If Y≤({H+2}+8)
:!If {{L1}+212}
:!If {H}-1
:sub(DMG,1
:Else!If {H}-2
:sub(DMG,2
:Else
:sub(DMG,rand^2+3
:End
:End:End:End:End:End
:If {{L1}+204} or {{L1}+206}
:!If {H+4}
:sub(DEN
:End
:End
:If {H+4}
:{H+4}-1→{H+4}
:End
:If {H+4}
:If rand^2
:Plot1{H+1},{H+2}+8,({H}-1*32)+({H+6}/4*16)+Str6
:End
:Else
:Plot1{H+1},{H+2}+8,({H}-1*32)+({H+6}/4*16)+Str6
:End
:End
:
:
:
:End
:Return
:
:Lbl DEN
:0→M
:{H+3}→{{L5}}
:!If {{L1}+214}
:If {H+1}≥X and ({H+1}≤(X+8))
:If {H+2}≥(Y-16) and ({H+2}≤Y)
:1→M
:End:End
:Else!If {{L1}+214}-1
:If {H+1}≥(X+8) and ({H+1}≤(X+16))
:If {H+2}≥(Y-16) and ({H+2}≤(Y-8))
:1→M
:End:End
:Else!If {{L1}+214}-2
:If {H+1}≥(X+8) and ({H+1}≤(X+16))
:If {H+2}≥Y and ({H+2}≤(Y+8))
:1→M
:End:End
:Else!If {{L1}+214}-3
:If {H+1}≥(X+8) and ({H+1}≤(X+16))
:If {H+2}≥(Y+8) and ({H+2}≤(Y+16))
:1→M
:End:End
:Else!If {{L1}+214}-4
:If {H+1}≥X and ({H+1}≤(X+8))
:If {H+2}≥(Y+8) and ({H+2}≤(Y+16))
:1→M
:End:End
:Else!If {{L1}+214}-5
:If {H+1}≥(X-16) and ({H+1}≤(X-8))
:If {H+2}≥(Y+8) and ({H+2}≤(Y+16))
:1→M
:End:End
:Else!If {{L1}+214}-6
:If {H+1}≥(X-16) and ({H+1}≤(X-8))
:If {H+2}≥Y and ({H+2}≤(Y+8))
:1→M
:End:End
:Else
:If {H+1}≥(X-16) and ({H+1}≤(X))
:If {H+2}≥(Y-16) and ({H+2}≤(Y))
:1→M
:End:End
:End
:If M
:If S≤{H+3}:{H+3}-S→{H+3}:Else:0→{H+3}:End
:End
:!If {H+3}
:!If {H}-1
:sub(EXP,1
:Else!If {H}-2
:sub(EXP,2
:Else!If {H}-3
:sub(EXP,5
:End
:If (rand^64)=63
:4→{{L1}+300}
:{H+1}→{{L1}+301}
:{H+2}→{{L1}+302}
:Else!If rand^8-7
:!If {{L1}+300}
:1→{{L1}+300}
:{H+1}→{{L1}+301}
:{H+2}→{{L1}+302}
:{H}→{{L1}+303}
:Else!If {{L1}+304}
:1→{{L1}+304}
:{H+1}→{{L1}+305}
:{H+2}→{{L1}+306}
:{H}→{{L1}+307}
:End
:Else!If rand^8-6
:!If {{L1}+300}
:2→{{L1}+300}
:{H+1}→{{L1}+301}
:{H+2}→{{L1}+302}
:{H}→{{L1}+303}
:Else!If {{L1}+304}
:2→{{L1}+304}
:{H+1}→{{L1}+305}
:{H+2}→{{L1}+306}
:{H}→{{L1}+307}
:End
:End
:0→{H}
:End
:If {{L5}}>{H+3}
:50→{H+4}
:End
:Return
_________________ -Ashbad |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55733 Location: Earth, Sol, Milky Way
|
Posted: 03 Jun 2011 11:28:11 pm Post subject: |
|
|
Very nice, thanks for sharing that, Ashbad! From a higher-level perspective, when I want to design an AI, I simply try to think about what I would be doing if I were manually controlling the AI, things like: (1) move towards the player (2) shoot at them (3) dodge bullets (4) grab items (5) use items, or whatever is relevant to the game, then try to figure out the necessary conditionals. For example (1) if far away from the player, move towards them, or (4) if near item, grab item, or (5) if have item and useable situation, then use it. _________________
 |
|
| Back to top |
|
|
bspymaster
Member

Joined: 10 Dec 2010 Posts: 131 Location: here (where else?)
|
Posted: 05 Jun 2011 11:47:01 am Post subject: |
|
|
Well, ashbad, Thanks for the help, although I didn't understand most of it. Part of that reason is because I started learning AXE a week ago, so I'm still learning most of what you told me. as for the queue, I though of using a matrix. Would that work? _________________
 |
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
|
| Back to top |
|
|
bspymaster
Member

Joined: 10 Dec 2010 Posts: 131 Location: here (where else?)
|
Posted: 05 Jun 2011 03:19:41 pm Post subject: |
|
|
what is "r1" and how do I put information in it? and, would I write that on-calc by putting in the little superscript r and then 1? Also, I can't figure out WabbitEmu. I have an apple, and I can't figure out how to run the program I want to record. _________________
 |
|
| Back to top |
|
|
aeTIos

Power User

Joined: 02 Nov 2010 Posts: 491
|
Posted: 09 Jun 2011 01:33:47 am Post subject: |
|
|
r1 is the polar variable (it means radius). In Axe, it is used to pass variables as arguments to a subroutine.
Example of a subroutine:
Code:
.SUBROUTN
sub(XXX,arg1,arg2,arg3,arg4,arg5,arg6)
Return
Lbl XXX
Disp r1>Dec
Return
You can have up to 6 arguments, these are not required.
(XXX is a label name)
For further reference you should check the readme and the command index file. |
|
| Back to top |
|
|
bspymaster
Member

Joined: 10 Dec 2010 Posts: 131 Location: here (where else?)
|
Posted: 11 Jun 2011 12:46:17 pm Post subject: |
|
|
so, you would put the argument in the sub( command, and then use the pointer r1 (r being the little superscript r found by pressing 2nd>angle>3) and that will be the same number? (r1 sites the number in arg1.) Correct me if I'm wrong. _________________
 |
|
| Back to top |
|
|
SirCmpwn

Coding Knight

Joined: 06 Feb 2010 Posts: 1477 Location: Colorado Springs
|
Posted: 11 Jun 2011 12:50:09 pm Post subject: |
|
|
Example:
Code: .TEST
sub(TX,"Hello",2,4
Return
Lbl TX
Disp r1,i,r2+r3
The output of this is:
Hello
6 _________________ Drew "Sir Cmpwn" DeVault |
|
| Back to top |
|
|
bspymaster
Member

Joined: 10 Dec 2010 Posts: 131 Location: here (where else?)
|
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2417 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 11 Jun 2011 12:59:54 pm Post subject: |
|
|
i means newline, like \n does in C/C++
Lists, matrices, etc. are different in Axe, since it has no uniform data structures. You basically just have to allocate memory in RAM that you can mess with.
EDIT: and when working with numbers, be sure to place >Dec at the end of the argument when working with displaying text. _________________ -Ashbad
Last edited by Ashbad on 11 Jun 2011 01:02:14 pm; edited 1 time in total |
|
| Back to top |
|
|
SirCmpwn

Coding Knight

Joined: 06 Feb 2010 Posts: 1477 Location: Colorado Springs
|
Posted: 11 Jun 2011 01:01:57 pm Post subject: |
|
|
The "i" is the imaginary token, and is Axe's new line character. And yes, you can use variables, your code displays the same output.
Lists, matrices, and appvars are all more complex. This topic covers how to make appvars, and matrices and lists are done differently.
Matrices and lists, assuming that you mean the ones you can access in TIOS, are more complicated to make, and should be done in a similar manner to how it would be done in assembly. If you mean using them solely within your program, that's different. _________________ Drew "Sir Cmpwn" DeVault |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.042890 seconds.
|