I was wondering what would be the most efficient way to make a map in 2D for a java game?
I know this does depend on the way the game will be seen and made so I have included info about this.
View: From Top of Player
Game Type: 2D Shooter
The game cam will focus on the player.
I am going to create my own “map maker”, but was wondering if it should be stored in xml or something. Not exactly sure how to go about this. Are there any good books on this? I was reading ‘killer java games’, but it did not cover this particular topic very well for what I was trying to do.
Now to show you I have been thinking…
I was thinking that the best way would be .xml
Here is an example:
e = entrance / exit
b = block
. = open space
<?xml version="1.0" encoding="UTF-8"?>
<info>
<name>Crack House</name>
<date>9:49PM 5/8/2011</date>
<level>Easy</level>
<rows>10</rows>
<colums>7</colums>
</info>
<map>
<row1>bbbebbb</row1>
<row2>b.....b</row2>
<row3>b..bbbb</row3>
<row4>b.bb..b</row4>
<row5>b.....b</row5>
<row6>b..b..b</row6>
<row7>b..b..b</row7>
<row8>b..bbbb</row8>
<row9>b.....b</row9>
<row10>bbbbbbb</row10>
</map>
It depends on what kind of efficiency is most important to you:
It also depends on your developer skills, and other characteristics of the problem that you have not outlined.
But the bottom line is that your best strategy is probably to just implement it the simple way to start with, and worry about efficiency later … if it turns out to be a REAL problem.
One piece of advice. Try to design / structure your software so that you can change the way that the maps are stored without too much effort.