Minecraft game lag problem
#1
Posted 17 August 2012 - 08:18 PM
#2
Posted 17 August 2012 - 08:26 PM
#3
Posted 17 August 2012 - 08:31 PM
The game windows dimensions are 480x320.What is the game window's dimension?
#4
Posted 17 August 2012 - 08:32 PM
Try deactivating all the instances that aren't shown on the screenIm trying to make a game like a 2D minecraft and the only problem is that its running really slow. It runs at about 9 fps i would like it to run at about 30 fps. I have all the blocks that are not shown on screen not drawn which helps it a lot but still runs slow since theres 4805 blocks in the room. Is there any ways of making the game run faster without making the room smaller or making the blocks bigger?
BTW: What GM version are you using?
Edited by Debels, 17 August 2012 - 08:32 PM.
#5
Posted 17 August 2012 - 08:38 PM
BTW: What GM version are you using?
Im using version 7 for mac. Ill try what you said.
#6
Posted 17 August 2012 - 08:57 PM
#7
Posted 17 August 2012 - 08:59 PM
#8
Posted 18 August 2012 - 09:49 AM
In addition to deactivating the instances, try also making them invisible when they are off screen. I tried something like this awhile ago too and it helps if the program doesn't need to display so many sprites.
When the instance is deactivated they are already invisible...
When you deactivate instances they are in some sense removed from the game. They are not visible anymore nor are any events executed for them.
#9
Posted 18 August 2012 - 10:54 AM
When you deactivate instances they are in some sense removed from the game. They are not visible anymore nor are any events executed for them.
This is true! The fact is that if there are too many static objects inside a room, this is slowed. The best solution is therefore to deactivate objects that are located in the region of the room out of view, then:
instance_deactivate_region(view_xview[0],view_yview[0],view_xview[0]+view_wview[0],view_yview[0]+view_hview[0],false,true)But the objects, while being deactivated, aren't destroyed. In fact, they may be reactivated with the opposite function, namely:
instance_activate_region(view_xview[0],view_yview[0],view_xview[0]+view_wview[0],view_yview[0]+view_hview[0],true)
- Madales
Edited by Madales, 18 August 2012 - 10:56 AM.
#10
Posted 30 August 2012 - 02:55 PM
2) Only update blocks in an update event (such as user_event 0). If a block changes - update its neighbours there is no need to constantly check surrounding blocks for things like water.
3) Using a ds_grid should make choosing what blocks to draw a much faster process.
Given these rules - I have successfully created a 2D Minecraft clone with dynamic lighting and fluid dynamics. However - I lost the file when I upgraded computer... so I can't post it. :/
But still - these are a necessity for creating 2D Minecraft clones.
#11
Posted 30 August 2012 - 04:24 PM
#12
Posted 30 August 2012 - 05:13 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











