Hello there.
I have map 100x100 tiles. I'm limited tiles to draw for 15x15 tiles and do it trough Tile.contents (this table contains objects on tile) layer by layer. I'm also constantly moving...
But i have some problems. Objects with free per-pixel coordinates and i don't want to bind they to tiles.
So, how i can draw objects without .contents and do it fast, without spritebatch? On one map might be over of 10000 objects and they position is randomly, but we have some tables with it.
How to draw a lot of objects fast in limited area?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to draw a lot of objects fast in limited area?
Why don't you want to use a spritebatch?
So if I understand correctly your map is limited to 15x15 tiles, but your objects are placed "freely" (not on a grid) and therefore you can't limit their drawing?
You could probably check wether an object is offscreen by doing some simple coordinate checks.
So if I understand correctly your map is limited to 15x15 tiles, but your objects are placed "freely" (not on a grid) and therefore you can't limit their drawing?
You could probably check wether an object is offscreen by doing some simple coordinate checks.
Re: How to draw a lot of objects fast in limited area?
It's too cumbersome for me. And spritebatch need to update for a time i think. Therefore best way for me - direct drawWhy don't you want to use a spritebatch?
In area 8000-10000 objects. How i can do it fast without spritebatch? Or spritebatch is only one method?You could probably check wether an object is offscreen by doing some simple coordinate checks.
Re: How to draw a lot of objects fast in limited area?
Well it depends ... you should run a profiler and check where your game spends the most time.In area 8000-10000 objects. How i can do it fast without spritebatch? Or spritebatch is only one method?
Each time you draw something on the screen with love.graphics.draw you send some information (image, position, etc.) to the GPU. This is no problem when you just want to draw a few things each frame, but the more objects you draw the slower it becomes (even if all you objects use the same image). The spritebatch is basically a way to send one image to the GPU and tell it all locations where this particular image needs to be drawn.
So if you want fast drawing you probably won't get around the SpriteBatch.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: How to draw a lot of objects fast in limited area?
Even if you clear and re-add everything to a SpriteBatch every frame, it'll still be much more efficient than love.graphics.draw(image) in a loop.
Who is online
Users browsing this forum: Bing [Bot] and 1 guest