Hey, I was once at the same position as you are now, except I had no idea at all how to program. My first attempt was to be able to select/deselect units and have the to move. On www.wonima.demon.nl you can play the “game” in which I achieved that. After that I moved on with more difficult things. I now have a pretty solid engine, lots of units, terrain, even aircraft units (though not in the version online I believe). I haven’t worked on this game for quite a while (school + moved on the better programming languages). But I think I can give you some advice.
The problem with an RTS is, is that there are many objects at the same. Flash renders very slow, especially if you use movieclips. So you have got to keep in mind you have to do everything with as little cpu power as possible. Of course, if you don’t do this for other applications it’s just bad coding, you should always seek the fastest way. But with a flash rts it’s just so much more important. So bitmap rendering is a must, always.
As I said, I now have a pretty solid engine. One function is called every frame on a static interval looping trough several arrays
checkGameStatus(); // are players dead, power status etc
clearScreen(); // used to clear the screen, bitmap rendering techniques you really can’t miss
playerInput();
gameLoop(); // this loops trough all the arrays of units.
ai.artificialThink(); // the ai
I wouldn’t bother with the AI for now if I were you. You just need to have the objects with good properties. Without OOP you are nowhere. Mine have a lot for example the stats variables:
id // unique number to recognize units
*health *// how many hitpoints it has, if this is below zero the unit is dead. Max health can be found in a nice and sweet statistics class.
damage // rather the attack power of the unit.
speed // or maybe maximum velocity, though, I wouldn’t bother with stuff like that and have just one movement speed
team // very important, used when you are selecting.
Then you have the status variables such as isReloading and isSelected for example.
I wouldn’t start right away with the difficult stuff, just be sure units can move for example. Then implant some kind of firing device. When you don’t have a lot of experience just slowly expand your game. No need to plan the whole game because you just don’t know how you will handle it all. When you have more experience you can start on paper for example.
Now, the selecting stuff isn’t that hard.
*onMouseUp = function () { checkMouseClick (); }
// with checkMouseClick():
static function checkMouseClick (){
for (Unit unit in allUnitsArray)
{
var selectingUnit = false;
if (_root._xmouse > unit.topLeft && _root._xmouse < unit.topRight && … etc {
unit.isSelected = true;
selectingUnit = true;
}
if (!selectingUnit)
{
for (Unit unit in selectedUnitsArray)
{
unit.gotoLocation.X = _root._xmouse;
unit.gotoLocation.Y = _root._ymouse;
}
}
}*
Just, to give you an idea. I just typed it out of my head.
To summarize:
- Learn how to use bitmap rendering
- Learn OOP (if you don’t know it already)
- Start slow.