I am a new Android game developer and I have only a limited knowledge about game development and all. I'd like to create a game just like Farmville and I heard that tile map is the method used to code this game but I dont have support from others so I request you all to help me if you can. Please tell me how I could create such a game using eclipse and android SDK and let me know if there is any game engine that can be a support to my game and how to use it too. I looked at cocos2d android but its very complicated for a starter point of view.
2 Answers
Tile maps are quite simple. View them as a 2D array of properties:
- Sprite to display
- World position (you can simply use your X,Y position in your 2D array and multiply it by your sprite width and height)
- Blocks movement or not (never played Farmville, so not sure if this is necessary)
- Pathfinding cost to traverse if you want to support NPCs
- Actors (either characters, items, etc...) standing on the tile
A basic approach to render them is calculate what fits the view of the camera, if it's a top down view this is trivial, if you're going for a 3/4 view, you will have some maths to compute which tiles to render. If you're not going for top down, render from back to front including actors standing on the tiles, so that they gradually fill the screen and overlap objects that are further away.
As a "starter", I would start simple, learn how to render sprites on the target hardware and move from there.
This question is very broad. It would be better if you asked something like "are there any support libraries for tile based games using cocos2d android".
With that question in mind, it seems that cocos2d supports the TMX map format. The Tiled Map Editor can export to that format. There seems to be a tutorial on how to get started here (I just did google search). I realize that it specifically is referring to the iPhone version of cocos2d but I imagine it wouldn't be too hard to adapt over.
-
\$\begingroup\$ problem is that the tmx map was not able to process and change according to our needs when i am changing the tmx map using tiled QT after edting is down it is not possible to load that tmx file \$\endgroup\$– ArunCommented May 30, 2011 at 5:50