Ultimate Amiga

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Issue with the collision detection.  (Read 6324 times)

0 Members and 1 Guest are viewing this topic.

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Issue with the collision detection.
« on: May 07, 2015, 04:51:49 AM »

I have being reading the book over and over and over, checking the help in AMOS and have being looking at the source code for collision detection (demo) and all point to the same thing.

Use bob Col(number) to collide. I have even used my abk objects on the collision demo itself to see if there is something wrong with my sprite and in the demo it triggers the collision detection no problem. However, not with me it doesn't work. I have attached the source code here in hopes someone can shed some light on the matter. No matter how hard I try..it just refuses to trigger the collision detection. My other issue is I don't want the character to be on top of the wall or touching the wall in order for the collision detection to take effect. I want that the wall will stop the person from going any further before touching the wall to or at least a pixel inch touching the wall so that it does not show to the user you touched the wall but triggers the event.

Anyways here is the source code and I cannot get it to trigger no matter what I am doing. I am stuck here. Any help would be greatly appreciate it.
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Issue with the collision detection.
« Reply #1 on: May 07, 2015, 12:14:06 PM »

Unfortunately, the original AMOS Pro Manual has quite a few mistakes in it (and so do the Help files!).  And that section on collisions is one of the worst.

This problem of collision detection cropped up a while ago and was so confused (and just plain wrong) that I had to check the AMOS Pro sources to see what's actually happening.  The results ended up in this thread, which documents the instructions and has some sample code in attachments.  Read through to the end of the thread as I made a few errors myself as the discussion unfolded and corrected them in some later posts.  It's a difficult subject to document!  V2.10 of AMOS Pro (bug and help fixes) is being worked on but will be a while before it's ready.  Hope this helps in the meantime.
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Issue with the collision detection.
« Reply #2 on: May 07, 2015, 03:50:58 PM »

Unfortunately, the original AMOS Pro Manual has quite a few mistakes in it (and so do the Help files!).  And that section on collisions is one of the worst.

This problem of collision detection cropped up a while ago and was so confused (and just plain wrong) that I had to check the AMOS Pro sources to see what's actually happening.  The results ended up in this thread, which documents the instructions and has some sample code in attachments.  Read through to the end of the thread as I made a few errors myself as the discussion unfolded and corrected them in some later posts.  It's a difficult subject to document!  V2.10 of AMOS Pro (bug and help fixes) is being worked on but will be a while before it's ready.  Hope this helps in the meantime.

The link you send me is broken and does not work.
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Issue with the collision detection.
« Reply #3 on: May 07, 2015, 04:55:10 PM »

Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Issue with the collision detection.
« Reply #4 on: May 07, 2015, 05:49:57 PM »

So from my understanding in all of this...that I cannot use the predefined collision detection command in AMOS and I need to go now in the route of poking and peeking and dealing with assembly and dealing with registry manually in order to cause detection to work? You are telling me in order for me to actually start the process of collision detection in AMOS I have to start reading that 80+ page hand written manual...and that is if I understood 10% of the information and not fall asleep, get bored, not understand half of what is written,not start looking around and skipping words, etc...that if all that happens....in order to do collision detection?

I don't understand then why sample codes get the collision detection working using the Bob Col or Sprite Col with one line of code and why that project works when it uses my sprites, yet when I attempt to do the same with my project it fails and I have to take 5 years of university and read that 80 page document and start poking and peeking.

Bare in mind, I have always wanted to tackle the poking and peeking never had the courage yet to do it and don't know yet how to master that beast.  But there gotta be a better solution than venture in the route of assembly and reading documents and documents about Amiga registery and blittering and and and...when a sample program I ran already used Bob Col(1) and returned -1 while with me always returned zero.

if you what you guys are saying that I have to go through that route (there is no guarantee guys that this brain of mine would have understood what is written in the document at all) I may need to consider an alternative avenue.

