Xojo Conferences
XDCMay2019MiamiUSA

Re: I need more power captain. (Real Studio games Mailinglist archive)

Back to the thread list
Previous thread: Sprites Colliding
Next thread: Algorithm


Re: I need more power captain.   -   Asher Dunn
   I need more power captain.   -   Sam Rowlands
    Re: I need more power captain.   -   Asher Dunn
  Re: I need more power captain.   -   Sam Rowlands
  Re: I need more power captain.   -   Phil M
  Re: I need more power captain.   -   Sam Rowlands

Re: I need more power captain.
Date: 05.10.05 03:55 (Tue, 4 Oct 2005 22:55:05 -0400)
From: Asher Dunn

On Sep 29, 2005, at 5:46 PM, Sam Rowlands wrote:

> Thanks all for your help. I have improved frame rate on my powerbook
> at 1280x854 to over 30 frames a second by changing the way how I deal
> with the background and how I access the objects, also the pragmas
> helped!

Cool!

> I did get a speed increase when using it at 1024x768, I use the MBS
> plugin to resize the screen and that gave me the black borders around
> the edge. Personally I prefer to play my games in Widescreen if I can,
> I don't really know why.

I do too :-)

> I was thinking I might make it Auto detect the best resolution for the
> game, I am sure I have seen this before in a game but I cannot recall
> which one. Where the game did some tests and then set the 'best'
> resolution for you. You could of course change that resolution if you
> wanted to.

What I usually do is provide a popup with a few standard resolutions
(640x480, 800x600, 1024x768) and the current resolution at launch time
(1280x854 for instance), and let the user choose. All the 4:3
resolutions are universal, and including the current resolution allows
for widescreen where it is supported.

> Once again thank you all for your help. I am so glad there is this
> list with people on who are so willing to offer advice and help. My
> game is coming along (slowly). Finally all these years of playing
> video games can become useful :-)

Haha exactly my argument. Let us know when you have a beta available :-)

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM, Yahoo, MSN: crazedglkid

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

I need more power captain.
Date: 26.09.05 15:13 (Mon, 26 Sep 2005 15:13:54 +0100)
From: Sam Rowlands
Hey Guys,
How do I give my application more CPU time?

I have found that when my application/game is running the most CPU I
can obtain is 51% and this gives me a frame rate of 24 when its full
screen (1280*864 on a PBG4 1.5Ghz). Window Manager steals 15% but I
think this because I am trying to redraw the contents a lot. I
doubled my frame rate when I started drawing directly to the window
background instead of drawing to an image and then the Window
background. Albeit I know this will produce ugly results on Windows
atm. My Windows Box is non-functional at the moment (another story)
so I am focusing on the Mac Version until I can get it working again
(again).

Which is technically faster, using a constant loop in a method or
using a thread of a priority 10. The only reason I ask is because the
constant loop appears faster but there might be something I am doing
wrong.

I am sure that there is a lot I code to speed up my code here and
there, but it does look a wee bit disappointing at the moment that I
can only get 24 frames on a 1.5 Ghz.

Mahalo & Aloha,

Sam Rowlands

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: I need more power captain.
Date: 27.09.05 21:04 (Tue, 27 Sep 2005 16:04:35 -0400)
From: Asher Dunn

On Sep 26, 2005, at 10:13 AM, Sam Rowlands wrote:

> Hey Guys,
> How do I give my application more CPU time?

Use a thread or a loop with #Pragma DisableBackgroundTasks. The latter
is not recommended ;-)

> I have found that when my application/game is running the most CPU I
> can obtain is 51% and this gives me a frame rate of 24 when its full
> screen (1280*864 on a PBG4 1.5Ghz). Window Manager steals 15% but I
> think this because I am trying to redraw the contents a lot.

"redraw the contents" - you mean calling refresh?

> I doubled my frame rate when I started drawing directly to the window
> background instead of drawing to an image and then the Window
> background. Albeit I know this will produce ugly results on Windows
> atm. My Windows Box is non-functional at the moment (another story) so
> I am focusing on the Mac Version until I can get it working again
> (again).
>
> Which is technically faster, using a constant loop in a method or
> using a thread of a priority 10. The only reason I ask is because the
> constant loop appears faster but there might be something I am doing
> wrong.

The loop is faster but not good for a windowed app (the OS considers it
frozen, you can't move the window or use the menu bar, etc.). Should be
fine fullscreen though.

> I am sure that there is a lot I code to speed up my code here and
> there, but it does look a wee bit disappointing at the moment that I
> can only get 24 frames on a 1.5 Ghz.

Definitely! How much drawing are you doing, and how are you doing it?
You mentioned drawing to the window background, so I presume you are
using the graphics class?

Asher Dunn
--------------------------------------------------------
President and Head Developer of Fireye Software
<http://www.fireyesoftware.com/>
AIM, Yahoo, MSN: crazedglkid

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: I need more power captain.
Date: 28.09.05 19:49 (Wed, 28 Sep 2005 19:49:34 +0100)
From: Sam Rowlands
Asher,
Thanks for replying to my e-mail, this is my first game that I am
writing in RB so undoubtedly I am going to be doing things wrong.

On Sep 28, 2005, at 6:00 PM, realbasic-games-
<email address removed> wrote:

>> How do I give my application more CPU time?
>
> Use a thread or a loop with #Pragma DisableBackgroundTasks. The latter
> is not recommended ;-)

Oh... I forgot about Pragmas...

