The Daily Click ::. Forums ::. Klik Coding Help ::. Laggy 2000 objects?
 

Post Reply  Post Oekaki 
 

Posted By Message

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
26th March, 2007 at 09:02:24 -

I v e started to make some terrain.
I am trying to make 16x16 tiles, that needs to be unmovable "objects"(or something which i can control different terrain overlaps with in editor).

The problem is when i duplicated the grass tile only, and raised the number of objects from 500 to 2500, the game started lagging(mostly while scrolling). I turned off, save background and all stuff like fine detection.
And it doesn't really help.
Bigger objects lags less, but i need 16x16.(at least in transition, and special areas)The most lag is when i scroll the screen, while playing it doesn't lag so much. But i fear it will if i fill up the whole map.(Due to some small indication lag)
And i would prefer 16x16 objects, cause of the later planned editor i want to make.
(maybe i could replace 4 consecutive 16x16 tiles with 32x32 tiles. or even smaller, if its possible, and bigger in event editor)

Is there a way to read those objects somehow else, or to load them in memory somehow to be faster. I just want no lag.whatsoever.(and possibly as smallest tiles as possible)



 
Code me a sausage!

X_Sheep

I had a custom rating before it was cool

Registered
  01/03/2004
Points
  1313

VIP MemberPicture Me This -Round 23- Winner!Dos Rules!
26th March, 2007 at 09:31:02 -

What program do you use?

 
a/n

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
26th March, 2007 at 11:48:43 -

mmf2

 
Code me a sausage!

WillWill

Give me stuff

Registered
  24/07/2006
Points
  552
26th March, 2007 at 12:58:54 -

I know I will face this problem myself when project Parilis will go to the point of where I design huge 2D maps, but do try to work out a method to use only backdrop objects, and when you're saying that you want to read these objects from a memory, you are definitely on the right track.

Simply get the Array Object Extension which should be included in your MMF2, and use it by saving values to X and Y positions. I'm not gonna explain everything to you here, but I think you will get the picture. However I do happen to have a tutorial about this that I've made myself that explains this perfectly well. Even though it's not exactly what you're looking for, it will definitely teach you a thing or two about it. (Hint: Construct your movement engine so that it checks the X and Y position of itself in the Array Object, and if there's a value that means there's an obstacle on that point, move back one step by using some kind of ini file perhaps? At least that's how I did it. You may find a more efficient way, but I find my way to be nice).

Good luck if you're going the way I prefer, because I did well doing it this way. After that you can just turn all objects into background objects. If you need help with something specific, dont be afraid to register on www.martin2k.co.uk/forums and post, and I'll be there to give you a hand.

 
http://www.morphboy.newgrounds.com/
^ Free tunes, as long as you contact me.

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
26th March, 2007 at 21:04:16 -

Ok two questions, and no offence intended.

1, are you using active objects or background objects?
(quick backdrops might be usefull)

2,Is your pc any good?

 
.

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
27th March, 2007 at 09:09:45 -

I am using active, i need to use active.(for terrain modifiers to shooting and movement, evasion and stuff)

I have a good pc, not the best around here, but no problem with most of newer games.

And for the above.
I check movement obstacles after the unit moved, so the unit returns back if hit something solid. It s pretty easy evented, and i m ok with it.

I found out if I replace smaller filled areas with one big object it doesn't lag that much. So i will try and put smaller objects only where i need them.

 
Code me a sausage!

WillWill

Give me stuff

Registered
  24/07/2006
Points
  552
27th March, 2007 at 10:32:53 -

I guess my solution was abit too advanced to read through.

 
http://www.morphboy.newgrounds.com/
^ Free tunes, as long as you contact me.

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
27th March, 2007 at 11:57:25 -

I've found that by changing objects into backdrops you can reduce lag significantly.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
27th March, 2007 at 12:43:29 -

Yeah, because that's what they're made for, backdrops. They take less CPU.

2000 objects in play at one time? That doesn't sound very efficient.

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
27th March, 2007 at 13:02:14 -

You can get away with around 400-500 actives at the same time, but if you try to expand on that it's gonna lag.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
27th March, 2007 at 18:57:08 -

MMF2 doesn't process backdrops of quick backdrops into any of it's loops or conditions, in other words... they're just flat images that do nothing but sit there and look pretty. This is why you can't interact with them or command them specifically, they're just known as "backdrop" in the event editor.

For this exact reason, backdrops can take a game from 20fps up to and beyond your current fps cap, most likely 60 to 80.

Only use Active Objects if you need to interact with them in a very specific manner... even then; you should try to find a way to slither around them if you can.
For example, if you want to 'create' backdrops, obviously you wont be able to do this directly, but create an active object, then paste that object into the back as a no-collision or a collision, which ever you want. Then delete the active object, you shouldn't have any problems, and personally, I haven't had any issues with them disappearing whenever you scroll away from them. Hope this helps.

PS: Unless you're doing things like enemies or bullets, always make sure that you have load on call and inactive when far from the screen, this will exclude the objects from being processed until you get near them, improving the game's performance.

PSS: Use layers if you want to have objects appear over the player, backdrops will appear over active objects if they're in a higher layer.

Image Edited by the Author.

 
http://www.facebook.com/truediamondgame

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
27th March, 2007 at 21:52:47 -

Yeah, 2000 active objects will be slow.

I'm sure there is a way to define terrain types without excessive use of active objects. Say for instance pre defining what terrain is where and having the data stored somehow (in an array?) then making the level out of 16x16 tiles and quickly pasting them as backgrounds.
So the game knows whats what.

Someone else might explain a better way to do it.

 
.

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
28th March, 2007 at 10:16:55 -

Yea i got the picture, i am sure this all will be helpfull while making terrain. But i realized i should start from the map editor first then. If this is the case...

 
Code me a sausage!
   

Post Reply



 



Advertisement

Worth A Click