The Daily Click ::. Forums ::. Klik Coding Help ::. Backgrounds (for collisions)
 

Post Reply  Post Oekaki 
 

Posted By Message

aphant



Registered
  18/05/2008
Points
  1242
14th September, 2008 at 01:02:52 -

So I'm trying to optimize the workload my game has to do. I'm starting with the way things offscreen are handled, like the background.

Would it be better to use 4 different kinds of tiles (like floor, wall, ceiling, floor 2) and just have multiple instances of them? What about using a single pre-made background? Using the Text Blitter object (for dynamic tilesets)?

 

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
14th September, 2008 at 04:22:32 -

Hmm.. I never thought of using text blitter for tiles. It doesn't seem like a bad idea.

The least power-consuming way is to just use backdrop objects as background. If you have a tile, just "paste to background" and delete the tile. That's how most klikers make level editors. Objects used as backdrop don't use processing power. The only flaw with that is that you can't move them around.. but you can paste another object on top of it if you want to change the tile.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
14th September, 2008 at 07:08:41 -

The Text Blitter method is a really effective one in the long run, but it's a lot of work to set it up. Remember that things can't collide with a single character in the Text Blitter, so all of you object-to-level collisions will have to be done by referencing an external file.

 
Go Moon!

aphant



Registered
  18/05/2008
Points
  1242
14th September, 2008 at 08:20:30 -

I'll clarify what I meant. I've got 4 kinds of tiles, graphically, but they're all background objects.

 

Pixelthief

Dedicated klik scientist

Registered
  02/01/2002
Points
  3419

Game of the Week WinnerWeekly Picture Me This Winner!You've Been Circy'd!VIP MemberI like Aliens!Evil klikerThe SpinsterI donated an open source project
14th September, 2008 at 08:36:17 -

one thing i've noticed with the text blitter is that string appending in MMF is inefficient, its like concatenating in C without a stringbuilder; if you have excessive loops and LOTS of tiles using text blitter, in order to get the string for displaying your tiles, you may have to 'manually' append the characters as bytes via the binary object, using the byte sequence to form the string for your result, instead of appending each character onto the main string a bunch of times. I noticed this when working with my raycasting engine, as attempting to create 60 strings of 26 length each via character appending would drag my system down to 10 fps, regardless of everything else going on.

 
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456

Fifth

Quadruped

Registered
  07/05/2003
Points
  5818

VIP MemberGOTW JULY 2010 WINNER!Kliktober Special Award TagGOTW HALLOWEEN 2011 WINNERPicture Me This Round 51 Winner!
14th September, 2008 at 18:24:17 -

That's why you set it up in a manner where you don't need much concatenation.
Instead having a spot in the array being each single tile, you have it be an entire screen's worth of tiles, however long that may be. That way you can have four Text Blitters (so as to cover the screen entirely while scrolling) drawing from no more that four points in the array at any time. Retrieve the string, display it as-is, and it's already displaying your level as it should.

Or you can get really fancy and store your level data (by screens again, I'd recommend) as one continuous string of binary data using the Binary Object. 'Course, then you'd have to come up with your own file format...

 
Go Moon!
   

Post Reply



 



Advertisement

Worth A Click