But I get frustrated when Is see, games and games and games made out of AMOS that have used the AMOS command for collision detection and not me. I always have this at the back of my mind...why not me and why a stranger have it solved? What does that stranger have that I don't have?
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Issue with the collision detection.
« Reply #5 on: May 07, 2015, 08:49:22 PM »


Calm down.

Problems with programs are part of being a coder - whether it's AMOS's fault, a typo, or slight bug in your code. If noone else beats me to it, I'll have a look over the weekend (I'm too sleepy and don't have the time to do it now).
Logged

Xertese

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 47
  • Generic Amiga User
Re: Issue with the collision detection.
« Reply #6 on: May 07, 2015, 09:00:52 PM »

I feel your pain collision detection on AMOS is bitch.

The advice i can give is to ensure your sprites/bobs are multiples of 16 pixels on the x,y axis to ensure pixel perfect detection.

Another way to achieve detection is to use the Zone command usually used for the mouse pointer which itself is a sprite but you could take advantage of it.
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Issue with the collision detection.
« Reply #7 on: May 07, 2015, 09:54:13 PM »

I feel your pain collision detection on AMOS is bitch.

The advice i can give is to ensure your sprites/bobs are multiples of 16 pixels on the x,y axis to ensure pixel perfect detection.

Another way to achieve detection is to use the Zone command usually used for the mouse pointer which itself is a sprite but you could take advantage of it.

Hmmm...Zone command you say? Ok. I will tackle this right away. My sprite is 16 X 16 exactly by the way :)
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Issue with the collision detection.
« Reply #8 on: May 08, 2015, 04:42:49 AM »

So from my understanding in all of this...that I cannot use the predefined collision detection command in AMOS and I need to go now in the route of poking and peeking and dealing with assembly and dealing with registry manually in order to cause detection to work? You are telling me in order for me to actually start the process of collision detection in AMOS I have to start reading that 80+ page hand written manual...and that is if I understood 10% of the information and not fall asleep, get bored, not understand half of what is written, not start looking around and skipping words, etc...that if all that happens....in order to do collision detection?

I don't understand then why sample codes get the collision detection working using the Bob Col or Sprite Col with one line of code and why that project works when it uses my sprites, yet when I attempt to do the same with my project it fails and I have to take 5 years of university and read that 80 page document and start poking and peeking.
Apologies for the broken link.  It should have got you here, to the post that gives you the info you need.   My ISP's DNS server keeps overloading.  Something no one seems to have considered when internet bandwidths increased by a couple of orders of magnitude in some areas of Australia.  So I unfortunately get chucked out of the page sometimes when I post and have to wait anything up to ten minutes to regain context and do a final check on a post.  So I went to bed instead  ;D

The collision instructions in AMOS Pro work fine.  You will need some understanding of the Amiga hardware's concepts of bitplanes and how they determine the colours seen on screen.  And how they and sprites relate to each other for collision detection.  The Amiga System Programmer's Guide from Abacus gives a pretty thorough description of all the Amiga's hardware using the OCS chipset.  The original ROM Kernel Manuals from Commodore sought to do the same thing but are dry as dust to read and harder to understand.  Useful for reference though.

Seems like that 5 years at university didn't teach you the most important element of education - how to learn.  It takes patience and yes, it does involve frustration.  If you took the time to notice the dates in that thread, you'll see that it took me around a month of my precious spare time to sort out the problem of using AMOS collision instructions.  And that's just one of the problems we have to solve (admittedly, probably the hardest along with the scrolling fix that james666 supplied)

