Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Omega Space Protons on November 01, 2010, 02:00:55 PM

Title: Ball isn't moving
Post by: Omega Space Protons on November 01, 2010, 02:00:55 PM
HI guys, i am having problems again with my code. This time i am trying to move a ball so it bounces off the sides of the screen. However for some reason the ball isn't moving at all as if the application is frozen, but it isn't. I have double checked my code for typos and i can't seem to find any. Any help in this matter would be appreciated.

Omega Space Protons
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 03, 2010, 03:09:32 PM
Sorry to double post, but it seems 88 people have seen my thread yet not a single reply has been made.

Omega Space Protons
Title: Re: Ball isn't moving
Post by: MickJT on November 03, 2010, 03:27:18 PM
I don't know any C/C++, but have you tried posting on UtilityBase?
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 03, 2010, 07:18:42 PM
Quote from: MickJT;589026
I don't know any C/C++, but have you tried posting on UtilityBase?


I'm glad you atleast Replied to my thread as having hundreds of people look at your thread and get no reply makes you want to have fits. Sorry to sound rude, it's just that when your developing games for an old system and no one is there to help you, you start to get depressed and think of quitting. Anyways what is UtilityBase and how do I access it?

Omega Space Protons
Title: Re: Ball isn't moving
Post by: SamuraiCrow on November 03, 2010, 07:41:08 PM
Here's a link:  http://utilitybase.com/ (http://utilitybase.com/)
Title: Re: Ball isn't moving
Post by: fishy_fiz on November 04, 2010, 08:48:39 AM
Quote from: Omega Space Protons;589076
I'm glad you atleast Replied to my thread as having hundreds of people look at your thread and get no reply makes you want to have fits. Sorry to sound rude, it's just that when your developing games for an old system and no one is there to help you, you start to get depressed and think of quitting. Anyways what is UtilityBase and how do I access it?

Omega Space Protons


Could you be more of a whiner? ".. boohoo,... people have looked and havent automatically gone out of thier way to spend thier time to help me". What makes you so important that people should help at the drop of a hat ?  You do realise that sulking like this isnt going to help your cause?  I actually downloaded the sources last night and was going to help you when I got home today, but screw that,... not interetied in helping an ungrateful sulk now....
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 04, 2010, 03:25:13 PM
Quote from: fishy_fiz;589237
Could you be more of a whiner? ".. boohoo,... people have looked and haven't automatically gone out of their way to spend their time to help me". What makes you so important that people should help at the drop of a hat ?  You do realise that sulking like this isn't going to help your cause?  I actually downloaded the sources last night and was going to help you when I got home today, but screw that,... not interested in helping an ungrateful sulk now....
I apologise, I wasn't sulking just tired and frustrated as this system has been a pain to program. I didn't mean to take my frustration out on the Amiga community, i was just tired and cranky from trying to create my first Amiga game which I planned on releasing as open source so more games could be released for the Amiga to no avail.

Omega Space Projects
Title: Re: Ball isn't moving
Post by: davideo on November 04, 2010, 10:08:35 PM
I've compiled this on my system and it tells me that the application is waiting for signals 0x40000000 to arrive.

Dave G

Edit: In fact if you comment out this line

signals = Wait(window_signal);

You will find the ball will bounce left and right as you wanted it to. BUT you can't close the window and on my OS3.9 4000D it will crash when killing the program.
Title: Re: Ball isn't moving
Post by: Karlos on November 04, 2010, 11:08:45 PM
Quote
You will find the ball will bounce left and right as you wanted it to. BUT you can't close the window and on my OS3.9 4000D it will crash when killing the program.


Before closing the window and freeing the associated resources, you should ReplyMsg() any IDCMP messages that have piled up using a simple while loop. If you want to be extra safe, you can  also change your window's IDCMP flags first so that it can't receive any further messages.
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 06, 2010, 07:30:54 PM
That's weird cause the line:

Quote
signals = Wait(window_signal);
Is supposed to process all the signals a few lines after that there's a ReplyMsg() call which should cover the hanging 0x4000000000 signals problem. How do I reply to all IDCMP messages and also how do I prevent further IDCMP messages from occurring after the user closes the window?

Omega Space Protons
Title: Re: Ball isn't moving
Post by: mel_zoom on November 06, 2010, 11:49:22 PM
I think you need to call ModifyIDCMP(window, 0) to stop messages being sent to your window?

I am sure I saw an example for safe window closing in the "autodocs".
Title: Re: Ball isn't moving
Post by: nicholas on November 07, 2010, 12:00:45 AM
Quote from: mel_zoom;589989
I think you need to call ModifyIDCMP(window, 0) to stop messages being sent to your window?

I am sure I saw an example for safe window closing in the "autodocs".


Asalaamu alaykum ya ukhti.

