on 20-03-2012 09:25 PM
I'm trying to generate a background 'map' using sprite tiles from an Image object and rendering the individual tiles thus :
Stopwatch sw=new Stopwatch();
sw.Start();
for(int y = 0; y < MapHeight; y++)
{
for(int x = 0; x < MapWidth; x++)
{
int imgNum = m_MapData[x, y];
m_RenderedMapImage.DrawImage(m_Tiles.Crop(new ImageRect(imgNum*MAP_BLOCK_SIZE,0,MAP_BLOCK_SIZE,MAP_BLOCK_SIZE)), pos);
pos.X += MAP_BLOCK_SIZE;
}
pos.X = 0;
pos.Y += MAP_BLOCK_SIZE;
}
Console.WriteLine ("Map draw took {0} ms", sw.ElapsedMilliseconds);
But after profiling this for a 19 x 13 tile map (247 tiles) it is taking around 850 ms to render the map image. Is there a more efficient of doing this that I am missing? I have toyed with using a SpriteList but worry about performance at runtime.
What is the best way of off-screen rendering? Can I use GameEngine2D and render a SpriteList to an off-screen graphics buffer?
Any help or advise would be greatly appreciated
20-03-2012 10:19 PM - edited 20-03-2012 10:19 PM
The Imaging libraries probably wasn't made for real time stuff, so I'd use SpriteList or RawSpriteTileList. They're made to batch up all the sprites you pass into the list and draw them all in one call (caveat is they all have to refer to the same texture, so your tileset would have to be in one texture), which is something PSS seems to prefer.
If your tilemap doesn't change in the scene, you can just call your tilemap drawing thing once and load the image into a texture and just draw that.
on 22-03-2012 12:34 PM
PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.
フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと
PSM DevPortalを一度ログアウトし、再度ログインしてください。


Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]
%%http://community.eu.playstation.com/t5/Announcements/Beta-Trial-Information/td-p/11386362
best_shooter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_driver.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_performer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_footballer.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_fighter.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_creator.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
best_action_player.png%%http://community.eu.playstation.com/t5/Announcements/Introducing-Best-of-PlayStation/td-p/13741979
dev2.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Producer-and-Developer-Ranks/td-p/18407352
trophy.gif%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/The-Community-Awards-FAQ/td-p/18407096
PSlogoSM.png%%http://community.eu.playstation.com/t5/Website-and-Forum-Help-Feedback/Online-Support-Coordinator-rank/td-p/18414870