By Bio2hazard 0 Comments
Progress! That is probably one of my favorite words, along with optimize and auspicious.
Today I have worked on a number of things:
The map size is now variable and when drawing the map on the screen, it is cropped to the size of a iPhone 3 screen. It also follows the hero around, so that you are always in the center of the screen. When you get close to the edge of the map, the view will stop moving with your hero, so that you always see as much as possible of the map. ( Screen space is very important on a mobile device, so making the most out of it = good ).
Later on, I will have to dynamically determine what resolution the user's device is running and scaling the view based on that, but for now the iPhone 3 size is working fine for testing!
The other big thing is - as mentioned in my previous blog, the procedural map generation. It prooved to be pretty challenging, but since I managed to get it done in a day I probably can't complain too much.
Now, I know there are a bunch of premade algorithms for this out there, and they may be more effective or efficient than mine, but for the sake of learning and growing chest hairs ( which naturally is the most important aspect about making your own game ), I wrote my own. It's not entirely finished in that for now, it does not connect the rooms it creates with tunnels, but I'm very pleased with my progress as arguably the room generation aspect is more challenging and important.
What I actually did was split up the whole map into sectors / quadrants. The map size I settled on for now is 80 wide, 24 tall. Each sector has a size of 3x3.
There is a fixed number of rooms it tries to create ( 8 , currently ), with randomly generated width and height ( smallest is 3x3, largest is 8x8 ). It will pick a random sector, try to fit the room in there ( it moves the room around if it would leave the map's boundaries ), and then audits all sectors that it would need to occupy whether something else is already occupying the sector. If everything checks out, it marks the sectors as occupied and places the room.
So that's another important part of the game half-working. Again, my focus is to get to a playable state ASAP and work from there.
Also, thanks for the suggestion, Murdouken. I have bookmarked the links!
I probably won't use it in this project, but once I am done with this I will definitely look into it and see if I like it better.
Well, that's all for today. Next up is creating roads between the rooms. Once that's done, I can add some basic monsters and get started on the fun stuff.
Once it becomes more of a game, would anyone be willing to help test if I were to upload it on my webserver?