Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Dec 15, 2018 11:35 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: How does Sprite Surface work?
PostPosted: Sat Oct 01, 2005 5:16 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
In trying to get better performance from my game I have been looking at using a SpriteSurface, this gives me better performance however I cannot use masks in the images and I would really like to use masks so that I can have nice edges to the graphics and drop shadows.

So I was wondering if I would be able to recreate the Sprite Surface and allow for the use of masks in images.

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 8:12 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 8:05 am
Posts: 61
Location: Edinburgh, Scotland
If you set the 'image' property of a Sprite object to a RB Picture object with an embedded mask it should work. If you don't use Sprites for your objects and just draw to the SpriteSurface, your no better than a canvas.

_________________
Charlie Boisseau
[ My Site | My Blog | Net Tool Box ]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 8:31 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 8:05 am
Posts: 61
Location: Edinburgh, Scotland
Ignore my last post - I've just realised in my test app all the images have white backgrounds which makes them appear transparent. That means SpriteSurfaces do support masks, but they're pretty low-tec!

_________________
Charlie Boisseau
[ My Site | My Blog | Net Tool Box ]


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 8:43 am 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:00 am
Posts: 583
Location: Beautiful Taiwan
Thanks Charlie,
Thats one of the reasons why it current puts me off from using Sprite Surfaces. The other reason is that TileSize is limited to 64 pixels. In the game I am writing at the moment the TileSize is 1 10th of the width of the screen. Because I wanted to give the user more detail the higher the resolution instead of a larger world.

I found a request for masks:
http://support.realsoftware.com/feedbac ... d=ynndkfdh

Here is my request for changing the tile size:
http://support.realsoftware.com/feedbac ... d=gqntnbsh

_________________
Sam Rowlands
rMBP 15" @ 10.8 & '08 MBA 13" @ 10.6 + 10.7, RB2012
http://www.ohanaware.com/
AppWrapper - Prepare Apps for Mac App Store & OS X 10.8 - http://www.ohanaware.com/appwrapper/


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 8:44 am 
Offline
User avatar

Joined: Wed Sep 28, 2005 3:23 pm
Posts: 61
Location: Austin, TX
Charlie Boisseau wrote:
Ignore my last post - I've just realised in my test app all the images have white backgrounds which makes them appear transparent. That means SpriteSurfaces do support masks, but they're pretty low-tec!


Correct, they currently don't support masks. There's a feature request in the system floating around that you can sign onto if you'd like that support.

However if you want it today, you can also check out John Balestrieri's SuperSpriteSurface, which provides an OpenGL accelerated sprite surface.

_________________
Jonathan Johnson
Alacatia Labs, Inc.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Oct 01, 2005 6:05 pm 
Offline

Joined: Fri Sep 30, 2005 12:40 pm
Posts: 3
Location: Anchorage, Alaska
I second Jon’s recommendation of the SuperSpriteSurface. I have been very impressed so far. It does cost a little, but you can test everything out without registering. It would have taken me months of work to get anything close in functionality.

If you do want to do your own I have had some luck using RB3D for this purpose and you can also use declares to get at OpenGL directly. It is not worth the time to try and do this using a canvas, if you are looking for a performance increase.
-jim


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 03, 2005 2:17 pm 
Offline

Joined: Mon Oct 03, 2005 2:08 pm
Posts: 4
Do you know games made with SuperSpriteSurface ?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 03, 2005 2:29 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 3:23 pm
Posts: 61
Location: Austin, TX
Check out Power Game Factory: http://www.sawbladesoftware.com/. Also, the demo project with the SuperSpriteSurface has some pretty cool examples.

I also wrote a battleship game which I have been meaning to turn into a tutorial for a while. I presented it at this year's ADHOC/MacHack.

_________________
Jonathan Johnson
Alacatia Labs, Inc.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 03, 2005 5:49 pm 
Offline

Joined: Fri Sep 30, 2005 9:37 am
Posts: 32
Cadfael wrote:
Do you know games made with SuperSpriteSurface ?


http://realrunner.gryphonclaw.alturl.com/

^ A Lode Runner clone done in RB. I believe the source is available.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Oct 03, 2005 8:34 pm 
Offline

Joined: Fri Sep 30, 2005 8:47 am
Posts: 100
SuperSpriteSurface unfortunately is OSX only, which means us Windows-challenged guys have to wait and pray for a port.. :-)


Top
 Profile  
Reply with quote  
 Post subject: jump
PostPosted: Fri Oct 14, 2005 8:37 am 
Offline

Joined: Fri Oct 14, 2005 8:30 am
Posts: 3
im new in this "scripting" thing and trying to make a game. its going to be a 2d, sidescroller action game.well i can move my guy from side to side, but cant make him jump. there isnt any tutorials for that kinda game, so if you could give any hints :?:

