Jump to content

Thoughts on optimizing a very large board


chriscauley
 Share

Recommended Posts

I'm working on a roguelike which is going to have multiple levels active at once with each level being very large. Think several 64x64 chessboards with only a 8x8 area of one level visible at once. All the demos I've seen are more like a traditional chess game where there's only one level visible and you can see the entire board at once. Ideally, pixi.js would only render ~8x8 area visible, tracking which sprites and animations are active. My approach is as follows:

1. Create a single pixi app with a stage and a view visible to the user.

2. Create a container for each of the boards and containers for each of the pieces (to build composite sprites).

3. Attach the currently visible board container to the main app.stage and change the x, y of the board container to stay centered on the player, eg: app.stage.appendChild(board_container)

4. When the player changes levels remove the old board container and add the new board container.

If every piece (probably hundreds) have update functions connected via piece.container.ticker.add(), will pixi be redrawing the pieces off screen or pieces on board containers that are not attached to the main app? Should I be keeping track of which pieces are visible and adding and removing listeners while showing and hiding sprites when I think they are soon to be on screen? I ask because it seems that pixi.js is extremely well optimized and doing things the pixi.js way will surely give me better results than me unbinding and rebinding things by hand.

A link to a pre-existing app that does something similar would be great. I'm pretty handy at reverse engineering other people's code. Thank you in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...