Long time! :)
Title: Re: Ball isn't moving
Post by: davideo on November 07, 2010, 01:08:27 AM
Quote from: Omega Space Protons;589932
That's weird cause the line:

signals = Wait(window_signal);

Is supposed to process all the signals a few lines after that there's a ReplyMsg() call which should cover the hanging 0x4000000000 signals problem. How do I reply to all IDCMP messages and also how do I prevent further IDCMP messages from occurring after the user closes the window?

Omega Space Protons


The problem is that the Wait command does just that - it sits and Waits - this is why your ball doesn't move.

The command you need to look into is GetMsg and the actual IDCMP flags you've got set.

Dave G :cool:
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 12, 2010, 09:23:34 PM
Quote from: mel_zoom;589989
I think you need to call ModifyIDCMP(window, 0) to stop messages being sent to your window?

I am sure I saw an example for safe window closing in the "autodocs".


Sorry, I don't have the Autodocs on CD and don't have a link to the autodocs which provide examples only to the ones which have the function references :'(. Could you please post a link to the autodocs examples?

Omega Space Protons

P.S. Sorry for the late reply, I'm away at the moment and don't have access easy access to the Internet.
Title: Re: Ball isn't moving
Post by: Karlos on November 12, 2010, 09:45:59 PM
@Omega Space Protons

Buy this (http://www.softhut.com/cgi-bin/test/Web_store/web_store.cgi?page=catalog/software/development/new_amigadev.html&cart_id=8743296_30584). You won't regret it.
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 15, 2010, 03:30:05 PM
Quote from: Karlos;591275
@Omega Space Protons

Buy this (http://www.softhut.com/cgi-bin/test/Web_store/web_store.cgi?page=catalog/software/development/new_amigadev.html&cart_id=8743296_30584). You won't regret it.
Done. Now I just have to wait for them to ship it and we're in business.

Omega Space Protons
Title: Re: Ball isn't moving
Post by: Karlos on November 15, 2010, 03:54:41 PM
Quote from: Omega Space Protons;591938
Done. Now I just have to wait for them to ship it and we're in business.

Omega Space Protons


Well, it was certainly one of the best Amiga SW purchases I made. Even if you don't use the supplied IDE, the information on the CD is invaluable.
Title: Re: Ball isn't moving
Post by: orange on November 15, 2010, 04:06:09 PM
Quote from: Omega Space Protons;589076
I'm glad you atleast Replied to my thread as having hundreds of people look at your thread and get no reply makes you want to have fits.


you should have chosen different title for thread, then.
Title: Re: Ball isn't moving
Post by: Tension on November 15, 2010, 04:10:39 PM
Quote from: Omega Space Protons;591938

Omega Space Protons


Congratulations on having the coolest user name ever.  Ever.
Title: Re: Ball isn't moving
Post by: Karlos on November 15, 2010, 04:10:42 PM
It isn't really in the right forum, either. How about I move it to the development forum?
Title: Re: Ball isn't moving
Post by: nicholas on November 15, 2010, 05:35:47 PM
Quote from: Karlos;591955
It isn't really in the right forum, either. How about I move it to the development forum?


Indeed, I first thought it was a medical complaint.
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 15, 2010, 09:19:07 PM
Oops sorry, didn't see the development forum. Thanks for the compliments about my username. By the way what is the correct way of using GetMsg() so the system doesn't wait for the dreaded 0x40000000 signal?

Omega Space Protons
Title: Re: Ball isn't moving
Post by: Karlos on November 15, 2010, 09:25:47 PM
I think the problem here is that you are waiting for the wrong stuff. You are waiting for an event to arrive. Under normal event-driven circumstances, that is the correct thing to do. However, your application is supposed to be constantly doing something, that is, animating the ball.

So, instead of waiting for an event to arrive, you should be waiting for the display refresh instead. Within that period, you iterate through the messages that have arrived at your port and perform any display updates that are required. There are a number of ways of doing this depending on whether or not you are running windowed, fullscreen or fullscreen with multibuffering.

For most fullscreen game applications, buffering is the norm since you don't want the user to ever see the items being drawn. There is a method of waiting using a "safe to switch buffers" message port that doesn't busy loop, unlike the somewhat simpler WaitBOVP() call (the latter doesn't always busy wait, in my experience, depends on the hardware it's running on).
 Anyway, there is an example of how to use this type of buffering in the RKM on the developer CD that you have purchased.
Title: Re: Ball isn't moving
Post by: Omega Space Protons on November 16, 2010, 03:31:09 PM
Hey just an update, i just got an email message stating that my shipment is on the way. Is there any chance I could get a sneak peek of the "safe to switch double buffering" method, cause I would hate to wait a week for my CD to arrive before I can make any progress on my game.

Omega Space Protons