Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting world size larger than default blows up once the default size is reached. #72

Closed
luetkemj opened this issue Jan 16, 2022 · 7 comments

Comments

@luetkemj
Copy link

I'm building a standard multilevel dungeon roguelike. Each level creates around 3500 entities. If the default world size is left alone, at level 27 I get a very clear error message:

bitECS - max entities of 100,000 reached, increase with setDefaultSize function.

If I increase the limit to 1,000,000 I get a different error when I reach the original default of 100,000 entities.

Uncaught TypeError: Cannot read properties of undefined (reading 'fill')

Seems like some of the internals are still limited to the default world size.

For the sake of completeness I tried setting the default to 1,000 and instead get the correct error upon reaching 1,000 entities:

bitECS - max entities of 1,000 reached, increase with setDefaultSize function.

How To Repro:

Clone project and check out the world-size-bug-repro branch of my repo here: https://github.com/luetkemj/pixitest

Install deps
npm i

Start dev server:
npm start

Go to localhost:8080 in your favorite browser.

Your character @ starts on a stair case > just press and hold the > key until you get to the 27th floor or the game blows up. Default size is set to 1,000,000 on ln18 src/index.js.

@SupremeTechnopriest
Copy link
Collaborator

I might suggest making a world per level, or bumping the max entities to something higher. Bitecs can handle millions of entities with no issues.

@luetkemj
Copy link
Author

luetkemj commented Jan 16, 2022

Thanks for the quick reply :)

bumping the max entities to something higher

I thought that's what setDefaultSize did? If it wasn't clear above, I set the defaultSize to 1,000,000 but get a fatal error after adding only 100,000 entities to the world. 100,000 is the original default size.

I might suggest making a world per level

Ideally, yes! That was the idea behind my first attempt at a multi-level dungeon, but on trying to save off and restore levels I ran into a different bug (#67)

@SupremeTechnopriest
Copy link
Collaborator

SupremeTechnopriest commented Jan 16, 2022

Are you calling setDefaultSize before creating your world? If so that sounds like another bug that @NateTheGreatt will have to look into. I know he's in the middle of a refactor at the moment.

@luetkemj
Copy link
Author

Are you calling setDefaultSize before creating your world?

Yep, it's the first thing I do after initial imports.

Thanks

@NateTheGreatt
Copy link
Owner

NateTheGreatt commented Feb 22, 2022

@luetkemj did you or can you try the latest version of bitECS and let me know if the error still occurs? 0.3.34 is the latest version. seems like your branch is using an old version of 0.3.21. just want to make sure it's not already fixed 🙂

@luetkemj
Copy link
Author

@NateTheGreatt bug is fixed in 0.3.34 thanks!

@NateTheGreatt
Copy link
Owner

awesome 😄 i'll close this issue then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants