Page 1 of 1

PostPosted: Sun Apr 01, 2001 4:09 am
by Velvis
I have been fooling around with PocketC and Joes toolbox for the last couple of days. I put together a simple "Space Invaders" type game. So far just the players ship (moves left and right) and missle firing code. No aliens or collision detection. Unfortunatly the program slows considerably when the missle is fired and the player is moving.

Since this is before any aliens ( I only planned on a 3, not like space invaders 30 or so) I was thinking that perhaps Pocket C even with Joes library isnt fast enough for something like this.

On the other hand my programming knowledge is limited and perhaps I am doing something wrong.(basically my event loop uses the checkkey for left and right movement and updates the screen as needed. For the fire button I first check for the up button, if so I draw the missle and set a flag. The event loop checks this flag if it is set the missle is further incremented and drawn. after it reaches the top the flag is unset.
(this allows ship movement while the missile moves up)

Functionally, it works just like I wanted it to, but speed is the issue, especially considering no game code has been programmed yet.

Any suggestions or should I pack it away for when a 300 MHZ palm exists?

PostPosted: Sun Apr 01, 2001 9:29 am
by Vilmos
There are a lot of things you can do to optimize your PocketC code. Not all of them are things that you would necessarily think of. Check out the optimization posts in the other forum. Joseph Stadolnik (sorry if I spelled it wrong:) has done a lot of testing and there is a lot to digest. That's in the PocketC Knowledgebase.

One quick thought might be to try drawing your shot a few different ways. Which is faster, a bitmap, line, rect? I haven't seen any comparisons and with the native libraries it makes a lot more comparisons to be made.

Actually I just thought of one important area. You mention that you are using CheckKey so I assume you are using the hardware polling to get the fastest event loop. Do you have an event() in that loop anywhere? The default setting on event is to wait forever for an event. If you want to have a fast loop set it lower.

I just checked my code and I used e=event(0) to make a fast loop. From your post I'm not sure if you are leaving room for screen taps in your event loop yet or if the math is just slowing you down at this point.


Edited by - vilmos on 04/01/2001 04:35:53

PostPosted: Sun Apr 01, 2001 9:44 am
by Vilmos
Wouldn't you know it after reading your message and thinking about an arcade shooter I go to PalmGear and someone has updated one written in PocketC called Shooter. Heh, timing is perfect.

I can't Hotsync here at work so I have no idea about the speed, but take a look at it. I like to think the speed would be decent if the program is published, but you never know.


PostPosted: Sun Apr 01, 2001 1:06 pm
by Velvis
I did check out the shooter game, is wasnt written with Joe's toolbox and isnt a "shooter" in the Space Invaders vein.

I will look at the optimization info you mentioned.