1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

I plan to make a RTS game fro iphone

Discussion in 'iPhone/iPad Programming' started by specialfx, Apr 22, 2009.

  1. macrumors newbie

    #1
    I plan to make a RTS game for the iphone. Lets say I have a 20000 * 30000 jpg image for a map. How to I view a subset of the image 320*400 which I put into a view in my iphone. Also how would I map no go areas for my battle units in this image?
     
  2. macrumors regular

    mrrish

    #2
    youre barking up the wrong forum
     
  3. macrumors 68000

    #3
    This should go in iPhone Programming...

    And if you're asking what I think you're asking, then you will have a loooong way to go as I think you're simply asking how to view only a portion of the image which is a simple scroll view and no go areas as unit position checks against the background.
     
  4. macrumors newbie

    #4
    It so nice being a noob
     
  5. Moderator

    robbieduncan

    Staff Member

    #5
    I think you need to re-think the size of your map! That's a 600 Mega-pixel JPEG. If we assume that it compresses about as well as an average photo then you are looking at a 60Mb file or so, just for your map. You won't realistically be able to load the whole image into your app.
     
  6. macrumors newbie

    #6
    Ah, :(

    Well I wonder how games like red alert manage, or other RTS games for iphone work? I guess the image is zoomed into or something.
     
  7. Moderator

    robbieduncan

    Staff Member

    #7
    Multiple images that they load in and out of RAM as required most likely.
     
  8. macrumors newbie

    #8
    Clever logic, seems like a good idea.

    If I create the maps in photoshop I guess I could save the whole image as 10mb image and load in 700*700 chunks of the map/image and then zoom in to create the illusion of a 1400*1400 image which my units could trasverse.


    btw Red alert is the best :)
     
  9. macrumors member

    #9
    While I don't do iPhone programming per say, I do programming in general. In a RTS, the map isn't one big image. What is actually happening is there is a tile set composed of a few small images which get repeated over and over and over again. Then, any additional features of the terrain are stored as separate entities with their own graphics data and overlaid on the repeated base map data. This way you get a number of reusable elements, across both your original map and additional maps. When you scroll around the map, the computer only has to keep your few small tiles and the additional object data loaded into memory, rather than a massive map file.

    Having said that, if you have to ask this question you have no business making an RTS. There are many programming challenges which are much more complicated than how to draw the map - that is probably the easiest thing you will end up doing. It's just going to get a lot harder from here (unit movement, AI, multiplayer networking, collision detection, etc)
     
  10. macrumors newbie

    #10
    I like the challenge though :)

    Your suggestions where very pleasant to read,thanks :)

    Super forum
     
  11. macrumors member

    #11
    You're welcome and good luck - I just wanted to make sure you know what you're in for.
     
  12. macrumors newbie

    #12
    :)

    I know read alert very well from a users perspective. I seem to remember that a lot of the cliffs were very large and unique, so I'm not sure how easy that would be to overly onto a repeated image as the algorithm to generate the cliff terrain must be complex.
     
  13. macrumors 6502

    #13
    good luck on the game.
     
  14. macrumors newbie

    #14
    I'll need to get a mini mac and iphone first :)
     
  15. macrumors 6502

    mccannmarc

    #15
    The mountains and cliffs themselves are just tiled images too, they are nothing special they have just had an artist draw mountains and split it up into tiles. Tiling is very very very simple when you know how
     
  16. Moderator

    dejo

    Staff Member

    #16
    If you're starting out at that level, you don't even need an iPhone at first. Just sign up with the free iPhone Developer program and you can use the simulator of the SDK to see how your app runs, for now.
     
  17. macrumors newbie

    #17
    got a link that will help create these terrain cliffs or the like
     
  18. macrumors member

    #18
    Some things to keep in mind.

    Largest texture allowed on the iPhone is 1024x1024.
    Use no more than 24mb of RAM. Anything above it could crash due to out of memory error.
    Use PVR compression to reduce memory size, but textures must be in powers of 2.
    Use texture atlases to reduce memory requirement.


    Map out your memory requirements before starting out. The iPhone has very limited resources.

    Good luck.
     
  19. macrumors 6502

    mccannmarc

    #19
    Just to add, take advantage of the fact that tiling makes it very easy to do clipping, only load the tiles that are visible (+ an area around if you are going to allow fast movement). This will get a bit more complex if you want the map to scroll smoothly however
     
  20. macrumors newbie

    #20
    Sounds like you've done this type of game before :)
     
  21. Moderator

    robbieduncan

    Staff Member

    #21
    Or looked at how Google maps works online...
     
  22. macrumors 6502

    mccannmarc

    #22
    Both lol

    I used to make a lot of tile based games when I first got into graphics programming and found it a very good place to start, I've never made an RTS game but a tile engine is a tile engine no matter what its purpose!
     
  23. macrumors newbie

    #23
    I would love to install leopard in windows vmware software like virtualbox
    What is a modified leopard disk as found here, can you get legal versions?

    http://www.modmyi.com/forums/iphone...ssion/194881-official-iphone-sdk-windows.html
     
  24. macrumors 6502a

    #24
    I guess there are a load of different ways to implement a large map, but if I were to tackle it I think I would go for a layered approach. For example, I would have 1 large texture for the map background and then another texture for composing the map detail in layers above it. That way I'd be getting the benefit of a free-form/designed background and the reusability/efficient memory usage of tiles.

    For the background I would also use texture scaling, for example a 1024x1024 texture could be draw with a scale factor of 2 or even more to give a map 4 times the area. You would be able to get away with this visually so long as your background didn't have any sharp detail in it - any details goes in the tile layer above.

    The tile layer would be able to cover the entire map because it would be sparse, ie there would be areas on the map that didn't have detail and so would reuse an empty tile.

    If you go to 2 layers or more of tiles, you could design some reusable tiles, eg rocks, trees etc, and then populate the map with these. The combination of a background and tile layers would give you a lot flexibility.

    Another benefit of using layers is that there will be a natural drawing order for objects, so depending on the perspective you'll be using, you could have trees etc partially obscuring characters moving around etc.

    ß e n
     
  25. macrumors newbie

    #25
    Very helpful thanks.

    If you remember the AI in red alert, could you give me some tips in how to get mines to work similarly?
     

Share This Page