drawing tiled without sprite infrastructure

Asked by tobs12

Hello,

I want to program a game that uses a tile based map, similar to the platformer example.
The map consist of tiles (isometric 16x8, i.e. need alpha).
I tried to do this with Sprites, but with a screen resolution of 1650x1080, you have to create a lot of sprites.
When creating more than 60x60 sprites, the game crashes. I assume there is a limit on the total number of sprites.

Is there another possibility to render such a map?
Can I directly draw Images to screen without using the Sprite infrastructure (since this seems not to fit the problem), but with the same performance?

Best regards

Question information

Language:
English Edit question
Status:
Solved
For:
PyGL3Display Edit question
Assignee:
David Griffin Edit question
Solved by:
tobs12
Solved:
Last query:
Last reply:
Revision history for this message
David Griffin (habilain) said :
#1

Um, it shouldn't crash, so that's a bug. I've tested up to 100k sprites without problems (before I implemented wrapping textures, every 8x8 tile on the platformer example was a separate sprite). Could you upload a source sample and/or file a bug (I'll file one if you don't)? The quicker I can reproduce the bug, the quicker I'll be able to fix it.

Regarding the question... if it's an image, then at the moment it's a sprite. So I'm afraid not.

Revision history for this message
David Griffin (habilain) said :
#2

I've done some experiments, and I'm seeing some misbehaviour above 4096 sprites. Stuff doesn't crash, but nothing renders either. I've created Bug #1178470 for this. Not sure if this is what you're seeing though, so it might not be your problem.

Revision history for this message
tobs12 (hans1215) said :
#3

Thanks for your fast reply.
I added a reproducer to the Bug #1178470 .

Revision history for this message
David Griffin (habilain) said :
#4

Marking this as closed as this is really a bug report / any questions have been answered.

Oh, and as a FYI on the code you submitted in the bug report: that code won't run particularly fast because you call setPosition on every tile in the main loop. Assuming that the relative positions of the tiles don't change, set their positions when they're created and give them all a camera, as in the platformer example. Then it's a matter of updating the camera position, and all the tiles will move without having to change each one individually.

Revision history for this message
tobs12 (hans1215) said :
#5

Thanks for the info