HaxeFlixel / HaxeFlixel/flixel

Bad tilemap perf on mac?

Open
#2,967 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haxe
Stars
2.2k
Forks
522
Avg merge
34m
Merged PRs (30d)
1

Description

Note to self: Getting bad perf on mac for this simple test

package states;

import flixel.FlxG;
import flixel.tile.FlxTilemap;

class TilemapPerfTestState extends flixel.FlxState
{
	override public function create()
	{
		super.create();
		
		final mapGraphic = createBitmap();
		
		add(createTilemap(mapGraphic));
		add(createTilemap(mapGraphic));
		add(createTilemap(mapGraphic));
		add(createTilemap(mapGraphic));
		
		FlxG.debugger.visible = true;
	}
	
	function createBitmap()
	{
		final TILE_SIZE = 16;
		final bitmap = new openfl.display.BitmapData(TILE_SIZE * 2, TILE_SIZE, false, 0xFFffffff);
		final rect = new openfl.geom.Rectangle(TILE_SIZE, 0, TILE_SIZE, TILE_SIZE);
		bitmap.fillRect(rect, 0xFFff0000);
		return bitmap;
	}
	
	function createTilemap(width = 30, height = 20, graphic)
	{
		final tilemap = new FlxTilemap();
		final ranInt = FlxG.random.int.bind(0, 1);
		final arrayTile = [for (i in 0...(width * height)) ranInt()];
		tilemap.loadMapFromArray(arrayTile, width, height, graphic, 0, 0, null, 0, 0);
		return tilemap;
	}
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the TilemapPerfTestState reproduction on macOS and inspect FlxTilemap.loadMapFromArray and the tilemap rendering path it exercises. Compare the same four-map test across platforms, identify the source of the performance difference, and verify that the reproduction has a measurable improvement.

Written by the indexing model from the issue text.

Assessment

Domain
game-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.