Ultimate Amiga
Network Boards => AMOS Language Discussion => AMOS Factory => AMOS Professional Forum => Topic started by: Brick Nash on June 22, 2016, 11:57:05 AM
-
Hey folks,
I'm trying to do some tile and map based horizontal scrolling (as seen in games like Streets of Rage) but I'm unfortunately not getting anywhere. I asked a similar question on the EAB but this is a bit more specific as it concerns the actual resources.
I wanted to give it a week or so and really see if I could crack it myself before asking for help but I'm going round in the same circles and I think it's time for me to admit defeat as I'm just not making any progress.
I get the concept of what I'm trying to do - Blit and paste a column of 16x16 tile in a buffer zone just off to the right of the visible screen, the positions of which are read from map data and then scroll them left using the joystick or when a Bob reaches a point on the screen to push the scroll. I think my issue is that I've no idea how to actually tell Amos how to read the data I have. I tried looking at the map based scrolling section in the Game Maker's manual but it was almost all TOME based and there was even one part which tried to explain both TOME and TAME in the same piece of code which if I'm honest, I found incredibly confusing.
I'm using a wonderful program which was written by and very kindly donated to me by Codetapper and the program takes a large full level image from a game and chops it up into it's respective tiles and makes a tileset with one of each in .iff, .raw and .png format as well as outputting the stage map data in a (non TOME) .map file format as well as ASM text and something called a .map.s file.
The example code I'm using is reading the .abk tileset I made from the .Iff file and I assume part of the .map data as some tiles are seemingly being randomly pasted on screen but I'd rather try and do the code from scratch as it's all a tad messy because it's a vertical scrolling example and as I say I'm not even sure how to read the map data. I don't even know if I'm using it right or if I maybe need to convert it to something else (which I don't know how to do) so what I've done is I've zipped up all the data including the original large image, the tileset in .iff, .abk and .png formats plus all the map data in .map, .map.s and ASM format.
Download - https://drive.google.com/uc?export=download&id=0B4zq7rE1m0e4Z0t0WW9ObDVuQk0
If someone could be so very kind as to perhaps have a quick look at the files for me and advise on how to go about using it/them for scrolling purposes I'd be very grateful.
As I say, the concept and theory for what I'm trying to do is pretty simple and I totally understand it but I'm just struggling to put it in to code form and it's frustrating as everything else in my project seems to be flowing quite smoothly.
Thanks folks, I really hate to be an inconvenience bashing on about the same thing but if I can crack this and get it working then I'm halfway home!
-
The basic idea is to have a screen size that is twice as wide plus 3 tile widths so you can blit ahead and behind the screen so when the screen offsets to the side as far as possible, you'll have an exact duplicate on the other end of the buffer to wrap around. In this way, you can avoid full screen blitting.
-
The basic idea is to have a screen size that is twice as wide plus 3 tile widths so you can blit ahead and behind the screen so when the screen offsets to the side as far as possible, you'll have an exact duplicate on the other end of the buffer to wrap around. In this way, you can avoid full screen blitting.
Thanks for the reply.
Ok cool I get that part, the concept of how it works is fine but I'm still unsure how to tell Amos to read this data. How exactly is the .map file (or any of the other output data) read? I don't even know how it's structured in order to say 'read it this way'. Is the data a block of organised numbers in a set pattern which matches the level map in the way it's placed or is it organised in a more linear way from that? If so what part do I start to read from? Or even how is it read? I don't even know how long the data is unless I count the lines in the ASM text file and even then I've no idea if it's set the same way.
I'm sorry if I sound like a complete idiot and it's very embarrassing to ask for help like this but I'm honestly just so confused and I get what's meant to happen in theory but I just don't know how to put it in to code and I'm drawing a complete blank every time I try.
-
I can't tell you how the Tome stuff works as I have never used it but in theory, map data is usually referenced using a 2 dimensional array of integers, with each integer corresponding to an image in the Icon bank.
So, the Bare Bones chapter in the manual is essential reading for getting your head around this.
Usually I read in a sequential data file into an array using For.. Next loops, which is easy but slower, but a faster way to do it is binary load a data file into a reserved memory area and then peek the values.
-
I can't tell you how the Tome stuff works as I have never used it but in theory, map data is usually referenced using a 2 dimensional array of integers, with each integer corresponding to an image in the Icon bank.
So, the Bare Bones chapter in the manual is essential reading for getting your head around this.
Usually I read in a sequential data file into an array using For.. Next loops, which is easy but slower, but a faster way to do it is binary load a data file into a reserved memory area and then peek the values.
I'm not using TOME map data, I'm using the .map data file outputted by Codetapper's program which isn't TOME compatible.
I guess I'm trying to get ahead of myself with this task as I don't even know how to binary load a data file into a reserved memory area using the fie I have but I'll definitely go and study the bare bones chapter in the manual as I have read it but obviously it needs further study.
Concept, theory and design are no problem but code structure (for Amos basic) and actual language syntax are the things I'm sorely lacking in!
As always thank you very much for the help and advice! :)
-
Well I would suggest you need to have a conversation with the Codetapper person and find out how the .map output file is structured.
-
the layout of the map format is explained within.... it's a large X/Y datablock with a header detailing some additional information (size etc)
; Map Level 1
;------------
_Level_1Map
dc.l "FORM"
dc.l $2e+(81*16*2)
dc.l "PCLV"
dc.l "LDAT"
dc.l $1a
dc.b 2 ;Map memory type = WORD
dc.b 1 ;Layers
dc.b 16 ;Block width (pixels)
dc.b 16 ;Block height (pixels)
dc.l 81 ;Map width (blocks)
dc.l 16 ;Map height (blocks)
dc.b 0 ;Transparent block = 0
dc.b 0 ;Map compression = None
dc.l 0 ;Reserved
dc.l 0 ;Reserved
dc.l 0 ;Reserved
dc.l "BODY"
dc.l (81*16*2)
dc.w $0,$0,$0,$0,$0,$0,$0,$0
dc.w $0,$1,$2,$3,$4,$0,$0,$5
dc.w $5,$5,$5,$5,$5,$5,$5,$5
dc.w $5,$5,$5,$5,$5,$5,$5,$5
dc.w $5,$5,$6,$5,$5,$5,$5,$7
dc.w $8,$8,$9,$A,$1,$2,$3,$5
dc.w $5,$5,$5,$5,$5,$5,$5,$5
dc.w $5,$5,$5,$5,$5,$5,$5,$5 ... etc etc
So you need to get to grips with these:
A) loading raw data blocks in AMOS
B) translating the header into useful Variable values
C) Seeking through the data block for the actual map data
D) extracting graphics from the IFF into useful tiles
E) producing a map using the data block and provided graphics
F) Creating a Horizontal scroll routine that can read data from the routines built-up in (F)
no small task!
If i get some free time i might have a look, but i cant make any promises atm...
-
Thanks for the replies folks.
I think I bit off more than I could chew right now with the tiles and maps so I decided to leave it for now and just press on with player mechanics/collisions etc. plus boning up on the user manual and the various extensions available. I think once I get a bit more experience under my belt it'll become clearer and I do feel like I'm learning more every day.
Of course any pieces of advice or information or information on the subject that are thrown my way would of course be appreciated but I think it's one of these things I'll need to "earn".
-
Maybe you should practice with a push scroller so you can grasp the concepts before attempting a full real time scroller
-
Without meaning to sound condescending, you have somewhat thrown yourself in the deep end...
Have you considered getting a copy of Easy Amos and working your way through that manual? It's what I started with and it might help you to understand AMOS coding concepts.
-
Brick Nash - if i 'share' a google drive folder with you, would you be able to add it to your Amiga working setup, as a second hard drive? (and collaboration folder)
I can put a tutorial file in there for you to read through.
-
failing that... try the attached.
I havent done a scroll routine, but have read the data from the .map file etc and left/right will re-draw the screen at another location.
hope it helps
-
Without meaning to sound condescending, you have somewhat thrown yourself in the deep end...
No I 100% agree with you. I was trying to do way too much for the level I am at so I'm just treating this as a very long term project now and focus on getting to grips with Amos itself.
failing that... try the attached.
I havent done a scroll routine, but have read the data from the .map file etc and left/right will re-draw the screen at another location.
hope it helps
Hungry Horace, that is incredibly kind of you to take time out to do the tutorial for me so I just want to express my deepest thanks. I had a look at it and tried to run it but it keeps telling me "Extension not loaded" and points to the Extension I,"Level1-3.map",1 line of the code.
I'm not sure if you meant it as just a text example or an actual runable program.
The tutorial itself looks very clear though. I'm having fun just looking through it!
-
I used an AMCAF extension command to load the bank.
I assume you haven't that installed at the mo?
I wil look at what to command needs replacing with (BLOAD something) but would suggest you add that extension!
-
I should add the tutorial is a fully running program.
there are some WAIT command you might want to un-comment.
-
When you do get your AMOS/AMCAF setup sorted, i found a perfect Scrollign example for you to look at on this disk:
http://www.ultimateamiga.co.uk/index.php?action=tpmod;dl=item367
Open the folder "chapter 5" and run ContinuousScroll.amos
... if correctly modified, you could probably merge it with the tutorial program I made to get the result you are after.
-
i should say, i do have a slight "hidden agenda" to getting this to work, in that I love Streets of Rage, and would love to look into adapting my (unfnished) Horace Boxing game to work in a similar style!
-
I’ve made a project with a screen that is two tiles wider than the viewable area and I’m get block put blocking the bulk of the screen and bliting a new set of tiles into the invisible column on either side of the screen as needed depending which direction you’re going and it’s almost smooth. I was going to ask for help optimizing this by either just bliting the entire screen (when the level map entry for that tile wasn’t blank) or by finding a way to just speed things up. But I haven’t gotten it to run as smoothly as just scrolling the screen. So is the prevailing wisdom suggesting that I widen the screen, blit more tiles and just scroll the screen instead? Im still wrapping my head around repositioning the screen to match the position of the tiles without making it obvious that I’m doing it. So I’m not there yet. What would you suggest?
-
Did you read post #2 carefully?
-
Yeah. I guess I’m just confirming that this is the best method. I read it a few times and then saved it into my todo list. I’m using this as my starting recipe.
My screen scrolling is tied to how close the main bob is to each side of the screen. When I offset back to wrap the screen, it sounds like I’m offsetting the main bob the same amount at the same time?
-
Because this method never fully redraws the screen, you have to redraw and undraw the bobs using double buffering. The bob command automates this process but doing synchronization manually often allows more bobs onscreen.
-
I’ve been pasting my icons and it’s fast but it crawls when I double buffer. How else can I populate the level? Am I double buffering wrong? I feel like I’m mixing a few methods. What’s the order of operations for a fast double buffer?
Double Buffer
Autoback 1
Blit screen
Blit bobs
Screen Swap...
Sorry. I’m not in front of my Amiga. Can anyone offer a simple snippet like the one above?
I need to review the manual but I’ve noticed that it doesn’t give examples of a few things.
-
SCREEN SWAP is used only in Autoback 0
Autoback 1 and Autoback 2 - not allowed Screen Swap, because it is automated mode
-
hello, intersting, but drive not work :
Download - https://drive.google.com/uc?export=download&id=0B4zq7rE1m0e4Z0t0WW9ObDVuQk0
I