Draw a tile map efficiently
Don't draw the whole world every frame.
My level is a grid of tiles: <describe size and tile size> - Store the map as a simple array I can edit by hand — ideally readable as text. - Draw only the tiles currently visible, computed from the camera. Don't loop the whole map every frame. - Tile lookup for collisions: given a world position, which tile? - Handle the map being larger than the visible area in both axes. Then tell me at what map size this approach stops being fast enough, and what I'd do then.
Culling to the visible range is the whole optimisation. A 500×500 map drawn in full is 250,000 draw calls a frame; visible-only is a few hundred.