PDA

View Full Version : I plan to make a RTS game fro iphone




specialfx
Apr 22, 2009, 11:17 AM
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?



mrrish
Apr 22, 2009, 11:29 AM
youre barking up the wrong forum

Niiro13
Apr 22, 2009, 11:57 AM
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.

specialfx
Apr 23, 2009, 04:17 AM
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.

It so nice being a noob

robbieduncan
Apr 23, 2009, 04:59 AM
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.

specialfx
Apr 23, 2009, 06:20 AM
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.

robbieduncan
Apr 23, 2009, 06:22 AM
Ah, :(

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

Multiple images that they load in and out of RAM as required most likely.

specialfx
Apr 23, 2009, 07:37 AM
Multiple images that they load in and out of RAM as required most likely.

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 :)

apeacock
Apr 23, 2009, 09:01 AM
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)

specialfx
Apr 23, 2009, 09:34 AM
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)

I like the challenge though :)

Your suggestions where very pleasant to read,thanks :)

Super forum

apeacock
Apr 23, 2009, 09:36 AM
I like the challenge though :)

Your suggestions where very pleasant to read,thanks :)

Super forum

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

specialfx
Apr 23, 2009, 09:41 AM
You're welcome and good luck - I just wanted to make sure you know what you're in for.

:)

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.

diemos
Apr 23, 2009, 09:45 AM
good luck on the game.

specialfx
Apr 23, 2009, 10:05 AM
I'll need to get a mini mac and iphone first :)

mccannmarc
Apr 23, 2009, 10:13 AM
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

dejo
Apr 23, 2009, 10:14 AM
I'll need to get a mini mac and iphone first :)
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.

specialfx
Apr 23, 2009, 10:15 AM
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

got a link that will help create these terrain cliffs or the like

JWBlue
Apr 23, 2009, 04:36 PM
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.

mccannmarc
Apr 23, 2009, 04:45 PM
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.

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

specialfx
Apr 24, 2009, 02:32 AM
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

Sounds like you've done this type of game before :)

robbieduncan
Apr 24, 2009, 02:47 AM
Sounds like you've done this type of game before :)

Or looked at how Google maps works online...

mccannmarc
Apr 24, 2009, 03:32 AM
Or looked at how Google maps works online...

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!

specialfx
Apr 24, 2009, 07:11 AM
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.

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-ipod-touch-sdk-development-discussion/194881-official-iphone-sdk-windows.html

lazydog
Apr 24, 2009, 07:49 AM
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

specialfx
Apr 24, 2009, 08:38 AM
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?

mccannmarc
Apr 24, 2009, 09:32 AM
You are jumping into a very complex field of programming with this, that being AI. Have you developed anything using AI before? A simple Tic-Tac-Toe game or the like? If not I'd seriously suggest making something relatively simple like that to get an idea of what you are getting yourself into really.

Obviously the AI will be as complex or dumb as you make it but solid AI is pretty much expected in an RTS game as its THE main gameplay component, graphics always come 2nd best to true RTS enthusiasts.

The AI Game Programming Wisdom series of books are very good and cover the majority of the topics that will be interesting to you such as influence & risk maps, terrain analyzing and shortest path algorithms etc, I have read volume 3 but the latest one is 4.

http://introgamedev.com/resource_aiwisdom4.html

Good luck with this but as its been suggested earlier you are jumping in at a VERY deep end with a project this ambitious

specialfx
Apr 24, 2009, 09:37 AM
Well I always like new things to try in programming

You are jumping into a very complex field of programming with this, that being AI. Have you developed anything using AI before? A simple Tic-Tac-Toe game or the like? If not I'd seriously suggest making something relatively simple like that to get an idea of what you are getting yourself into really.

Obviously the AI will be as complex or dumb as you make it but solid AI is pretty much expected in an RTS game as its THE main gameplay component, graphics always come 2nd best to true RTS enthusiasts.

The AI Game Programming Wisdom series of books are very good and cover the majority of the topics that will be interesting to you such as influence & risk maps, terrain analyzing and shortest path algorithms etc, I have read volume 3 but the latest one is 4.

http://introgamedev.com/resource_aiwisdom4.html

Good luck with this but as its been suggested earlier you are jumping in at a VERY deep end with a project this ambitious
very helpfull thanks.

I have an original idea for RTS game

mccannmarc
Apr 24, 2009, 09:38 AM
Well I always like new things to try in programming

:D good attitude, good luck with it

lazydog
Apr 24, 2009, 10:28 AM
If you remember the AI in red alert, could you give me some tips in how to get mines to work similarly?

I think my approach would be to implement a scripting language (or integrate an existing one), and code the AI using it. This will make it quicker to experiment and develop the AI. Also, I think it would be pretty much essential that the scripting language would implement it's own threads as you will be running one script for each game unit/object.

e n

mccannmarc
Apr 24, 2009, 10:35 AM
I think my approach would be to implement a scripting language (or integrate an existing one), and code the AI using it. This will make it quicker to experiment and develop the AI. Also, I think it would be pretty much essential that the scripting language would implement it's own threads as you will be running one script for each game unit/object.

e n

Definately, theres a static lua library for iPhone isn't there? I'm sure I've seen a thread on here or another forum where someone has used lua for something

lazydog
Apr 24, 2009, 11:33 AM
Lua is pretty popular and would make a good choice! I've used it myself briefly on a project which never made it past the initial stages. But it is pretty easy to integrate and to extend with your own C functions etc. The only question I would have is how well it handles concurrency. From my limited knowledge of Lua you would have to write your own game loop for each script and make sure you don't consume too much cpu in each loop. I might be totally wrong though. In the past I wrote a scripting language which compiled to p-code, with opcodes executing in a round robin scheduler. Though not very efficient it meant you didn't have to worry about concurrency issues.

e n

mccannmarc
Apr 24, 2009, 11:47 AM
Its getting to be quite a fruitful read for the OP this thread! lol