Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: Runer112 on February 24, 2012, 01:16:34 am

Title: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Runer112 on February 24, 2012, 01:16:34 am
I've been planning this project for a long time, and with the recent release of Axe 1.1.2, I can finally begin to make it a reality!

YAAM

YAAM? How is a vegetable going to help me develop Axe projects?
   YAAM is no vegetable! It stands for Yet Another Axe Mapper, my friend! It is an Axe library designed to make smoothscrolling tilemapping in Axe both fast and easy by providing all the necessary routines for you in an easy to use manner! Instead of having to write your own tilemapping engine to your custom specifications, select the options you want from the built-in variety of options in YAAM and your tilemapper is done! (This will be more true in later versions as I add more features)

But drawing a whole unaligned tilemap every frame is slow! I don't want my game to be slow!
   Au contraire, YAAM makes scrolling tilemaps very quick by shifting the previous frame's tilemap and redrawing only the tiles shifted in, which is quite fast. If the tilemap doesn't shift between frames, you don't need to redraw it at all!

That sounds cool! What other cool features does it have?
   Here, let me draw you up a quick list:
  • Very fast tilemap shifting
  • Handles all drawing and shifting through a few easy to use routines
  • Works with any tile size up to 8x8
  • Works with any map width and height

But I want this feature! And fix this bug!
   For any feature requests and bug reports, just post them in this thread. However, I am already planning many features for the future, so your feature request may actually already be on my to-do list:
Spoiler For To-Do List:
  • Allow many variables, like pointers and map size, to be defined as constants instead
  • Allow tile sizes larger than 8x8
  • Add support for grayscale
  • Implement optimized multi-pixel shifting
  • Add support for inflated coordinates (256 = 1 tile, instead of 1 = 1 pixel)
  • Add support for archived tiles and tilemaps
  • Add support for nibble or bit tilemaps
  • Implement packed tile reading (e.g. 4x4 = 2 bytes, grayscale 5x5 = 7 bytes)
  • Optimize all the code!

Awesome! Where do I get it? How do I use it?
   Easy there, one question at a time! The latest version of YAAM (v0.2) can be found attached to this post. It requires Axe 1.1.2. Download the zip file, send YAAM.8xp to your calculator, include it anywhere in your program, and you're good to go!

Full usage details can be found in the included readme. No they can't, because I haven't written one yet. However, I have included a sample program using YAAM that should detail the basics of using it. You can also learn more about YAAM's options and variables by looking at the options section in the library itself, which has small comments to generally explain what everything is. To set constants like tile width and height to your own values, redefine these values before including YAAM. To set everything else like tilemap size and pointers, store values to the variables listed after including YAAM.


More features will be coming soon!
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: aeTIos on February 24, 2012, 03:46:07 am
Looks nice, so you plan to implement grayscale?
Also nice pokemap ;D
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Sorunome on February 24, 2012, 04:50:18 am
Looks nice! Keep it going! :)
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: kindermoumoute on February 24, 2012, 07:19:24 am
That's look awesome, I like those optimization ! :D

Just a question, what are apperr1 and apperr2 usually ?
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Runer112 on February 24, 2012, 12:00:58 pm
Looks nice, so you plan to implement grayscale?
Also nice pokemap ;D

Grayscale is right at the top of my to-do list. :)

Looks nice! Keep it going! :)

Will do!

That's look awesome, I like those optimization ! :D

Just a question, what are apperr1 and apperr2 usually ?

appErr1 and appErr2 form a 26-byte section of RAM that you can use as scrap RAM in your programs, because very few things will write to them. As the name suggests, really the only thing that writes to this area are errors, but if an error message occurs, you don't need to worry about your program's data being destroyed because your program will have already quit. 26 bytes was about the perfect size for the amount of data I needed to store, so I chose this as the default RAM area to be used.

But, just like everything else in this project, I've planned to make everything customizable. If you want to change the RAM area used for some reason, you can by defining °MR to be something else before including YAAM.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: kindermoumoute on February 24, 2012, 12:28:29 pm
Yeap, I noticed it, your code is beautiful, that's a kind of art. :D
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: turiqwalrus on February 24, 2012, 12:35:10 pm
Yeap, I noticed it, your code is beautiful, that's a kind of art. :D
beautiful and illegible :P
I guess that runer just knows every free ram area...
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Eiyeron on February 24, 2012, 01:48:31 pm
Idea: Add Animated tilemaps (like water in your map)
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Runer112 on February 24, 2012, 01:52:40 pm
I'm not sure if I'll add animated tile support. The idea behind my drawing method, and what makes it fast, is only drawing tiles as they are shifted in. Having to redraw only a few animated tiles per frame might work. But if a large portion of the visible area was composed of animated tiles, my method would actually start to become slower than just redrawing the entire tilemap every frame.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: leafy on February 24, 2012, 01:53:00 pm
Unfortunately that's one of the downsides of this methods - since it shifts in tiles, it can't redraw the others.