To give you some idea of how mammoth the task of documenting and fixing AMOS Pro is, I'm gradually re-documenting across all the AMOS Pro instruction set (forget what the manual says about over 700, there's around 980).  As well as gradually fixing the known bugs.  To do that, I've had to go through the same frustration as you a few hundred times over.  And learn the 68000 instruction set and the patterns programmers used in assembly language written over 20 years ago.  Whilst we now have the AMOS Pro sources, there's over 120,000 lines of it (and that's with the debug code removed) with most of the comments in French.

AMOS Pro is no longer a commercial product, and hasn't been for years.  We can't just apply to the supplier for an update to anything!  It was written in a different era with none of the tools we expect with modern OO languages.  It does provide an easy way for programmers to access and use the Amiga's unique but complex hardware and, for that alone, it's well worth persevering with.  There's a lot more to it than meets the eye.  Just about anything that you can do with an Amiga you can do with AMOS Pro.  Stick with it and you won't be disappointed.

I've attached a quick install version of the AMOS Pro V2.10 beta.  Just follow the ReadMe.txt file.  The full details are here along with another of those tedious threads you seem to dislike.  This is the last (and only) release that I can do as a simple file replacement as fixes for some of the verification bugs required changes to the config files, so an installer is required. That final release is still a while away but progresses okay.  I trust you'll forgive the time it's taking due to the massive amount of work this project entails...  :P
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Issue with the collision detection.
« Reply #9 on: May 08, 2015, 05:38:02 AM »

Apologies if I have offended you or anyone else. I was a little frustrated but yes it is not excuse, ones again I wish to apologize for everyone whom I offended or sounded whiny and wish to thank everyone here who was patient with me and who have helped me all the way. I will start reading and exercise patience reading what it takes to learn how everything works and do it.

I wish to also thank you so much for all your help and support and for everyone else out there who have taken their time and posted answers to my questions.

Thank you everyone and please forgive me guys if I sounded whiny or offensive in any regard. :-[
Logged

Lonewolf10

  • AMOS Extensions Developer
  • AMOS Dev
  • A2000
  • *****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 618
    • http://www.aliensrcooluk.com
Re: Issue with the collision detection.
« Reply #10 on: May 08, 2015, 07:56:24 PM »

Thank you everyone and please forgive me guys if I sounded whiny or offensive in any regard. :-[

Forgiven ;)
Logged

SamuraiCrow

  • compile-time wierdo
  • Forum Mod
  • A1200
  • *****
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 946
  • Compile-time wierdo
Re: Issue with the collision detection.
« Reply #11 on: May 09, 2015, 02:03:21 PM »

Thank you everyone and please forgive me guys if I sounded whiny or offensive in any regard. :-[

Forgiven ;)
Same here.
Logged

xboxisfinished

  • A600
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 205
  • Generic Amiga User
    • gamemakermagazine.com
Re: Issue with the collision detection.
« Reply #12 on: May 09, 2015, 08:44:42 PM »

So from my understanding in all of this...that I cannot use the predefined collision detection command in AMOS and I need to go now in the route of poking and peeking and dealing with assembly and dealing with registry manually in order to cause detection to work? You are telling me in order for me to actually start the process of collision detection in AMOS I have to start reading that 80+ page hand written manual...and that is if I understood 10% of the information and not fall asleep, get bored, not understand half of what is written, not start looking around and skipping words, etc...that if all that happens....in order to do collision detection?

I don't understand then why sample codes get the collision detection working using the Bob Col or Sprite Col with one line of code and why that project works when it uses my sprites, yet when I attempt to do the same with my project it fails and I have to take 5 years of university and read that 80 page document and start poking and peeking.
Apologies for the broken link.  It should have got you here, to the post that gives you the info you need.   My ISP's DNS server keeps overloading.  Something no one seems to have considered when internet bandwidths increased by a couple of orders of magnitude in some areas of Australia.  So I unfortunately get chucked out of the page sometimes when I post and have to wait anything up to ten minutes to regain context and do a final check on a post.  So I went to bed instead  ;D

The collision instructions in AMOS Pro work fine.  You will need some understanding of the Amiga hardware's concepts of bitplanes and how they determine the colours seen on screen.  And how they and sprites relate to each other for collision detection.  The Amiga System Programmer's Guide from Abacus gives a pretty thorough description of all the Amiga's hardware using the OCS chipset.  The original ROM Kernel Manuals from Commodore sought to do the same thing but are dry as dust to read and harder to understand.  Useful for reference though.

Seems like that 5 years at university didn't teach you the most important element of education - how to learn.  It takes patience and yes, it does involve frustration.  If you took the time to notice the dates in that thread, you'll see that it took me around a month of my precious spare time to sort out the problem of using AMOS collision instructions.  And that's just one of the problems we have to solve (admittedly, probably the hardest along with the scrolling fix that james666 supplied)

To give you some idea of how mammoth the task of documenting and fixing AMOS Pro is, I'm gradually re-documenting across all the AMOS Pro instruction set (forget what the manual says about over 700, there's around 980).  As well as gradually fixing the known bugs.  To do that, I've had to go through the same frustration as you a few hundred times over.  And learn the 68000 instruction set and the patterns programmers used in assembly language written over 20 years ago.  Whilst we now have the AMOS Pro sources, there's over 120,000 lines of it (and that's with the debug code removed) with most of the comments in French.

AMOS Pro is no longer a commercial product, and hasn't been for years.  We can't just apply to the supplier for an update to anything!  It was written in a different era with none of the tools we expect with modern OO languages.  It does provide an easy way for programmers to access and use the Amiga's unique but complex hardware and, for that alone, it's well worth persevering with.  There's a lot more to it than meets the eye.  Just about anything that you can do with an Amiga you can do with AMOS Pro.  Stick with it and you won't be disappointed.

I've attached a quick install version of the AMOS Pro V2.10 beta.  Just follow the ReadMe.txt file.  The full details are here along with another of those tedious threads you seem to dislike.  This is the last (and only) release that I can do as a simple file replacement as fixes for some of the verification bugs required changes to the config files, so an installer is required. That final release is still a while away but progresses okay.  I trust you'll forgive the time it's taking due to the massive amount of work this project entails...  :P

The least I could do is thank you for the information you have giving me and the links you have provided to me. Collision detection have being heavily successful. Since I used the paste bob 1, x, x, imagenum my next object and this is me now is determine what type of object it did collide with. Triggering collision is one thing, but type of collision is another.

I am right now working on determining if the collision I have collided with is a wall or a key or a door or a monster.

The trick I am using is this:

Check Hero X coordinate with the X coordinate of the actual object. Then loop through the array that stores those objects. Match the array number of the objects with the array number of the X coordinate based on the X coordinate of the hero equal the X coordinate array object. Return back the object type and then display in the screen if it is Wall or Key.

For example this is what I have:

HerolocationX(361)
HeroLocationY(361)
LevelObjects(361)
LevelObjectsX(361)
LevelObjectsY(361)

Let us say, LevelObjects(12)   =  Wall.
Let us say, LevelObjectsX(12) =  205.
Let us say, LevelObjectsY(12) =  164.
Let us say, HeroLocationX(14) = 189
Let us say, HeroLocationY(14) = 164

So ones the hero moves one step to the right it, it's HeroLocationX(14) = 205 and I compare that with LevelObjectsX(12) = 205 and if it matches..it returns 12 and I return LevelObjects(12) type. With this type it should return wall and if it is a wall it should return name wall. From there I can determine what to do if such collision detection occured. It still a bit buggy for me and need some working but hopefully I will get it working soon :)
Logged

bruceuncle

  • AMOS Dev
  • A500
  • *****
  • Karma: 6
  • Offline Offline
  • Gender: Male
  • Posts: 425
  • WINUAE Amiga User
Re: Issue with the collision detection.
« Reply #13 on: May 10, 2015, 10:33:43 AM »

Thank you everyone and please forgive me guys if I sounded whiny or offensive in any regard. :-[
Nothing to forgive.  ;)  I can be a bit blunt at times.  Just call me a "grumpy old man".   ;D
Logged
Repeat after me ...  "The AMOS Pro architecture is complex but it is not complicated."
Pages: [1]   Go Up
 

TinyPortal 2.2.2 © 2005-2022