PDA

View Full Version : Best way to prepare a strategy game?



Dragy
October 24th, 2007, 03:02 PM
Hi there,
I'm going to develop a strategy game soon, and it's going to be the first one I'm doing in flash, and some tips could be very helpful! :smirk:

One of the main questions I would like to ask is, what's the best way to create map scrolling, and zooming in/out features?
I know two ways to make scrolling - one is using a dynamic camera (a square mc with a script attached, showing only its area), and one is having an mc with everything inside, then simply move its x and y. I'm not sure which is better, or perhaps there are better techniques I am not aware of?
Now zooming is a bit different, obviously I'll have to mess with the scale of all mcs, but what if I have an mc zoomed out a lot - wouldn't the detail of mcs be useless, as players won't see it anyway from that distance? So I thought of _visible false-ing them, then replace them with a less detailed mc, but will _visible helps this issue? will it really reduce the pressure on the fps?

Another big question came in my mind is what about the huge loops units are going to have every frame, for enemy detection? It sounds like many units will lag the whole game script-ly, and I'm not sure what to do about it.

So any tips would be gladly accepted!
Thanks :nerd:

-Z-
October 24th, 2007, 03:40 PM
:O um... I dono where to start... I didn't really understand the dynamic camera thing...

But if you are wanting alot of stuff to happen, you will need to use bitmapdata, and place the image in the correct order, over the entire map, at the correct locations... etc every time you move the screen, or something happens...

Basically think of it as a picture canvas, where the paint has to be resplattered on it every time, and with that the image changes...

Zooming is kinda complex... kinda very complex... there are several ideas how to do it. But if I were you, I would worry about the first part first. which is alot simpler, but takes a while to get a grasp on.

But I personally would do 'steped' zooming, where they would have like 3 levels, each level has different image sets... but that's alot of downloading (I would probbaly have the image sets be automatically generated from a primary higher quality one at the start of the game)

Dragy
October 24th, 2007, 05:15 PM
I mean a camera such as this one:
http://www.oreillynet.com/pub/a/javascript/2004/08/17/flashhacks.html?page=last

Step zooming is a very good idea. It could serve the zooming needs in my game well :)
I have not read about bitmapdata yet, but do you mean, if, let's say the battle, is not on the player's screen, it won't actually be animated (/rendered)?
And what about the big unit loops, do you think I can create about a hundred units to loop and detect each other without a lag on mid-end computers by doing so? After all this is a 'code lag', and what you suggested, like changing the quality, is graphical lag.

Thanks again :)

ArmoredSandwich
October 24th, 2007, 05:40 PM
DONT USE MOVIECLIPS..

ive tried the same thing and it was way to slow, and not because of bad coding, if thats what ur thinking. -Z- also tried iirc.

About the zooming, you can zoom in with flash.. you know right click->zoom in, maybe you could do something with that :/

Charleh
October 24th, 2007, 05:48 PM
Zooming isn't that difficult - I do dynamic depth in my game.

All you really need to do is either add the _z coordinate to each object if you are looking for variable depth of objects, or specify a zoom level in your 'globals' area or 'world' area if you are simply looking at zooming all objects simultaneously. Then it's just a case of scaling every item accordingly in your render loop.

As for the 100 units - with good code you can easily do this. In my game I'm using slow movieclip rendering but I still get near top speed (35-40 fps) with 80 or so objects on screen simultaneously.

I'm sure with bitmap rendering it would be nice and quick.

Dragy
October 24th, 2007, 06:37 PM
Could you please detail about bitmap rendering? I read about enable bitmap on movieclips, and on how it reduces the render time for the flash, but I also read that if the mc is an animation, it has to capture the image every frame, making the usage wrong and does not help the fps at all.
or are you guys talking about another technique? I didn't quite get how not to do it with any mcs. I could use more info :)

Charleh
October 25th, 2007, 06:16 AM
Bitmap rendering is not using cacheAsBitmap in the MCs, it is the art of loading all your bitmaps into memory and then copying them to a blank canvas (buffer) every frame. You won't be using movieclips.

There's a whole topic on this in another post

http://www.kirupa.com/forum/showthread.php?t=276114