Edit: ninja'd :(
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Builderboy on February 24, 2012, 01:54:46 pm
Idea: Add Animated tilemaps (like water in your map)

The whole concept of Runers tilemapper is that it doesn't have to redraw the entire screen every frame, and doesn't even do anything if the screen isn't moving.  If you had animated tiles, you might as well just use a regular tilemapper and redraw the entire screen each frame. 

EDIT" Double Ninja'd D:
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: aeTIos on February 24, 2012, 01:56:54 pm
Lol, anyways animated tiles arent really needed so bad if you have grayscale.
EDIT:
Also, is there some routine to get a certain x,y tile from the map? Havent tried it out yet
(http://img2.imageshack.us/img2/5844/facepalm.gif)
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: DJ Omnimaga on February 24, 2012, 02:19:39 pm
This is nice runer112. Hopefully this should make things much easier for people.

Does your tilemapper supports shifting more than one pixel in one frame? I mean like in Super Sonic Ball, for example, where you could scroll by 4 pixels at once and it even supported variable scrolling rates, as required by the game physics.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Runer112 on February 24, 2012, 02:25:08 pm
This is nice runer112. Hopefully this should make things much easier for people.

Does your tilemapper supports shifting more than one pixel in one frame? I mean like in Super Sonic Ball, for example, where you could scroll by 4 pixels at once.

Not yet. But it will. :) However, it's worth noting that, although vertical shifting by Y pixels will be just about as fast as shifting by 1 pixel, horizontal shifting by X pixels will not. I estimate that it will only be somewhere from 5-25% faster than calling the 1-pixel shift in a loop.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: DJ Omnimaga on February 24, 2012, 02:32:53 pm
Yeah that's what I thought.

Also does your tilemapper regulate speed for vertical movement when it's aligned horizontally? In some games I noticed that it runs much faster when the map is aligned than when it's not. I know it's due to aligned sprites taking less time to draw, but it kinda looks weird in some games.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: LincolnB on February 25, 2012, 09:34:13 pm
This sounds nice, hopefully it may cause some sort of an influx of grayscale platformers and such.

aeTIos, I'm sure you supply your own tilemap, and it's a very easy routine to write - maybe not worth the space in the library it would take up?

(I assume this is an Axiom, or is it a Zedd-esque style of include program, written in Axe?)

Also, does it automatically do dispgraph by itself, or do you need to include that yourself? Because if it doesn't do it by itself (or I guess even if it does) if you want to shift more than one pixel per frame, you can just call the Shift-Screen or whatever similar function multiple times.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Jonius7 on February 26, 2012, 01:40:03 am
This should clear things up a bit by putting Tilemapping into one nice package. Thanks runer!
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: TIfanx1999 on February 28, 2012, 08:45:05 am
Wow, this looks really nice! O.O Great work Runer! :thumbsup:
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: parserp on February 28, 2012, 11:10:16 pm
This. Is. Awesome. Great Job Runer! :D

Random question: will this have support for erasing a tile in the tilemap?
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: leafy on February 29, 2012, 12:42:17 am
If you want to erase a tile, it's easy enough. Change the value in the tilemap to 0 (or whatever you want that's empty) and do a simple Rect( RectI( at the coordinates of the tile, subtracting MX and MY to compensate.
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: parserp on March 13, 2012, 07:38:30 pm
I really like this, it speeds up programs up quite nicely. :D

However, when you have maps in which MX or MY is bigger than something like 110, it starts barfing. :-\
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: Runer112 on March 13, 2012, 08:51:23 pm
It does? That's strange... I'll have to look into that.


EDIT: I probably should have mentioned, if you could give me the source and/or executable that has this issue, that would certainly help my debugging. ;)
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: leafy on March 13, 2012, 09:22:58 pm
I would guess it's because the right side is going over 128, so it's drawing garbled junk?
Title: Re: [AXE LIB] YAAM - Yet Another Axe Mapper
Post by: kindermoumoute on April 15, 2012, 01:23:49 pm
Up ?

No update ?