ArianeSoft - Programming and development for Windows and Windows Mobile :: Forums :: PPL - Pocket Programming Language :: Support |
|
<< Previous thread | Next thread >> |
Repetitive sprite moves |
Moderators: kornalius, bmanske, PointOfLight
|
Author | Post | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | I am trying to get back into PPL (it is called trying to remember) after an unpleasant break and need a little pointer (no pun). Example... If I want a sprite to travel around the edge of the screen, (or any other repetitive path) as I recall, I can use the Sprite Procedure to constantly check to see if the sprite has reached corner 1 and move it by pixel and then change what it is looking for to corner 2 and again keep checking and so on for all corners and then repeat (naturally doing a few other things at the same time. This works but seems remarkably slow. I could I presume put some kind of invisible sprite at the 'last reached edge' of each corner and wait for a collision event. I cannot see a way to set some co-ords and have an event occur when the sprite coincides. Although I would guess that the engine in these circumstances would simply be doing what I was doing in example one above and so equally slowly. Is there a 'proper way' which would not impact on the speed as in the first example? I guess single pixel movement would have to be used for accuracy. Thanks. You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | Hi Donone, glad you are back! I atach a simple demo I made for testing the speed of scrolling in PPL while something moving is shown on the screen... It uses SpriteProc to move a little man (yes, Luigi!) around an animated windmill. This is done by scrolling the windmill around but can be easily adapted to set Luigi's coordinates. Left shift/control "zooms" the windmill. Cursorkeys move Luigi by hand... The speed is great on the desktop pc of course (Though reaches the end of my 400MHz device's .performance). Maybe the code is of help to you 1209140966_30_FT9416_tilegame.zip There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Thank you very much zehlein, I shall study this carefully. Unfortunately you may also have helped indicate why my speed is low. Mine is a 300Mhz and is VGA. This all leads me to wonder how games with more than a couple of moving sprites can actually be developed in any language for PPC, especially as the devices are all different. The program may work fine on one and snail like on another. I may be wasting time. It is nice to be back, among such a friendly and helpful crowd. You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | This is what I did to "tweak" the speed:
#ifdef _WIN32_WCE
With calling the WM_Timer every 25 ms only and setting the fps to 50 everything looks acceptable on the mobile device. There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Thanks for that tip zehlein, I had not considered altering the framerate. I shall try that and various other numbers just to see the effect. You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Well zehlein, the problem is revealed. Your wonderful Luigi test takes 20 seconds to vertically scroll. It still looks extremely smooth, especially the rotating vanes. I guess I have a major problem. Also I cannot use the scroll method because I have two sprites going in opposite directions in relation to the background. Perhaps I stick to static programs like database or games with one moving object. How do the multitudinous games work fast even on my device? You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
Mike Halliday |
| ||
Registered Member #671 Joined: Tue Sep 25 2007, 12:22pmPosts: 400 | Great example Z. - Have you got a tutorial on ISOmetric style mapping techniques for a future newsletter issue? BTW. I tried it on my HTC prophet (195mhz) and it runs at a pathetic 11fps! - Tried it on my IPAQ at 400mhz and I get 28fps when set to manual and 58fps when set to automatic! Editor of \'Voice of the PPL\' the newsletter for the PPL by the PPL! Still trying to get people to contribute to the newsletter! | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | Donone, instead of moving the whole screen via SetOriginX(...) and SetOriginY(...) and only prevent Luigi from moving with it via the SpriteOption SO_Fixed, simply use a MoveSprite(...) to move your sprites. The reason for implementing the stuff the way I did was simply that I develop a game that uses a tile based map, and this is the most convenient way to scroll the map around. Edit: Mike, you have to use different values for the InitGameAPIEx(), see a few posts above... At the moment I am afraid I don't have the time to write a tutorial about those ISO maps, even though it's pretty easy to implement in PPL. The more I use it, the more I like it! [ Edited Fri Apr 25 2008, 02:46pm ] There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Thanks zehlein, I'll experiment some more. @Mike, what is on automatic? 58 frames sounds good as does the factor of 2. You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | @Donone: appended is a altered version of the test. the "automated" movement og Luigi is now done by moving Luigi around, not the map anymore. I also implemeted two #ifdef (to get the PC and PPC version behaving more similar). Hope this helps. 1209150537_30_FT9416_tilegame.zip Edit: If you set #ifdef _WIN32_WCE speed$ = 2; it looks pretty, pretty smooth... even on my 195 MHz Omap- powered Smartphone! [ Edited Fri Apr 25 2008, 03:25pm ] There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | I am immensely grateful for your time zehlein. I'll try this out tomorrow You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
Mike Halliday |
| ||
Registered Member #671 Joined: Tue Sep 25 2007, 12:22pmPosts: 400 | @Donone, what is on automatic? 58 frames sounds good - When you first load the tilegame the little man moves about by himself - this runs at 58fps, or 11fps on the omap device without the x2 factor changes. @Zehlein, no worries if you have not got any tutorials (yet) - I have enough tutorial material for another 5 months anyway! - hopefully by that time I may have had a chance to pull apart your tilegame and make a tutorial from that (If you allow me to) Editor of \'Voice of the PPL\' the newsletter for the PPL by the PPL! Still trying to get people to contribute to the newsletter! | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | @ Mike: please feel free to do so, if I can help that way - that's wonderful! There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Mike Halliday |
| ||
Registered Member #671 Joined: Tue Sep 25 2007, 12:22pmPosts: 400 | brilliant, another tutorial for the followers of the newsletter! Editor of \'Voice of the PPL\' the newsletter for the PPL by the PPL! Still trying to get people to contribute to the newsletter! | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | @zehlein If you are still around... thank you for the changed Luigi. The action is now a 'little' jerky. I don't know which is fps but the figures I get are 14-15/66-74/2.68-3.00 Perhaps you could comment. After about 30 secs it seemed to slightly speed up. I tried to turn bluetooth and the connection off to maximise resources but then couldn't start Luigi from the PPC, so I have to keep it running. As an aside, is there a way to tell the extension of a file i.e. exe on PPC? You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | The last value 2.68-3.00 is the delta value and tells you that PPL is trying hard to keep up with everything (or in other words: has no chance to keep up). This value should not be near 1. The first value (14-15) is the intervall at which the WM_Timer (and all the internal stuff) is processed. The second value (66-74) is the fps value and is clearly too high, you won'T get any benefit from a fps greater than 60. Anyway, I guess you got these values while your device was still connected via ActiveSync.This slows down the PPC, try to create an exe and copy it to the PDA. And turn off Blutooth and everything you don't need. Let's see what the result will be... Use Resco File Explorer (Payware) or Total Commander (Freeware) to tell the extensions of the files on your device. There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Thank you for your patience and continued assistance zehlein, I do appreciate it. The info on numbers is helpful. Idid not alter your Luigi and so the frame rate was set by your code. I understand that it needs to be set lower, but cannot see why it would change. Perhaps you have found one of my problems, I never make an exe to test anything, in fact never have. Took me a while to realise and find the tutorial for the extra files needed to run this. The figures are now (after a settle down) 16/61-65/2.48 or 2.56 Any comments would be helpful. Thanks [Edit} I notice that the numbers 'appear' to be reversed when running on the PC i.e. 65/4/1.00 ??? I changed the framerate for PPC from 50 to 40. No difference in figures. [Another Edit] I have just tried the speed test by quangdx and get a score of 16 after reset. I tried the stylus moves and it made no difference (well it wouldn't would it with other people getting scores of 200+) I obviously have a problem, but don't know what. Acer n310, 300Mhz WM5 VGA. [ Edited Sun Apr 27 2008, 05:43am ] You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||
zehlein |
| ||
Registered Member #30 Joined: Tue Sep 12 2006, 03:00pmPosts: 449 | A VGA screen driven by a 300MHz processor could pretty easily be the problem. I don't own a VGA device, so I can't comment on that. Maybe someone out there could test the aplication too!? There is a crack, a crack in everything. That's how the light gets in. (L. Cohen) | ||
Back to top | | ||
Donone |
| ||
Registered Member #231 Joined: Fri Jan 12 2007, 10:17amPosts: 626 | Thanks for your help zehlein. Added to zehlein's comment, maybe someone out there could also suggest a more suitable VGA device?? You only stop learning when you die. Sometimes I think I am dead http://www.don-simmonds.co.uk | ||
Back to top | | ||