>> I have found that when my application/game is running the most CPU I
>> can obtain is 51% and this gives me a frame rate of 24 when its full
>> screen (1280*864 on a PBG4 1.5Ghz). Window Manager steals 15% but I
>> think this because I am trying to redraw the contents a lot.
>
> "redraw the contents" - you mean calling refresh?

Basically, I draw to the window background and then call
Window.UpdateNow I found if I didn't then no matter what the frame
rate the animation was choppy.

> The loop is faster but not good for a windowed app (the OS
> considers it
> frozen, you can't move the window or use the menu bar, etc.).
> Should be
> fine fullscreen though.

I am comfortable with those side effects, while the user will be able
to run the game in a window it has been designed to run full screen.
Although thinking about it, it may be wise to use a thread if the
user is playing the game in a window.

>> I am sure that there is a lot I code to speed up my code here and
>> there, but it does look a wee bit disappointing at the moment that I
>> can only get 24 frames on a 1.5 Ghz.
>
> Definitely! How much drawing are you doing, and how are you doing it?
> You mentioned drawing to the window background, so I presume you are
> using the graphics class?

The game is an Adventure game, like the old Zelda or Pokeyamom (I
mean Pokemon). The graphics are all tile based and are dependent on
screen size. For arguments sake lets say we are running in 1280 x
854, so each tile is 128 x 128 thats ten tiles wide and 7 high. Its
always 10 tiles wide so if its 640 x 480 the tile size is 64. The
graphics are scaled when they are loaded to the correct size so no
scaling takes place on redraw however each tile is redrawn for each
frame. I have designed it like this to account for animation. Each
tile is responsible for any animation. Back to 1280 x 854, for each
frame redraw it will draw at least 70 128x128 images, I say at least
because that is just the background there might or might not be
foreground tiles and then there is the main character. So at the most
it will be redrawing 140 128x128 images directly into the Window's
graphics (on the Mac, on Windows it will draw to an image and that
image will then be draw to the window background to prevent flicker).
As I said earlier after each frame has been drawn I call
window.UpdateNow otherwise you just see a blank window covering your
screen!

I have glanced at the sprite surface but I figured I could it in the
graphics class as I am comfortable using the graphics (most of my
other applications use graphics classes).

As I meantioned earlier this is my first game I have written (I wrote
a couple of point and click games when I was a kid). I am used to
working in RB, but I can see now how I am dealing with a whole new
kettle of fish!

Mahalo & Aloha,

Sam Rowlands

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: I need more power captain.
Date: 29.09.05 04:45 (Wed, 28 Sep 2005 20:45:21 -0700)
From: Phil M
On Sep 28, 2005, at 11:49 AM, Sam Rowlands wrote:

> The game is an Adventure game, like the old Zelda or Pokeyamom (I mean
> Pokemon). The graphics are all tile based and are dependent on screen
> size. For arguments sake lets say we are running in 1280 x 854, so
> each tile is 128 x 128 thats ten tiles wide and 7 high. Its always 10
> tiles wide so if its 640 x 480 the tile size is 64.

There is no law that you have to use the full screen for the game (even
in full screen mode). I have been designing my full screen games to be
4:3 aspect ratio, but the maximum resolution that I currently support
is 1024 x 768. You can draw a Window with a Black background and then
you have your Canvas/SpriteSurface/RB3D positioned in the center with a
black "border" around. This also keeps the game play the same whether
the user has a widescreen or not.

By limiting the screen to 1024 x 768, you will only be drawing 71% of
the current number of pixels (786,432 instead of 1,093,120) so you
should get about 25% more power.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: I need more power captain.
Date: 29.09.05 22:46 (Thu, 29 Sep 2005 22:46:48 +0100)
From: Sam Rowlands
Thanks all for your help. I have improved frame rate on my powerbook
at 1280x854 to over 30 frames a second by changing the way how I deal
with the background and how I access the objects, also the pragmas
helped!

I did get a speed increase when using it at 1024x768, I use the MBS
plugin to resize the screen and that gave me the black borders around
the edge. Personally I prefer to play my games in Widescreen if I
can, I don't really know why.

I was thinking I might make it Auto detect the best resolution for
the game, I am sure I have seen this before in a game but I cannot
recall which one. Where the game did some tests and then set the
'best' resolution for you. You could of course change that resolution
if you wanted to.

Once again thank you all for your help. I am so glad there is this
list with people on who are so willing to offer advice and help. My
game is coming along (slowly). Finally all these years of playing
video games can become useful :-)

On Sep 29, 2005, at 6:00 PM, realbasic-games-
<email address removed> wrote:

>> The game is an Adventure game, like the old Zelda or Pokeyamom (I
>> mean
>> Pokemon). The graphics are all tile based and are dependent on screen
>> size. For arguments sake lets say we are running in 1280 x 854, so
>> each tile is 128 x 128 thats ten tiles wide and 7 high. Its always 10
>> tiles wide so if its 640 x 480 the tile size is 64.
>>
> There is no law that you have to use the full screen for the game
> (even
> in full screen mode). I have been designing my full screen games
> to be
> 4:3 aspect ratio, but the maximum resolution that I currently support
> is 1024 x 768. You can draw a Window with a Black background and then
> you have your Canvas/SpriteSurface/RB3D positioned in the center
> with a
> black "border" around. This also keeps the game play the same whether
> the user has a widescreen or not.
>
> By limiting the screen to 1024 x 768, you will only be drawing 71% of
> the current number of pixels (786,432 instead of 1,093,120) so you
> should get about 25% more power.
>

Mahalo & Aloha,

Sam Rowlands

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>