[BEHAVIOR] Isometric

0 favourites
From the Asset Store
Skin it
$14 USD
30% off
A skin plugin and behavior to add a skin system in your game.
  • Hello there!

    Your isometric behavior is awesome but when the game have big layouts with lots of objects the game gets really slow.

    I've tested with a layout that had about 1000 objects with your iso and the preview was running at ~5 fps

    (With the behavior disabled it was running at 60fps)

    Then I've made some changes on the runtime.js of the behavior to ignore all objects outside of the canvas completely and creates an array of references to the remaining objects index numbers before looping over and over again.

    Now running at 60fps with the same amount of objects without messing the sorting.

    	behinstProto.tick = function ()
    	{
    		//alert(window.rojoList.length);
    		var refList=[];
    		var isoList = this.type.isoList;
    		if(this === isoList[0])
    		{	
    			for (a=0; a < isoList.length;a++)
    			{
    				var isoA = isoList[a];
    				if(this.IsInstOnScreen(isoA.inst))
    				{
    					refList.push(a);
    				}
    				else
    				{
    					isoList[a].behind.length=0;
    				}
    			}
    		}
    
    		if (this === isoList[0] && (this.type.state.enabled || this.type.state.sortOnce))  // only run once
    		{
    			this.type.state.sortOnce = false;
    			var isoA, isoB, a, b, c=0;
    			
    			// updade positions from isometric positions
    			for (a=0; a<refList.length; a++)
    			{
    				isoA = isoList[refList[a]];
    				//isoA.updatePosFromIso();
    				isoA.inst.update_bbox();
    				isoA.visited=false;
    			}
    
    			// build dependency graph
    			for (a=0; a<refList.length; a++)
    			{
    				isoA = isoList[refList[a]];
    				
    				// culling
    				if (!isoA.visited && !isoA.inst.visible && !this.IsInstOnScreen(isoA.inst))
    				{
    					isoA.visited=true;
    					continue;
    				}
    				
    			    for (b=0; b<refList.length; b++)
    				{
    					isoB = isoList[refList[b]];
    					
    					// culling
    					/*if (!isoB.visited && !isoB.inst.visible && !this.IsInstOnScreen(isoB.inst))
    					{
    						isoB.visited=true;
    						continue;
    					}*/
    						
    					if ( isoA != isoB 
    						&& isoA.inst.bbox.intersects_rect(isoB.inst.bbox)  //bounding box check
    						&& isoA.ix-isoA.sx/2 < isoB.ix+isoB.sx/2 -0.001
    						&& isoA.iy-isoA.sy/2 < isoB.iy+isoB.sy/2 -0.001
    						&& isoA.iz-isoA.sz/2 < isoB.iz+isoB.sz/2 -0.001)
    						{
    							isoA.behind.push(isoB);
    							c++;
    						}
    				}
    
    			}
    			
    			// topo sort
    			for (a=0; a<refList.length; a++)
    				isoList[refList[a]].visitNode();
    		}
    	};
    [/code:1s0bhs7i]
    
    \o/
  • Since the system now offers a reasonable z sorter I guess It really doesn't need it in the plug.

  • Hey how can I install this, I get an error saying that GetPluginSettings is global, but not a function. How to fix?

  • Did you put it under plugs, or behaviors?

  • loved it !!!

    Will bookmark it for future use

  • Since the system now offers a reasonable z sorter I guess It really doesn't need it in the plug.

    Not really, this can handle sorting situations that the system condition can't handle.

  • True + it's not like you can't turn of z sorting.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Rojo can you take look at this topic?

    Im wondering how do a hills to walk higher without jumping ?

  • IGDev

    This behavior isn't really usable for slopes.

  • Hi, its possible to add isometrics projectiles? to hit on wall on his height Z position ?

  • Yes, you can. There are actions to move objects in isometric x,y and z, as well as iso collision detection conditions. Look at the examples, the player is basically a projectile.

  • Hey Rojo can you make something to improve performance?

    i create 2000 iso blocks and my fps is 2

    thanks

  • I'm not working on this anymore, but probably the best way to improve performance is to have less objects have this behavior. For instance the ground could be sorted once and left as is.

  • Hi ,

    Very good behavior R0J0hound !

    I start to make a fake isometric game like :

    youtube.com/watch

    After searching what techniques would be best on forum and internet, i think our approach of z-ordering is the best.

    I have just a question. As you can see the movements in the example game is on height directions,so i add 8 movements behavior but i don t if it s the most perfomant method with our behavior ? Any ideas ?

    Ty for replies !

  • worm1

    This doesn't really work with any other behaviors. Motion should be done with the set isometric position actions. The example capx show some ideas how to do this. You'd basically be creating the behavior with events but this provides some useful things to make that easier.

    Actually using some other behavior to do the motion could possibly be done by using a separate object and setting isometric position with that, but eh, it's simpler to just do it with events than to wrangle something to do something it wasn't designed for.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)