_________________
one hell-off-a-lot NOOB


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 14, 2005 11:20 am 
Offline

Joined: Thu Oct 06, 2005 7:56 pm
Posts: 66
Quote:
SuperSpriteSurface unfortunately is OSX only, which means us Windows-challenged guys have to wait and pray for a port..

Which you won't get. SuperSpriteSurface is based on OpenGL, a Mac exclusive technology. Windows uses DirectX or something like that I believe.

Quote:
im new in this "scripting" thing and trying to make a game. its going to be a 2d, sidescroller action game.well i can move my guy from side to side, but cant make him jump. there isnt any tutorials for that kinda game, so if you could give any hints

Spritesurface isn't a game engine, its an animation control that you can bend into a game engine. Writing your own isn't all too difficult, you just need to get an understanding of how sprites behave.

Also, SpriteSurface is by nature a very sluggish creature, so you'll want to optimize the crap out of it. Subclassing good sprite tracking can help somewhat with this.

First thing you want to do when writing an engine is create two classes, one called "Engine" and the other called "MySprites". MySprites needs to be a super of Sprites, and Engine needs to be a super of SpriteSurface.

The reason for this is that sprite objects come with a very limited range of properties, and you need to expand upon them, since your game sprites likely need to have things like Hitpoints, Direction, Speed, etc. In MySprites, create new properties for every property you want each individual sprite to have. Later, when you are creating new sprites via code, you would use.....

dim s as MySprites

s = new MySprites


Using that will give you access to your new properties, and each subsequent sprite you create will get their own set of custom properties.


You're also likely to have a whole mess of sprites, and you'll find that the more you have the harder it gets to keep track of them all. For this, I suggest turning theaforementioned "s" variable into an array (set it to -1, and then redim it when you make a new sprite). It makes things a lot easier when all your sprites are a part of one array and not scattered all over the map in who knows what variable containers. Not to mention it makes looping through them a breeze, which is really handy if you're wanting to do group control and AI. Instead of listing out each sprite like x,y,z,w,n,o,t, you just use s(1), s(2), s(3), s(4),... etc. You might have to keep a text file telling you what each sprite's number actually is, but this way is much faster.

I haven't done much in the way of 2d action (I spend more time doing 2.5d), but making your sprites jump and things are fairly simple tasks. You say you can move your sprite from side to side, so just add in a routine that subtracts and adds from the "y" of a sprite.

Here's the code for moving a sprite up in my Jengine (this is from a class).
// Move "cursprite" up by its defined speed
if s(theID).speed = 0 then
msgBox "You tried to move a sprite with no speed value. Set a speed first!"
else
s(theID).y = s(theID).y - s(theID).speed
end if


Simplified down, the code is actually doing just this.....
s.y = s.y - 5


If you want your sprite to come back down automatically, just create a timer that the "jump" button fires and then have s.y+5 when it hits the specified time. I know I'm generalizing, but to make it more realistic looking you'd loop through it, doing s.y+1 until you reach 5.

If I get time I might post a stripped copy of Jengine (physics engine isn't even a quarter done yet :wink: ) that resembles a basic game engine. I tried to build it user-friendly, so it won't be too hard to figure out (I hope).


Edit: Also, don't expect masks anytime soon on SpriteSurface. Users have been praying to the gods of RB for years now, with no results.

_________________
Its not about dying for your country, its about making the other guy die for his!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 14, 2005 12:11 pm 
Offline

Joined: Fri Sep 30, 2005 12:40 pm
Posts: 3
Location: Anchorage, Alaska
Quote:
Which you won't get. SuperSpriteSurface is based on OpenGL, a Mac exclusive technology. Windows uses DirectX or something like that I believe.


OpenGL is available on Windows; many games use it instead of DirectX. I am pretty sure that RB3D (Quesa) uses OpenGL to render scenes on windows.

In any case John has already announced that the next release of SuperSpriteSurface will be available for windows.

http://www.tinrocket.com/products/superspritesurface/news/00187/

I don't know when it will be released. Perhaps if John sees this he can let us know :D .

-jim


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 14, 2005 2:55 pm 
Offline
User avatar

Joined: Mon Oct 03, 2005 5:33 pm
Posts: 464
OpenGL is a cross-platform standard, supported fully on MacOS, Windows, Linux and BeOS. (Not that anybody uses BeOS, but it had OpenGL support.)

DirectX is a separate-but-equal API for 3D graphics.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Oct 14, 2005 4:43 pm 
Offline

Joined: Thu Oct 06, 2005 7:56 pm
Posts: 66
My mistake. :D

_________________
Its not about dying for your country, its about making the other guy die for his!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group