Map Generation - Java2D

Hello everyone :slight_smile:

I recently made a rpg game using the java standard library. To generate the map i have used a class to read from a image and made the array of tiles.

Example: An image of 20x20 is going to be an array of [20][20].

All the game is working perfectly. But I’ve just made maps like 20x15 ,40x40 etc.

Recently I tried to make 1000x1000 to see what happens ,when i run the game take 1 or 2 seconds to load all the map but keep working without dropping the performance. Just some lagging at begining but after 30 seconds the speed keeps the same as before.

Then i tried to make 5000x5000 and at the moment i start moving a have an error of
“NULL POINTER EXCEPTION”.

But I cant figure out why this happens, because my first class that i create is the World class and create all the tiles and after that is created the player class.

My question is: Why this happens if I create the player class after the world has been loaded.

Thank you…