Jump to content


Photo

Load Part of the Map


  • Please log in to reply
10 replies to this topic

#1 ToxicArtz

ToxicArtz

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM8

Posted 07 August 2012 - 11:13 PM

I'm making a zombie survival game (2d) based off of day z, along with other zombie games and mods. The map in the survival mode is absolutely massive with lots of different textures, objects, and sprites. I'm looking for a way to load only part of the map around the character, similar to the loading process of the game runescape. How big is the map? It's 100000px by 100000px. That's so big I get lost in in sometimes, and because it's that big I'm worried about it causing lag. Again I'm looking for a way to load only the part of the map around the character (keep in mind the character moves).
  • 0

#2 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 686 posts
  • Version:GM8

Posted 07 August 2012 - 11:23 PM

well you could make multiple rooms and have it if the player passes a point it moves to the new room?
  • 0

#3 ToxicArtz

ToxicArtz

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM8

Posted 07 August 2012 - 11:39 PM

well you could make multiple rooms and have it if the player passes a point it moves to the new room?

Actually I thought of that right after I uploaded this, I might do that.
  • 0

#4 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1332 posts
  • Version:GM8

Posted 08 August 2012 - 12:00 AM

If you map contains separate objects rather than one enormous image, take a look at this script I wrote a while back:

in_view
  • 0

#5 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 686 posts
  • Version:GM8

Posted 08 August 2012 - 12:03 AM

oh ya wont disableing any object out of view do the same?
  • 0

#6 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1332 posts
  • Version:GM8

Posted 08 August 2012 - 12:08 AM

Sort of, the script doesn't draw the object when not in view, so the object is not deactivated. But your fps will go up quite a bit because it is the draw event which consumes the most memory.
  • 0

#7 robinsblade

robinsblade

    GMC Member

  • GMC Member
  • 686 posts
  • Version:GM8

Posted 08 August 2012 - 12:12 AM

but what about just deactivating them? it should be the same unless he wants zombies/enemies to find the player even out of view.
  • 0

#8 Sirosky

Sirosky

    GMC Member

  • GMC Member
  • 1332 posts
  • Version:GM8

Posted 08 August 2012 - 12:15 AM

It would be the same, I typically mix the in_view script with deactivating. For static items like trees, I deactivate. For things like enemies, I use the in_view script.
  • 0

#9 ToxicArtz

ToxicArtz

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM8

Posted 08 August 2012 - 01:44 PM

It would be the same, I typically mix the in_view script with deactivating. For static items like trees, I deactivate. For things like enemies, I use the in_view script.

Your talking about deactivating objects that aren't in the view. I'm new to game maker could you help me out a little with what that does and how do I do it?
  • 0

#10 decroded

decroded

    GMC Member

  • GMC Member
  • 525 posts
  • Version:GM8

Posted 08 August 2012 - 01:54 PM


It would be the same, I typically mix the in_view script with deactivating. For static items like trees, I deactivate. For things like enemies, I use the in_view script.

Your talking about deactivating objects that aren't in the view. I'm new to game maker could you help me out a little with what that does and how do I do it?

Read the manual regarding deactivating instances.

For example, to deactivate all instances outside the view and activate the ones inside the view, you could place the following code in the step event of the moving character:


{
instance_activate_all();
instance_deactivate_region(view_xview[0],view_yview[0],
view_wview[0],view_hview[0],false,true);
}

In practice you might want to use a region slightly larger than the view.


The point would be to not waste cpu time on objects that are outside the view, but you should leave a nice big buffer around the edge of the screen.
This way you can have thousands of enemies as you run around but if you don't have too many on screen at a time it will still be smooth...

Edited by decroded, 08 August 2012 - 02:02 PM.

  • 1

#11 ToxicArtz

ToxicArtz

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM8

Posted 08 August 2012 - 03:57 PM

Thank you!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users