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...

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!

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.

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):

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.

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?

Axe doesn't have any data structures of its own, you would have to make one yourself using pointers, and either SafeRAM or an appvar/program. For example, if you wanted to create an array you could use the memory at L1, or create an appvar to store your array in. Then, to access elements from that array, you would have to create your own code for doing that. Also, in Axe, arrays are zero-indexed. Here is some example code for getting 2 byte elements out of an array at L1.

Code:

:.ARRAY
:.L1 is the location of our array
:.2 byte elements
:.r1 contains the number of the element to retrieve
:.returns the element in r1
:{L1+r1*2}->r1
:Return

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.

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.

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.

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.