A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: [CS3] [WIP] Untitled Real Time Strategy Game - Performance?

  1. #1
    Senior Member
    Join Date
    Jun 2002
    Posts
    178

    [CS3] [WIP] Untitled Real Time Strategy Game - Performance?

    I am wondering if anyone could give me some feedback on how my game runs performance wise on their computers? All of the computers I have to test it on are fairly fast with dual or quad cores and good gfx cards.

    The game runs a considerable amount of functions every cycle and the test map is pretty big for a flash bitmap, and I would like to know if I really need to do more optimizing before I continue further.

    URL : RTS Flash Game

    You can select your base building and build barracks and oil refineries on the oil wells that are around the base to gather resources, along with building some of the first units I put into the game.

    Theres no enemy AI yet, im working on that now. This is my first game in flash so trying to come up with every programming idea is difficult, but I'm getting there.

    Any feedback is appriciated also. I know the gfx are lame right now, but its all test gfx until the game engine is completed, and if anyone has worked on a RTS game before I could use some pointers on enemy AI. I am trying to come up with my own system for enemy AI but I've never actually seen AI code before so I'm pretty much shooting in the dark with that.
    - Invulse v1. Genesis .. http://www.invulse.com .. -Chris

  2. #2
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    that´s already pretty nice,-
    now you just need some decent graphics

    I have a quadCore here as well so no gaps or freezes

    regarding AI,-
    do you have already some pathfinding working? because that might the most important matter for the AI. Mr_Malee here FK once posted a nice thread about a pathfinding for a RTS game as well with a semi tile/node approach
    some links:
    http://img103.imageshack.us/my.php?i....swf&width=800
    http://63.236.18.192/board/showthrea...ight=path+find

    good luck

  3. #3
    Senior Member
    Join Date
    Jun 2002
    Posts
    178
    I actually just read the entire thread from Mr_Malee, but I'm using a pretty simple A* algorithm I found. I modified it quite a bit but it works well with my tile based map system ive made. I really liked the idea of the triangulated node based pathfinding but I actually plan on making a really easy to use online map editor for the game, and that would make map making very complicated.


    On a side note I actually need to add 'Fog Of War' into the game but I've been debating how to do it. The optimal way would be to have a semi-transparent gray layer over my map, and mask the units on the map based on that, but I have a feeling that tranparent layers over the entire map would severely cripple any system...my only solution I've some up with is to just make it a pure color over the map with 100% opacity...
    - Invulse v1. Genesis .. http://www.invulse.com .. -Chris

  4. #4
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    I would try to work only with solid tiles/sprites. The way it looks now it seems you have some Flash IDE placement approach. So how do you clip away stuff where units have already been before?

    for performance in flash it´s always best to scroll just 1 container instead of multiple sprites/graphics at aonce for the background but I guess you are already familar with that. My idea is that if the map with the FOW doesn´t update that frequently you could use the movieClip.cacheAsBitmap = true attribute to cache the map with the fog on it as bitmap - that should improve the performance dramaticly.

  5. #5
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    performance was pretty nice on my dual core. really nice so far, with some sweet graphics its going to be very nice. Get some nasty ai in there (Nasty to make and nasty in behaviour) and its going to be super sweet. well done so far!
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  6. #6
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Seemed ok on my lowly 2ghz

    I recommend that you distribute non-critical and non-graphical logic across several "frames" rather than all in one. That way you'll keep graphics performance up.

  7. #7
    Senior Member Orkahm52's Avatar
    Join Date
    Jan 2006
    Location
    Perth, Australia
    Posts
    335
    It seems great so far, but I'm not able to really test it because I can't scroll down. I can go left to right however, just not up and down... Am I missing something?

    Good luck with the AI, sorry I can't help you there, I'm not very good at AI myself.

    Edit: I managed to get it scrolling up and down, the problem was my 1280x800 screen wasn't tall enough to see right down to the bottom, so I had to put it in fullscreen. Anyway I got 38-41 fps on my 1.86 ghz laptop with 1GB of ram. I'm using Vista SP1 and Firefox.

    ~Ork.
    Last edited by Orkahm52; 07-31-2008 at 12:45 AM.

  8. #8
    Senior Member
    Join Date
    Jun 2002
    Posts
    178
    Quote Originally Posted by Ray Beez
    Seemed ok on my lowly 2ghz

    I recommend that you distribute non-critical and non-graphical logic across several "frames" rather than all in one. That way you'll keep graphics performance up.

    Can you explain what you mean by this?

    Are you talking about not running all functions every cycle? If so I actually streamlined my code a while back to make the moving code, pathfinding, and a few other pieces based on events rather than cycling functions.
    - Invulse v1. Genesis .. http://www.invulse.com .. -Chris

  9. #9
    Senior Member
    Join Date
    Feb 2003
    Posts
    146
    I would move the bottom scrolling area up to the bottom of the play area. Also, I would pull back the "camera" a bit to allow for more space to be seen by the player at one time. If that's possible, that is.

    As for the FOW, you could just make things not previously seen _visible=false; For terrain objects (more or less permanent) they could simply be turned _visible=true; For enemy units, they could be turned true and false depending on their range.

    I would even include tiles in this example. Just make the movie's background black.

  10. #10
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    I made like 400 troops, selected them, and sent them to the enemy and firefox crashed...
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  11. #11
    Senior Member hatu's Avatar
    Join Date
    Jan 2007
    Posts
    480
    I noticed the same thing as ImprisonedPride, I didn't make 400 troops though
    Seems like you're running the path finding for everyone immediately when you click which causes the game to freeze for that time.
    You need to create some kind of a queue that gets processed smoothly over time and not cram everything into the few milliseconds after the click.
    http://hatu.biz
    Portfolio & games

  12. #12
    Senior Member
    Join Date
    Jun 2002
    Posts
    178
    Quote Originally Posted by hatu
    I noticed the same thing as ImprisonedPride, I didn't make 400 troops though
    Seems like you're running the path finding for everyone immediately when you click which causes the game to freeze for that time.
    You need to create some kind of a queue that gets processed smoothly over time and not cram everything into the few milliseconds after the click.
    I just realized my queue system wasn't working. I actually do have an array of units to find a path for, and it is only supposed to find a path for the next unit after a pathfound event is dispatched from the previous one, but evidently it isn't working.
    - Invulse v1. Genesis .. http://www.invulse.com .. -Chris

  13. #13
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    A queue is one method to what I meant above. I was referring to things like AI, updating stats, etc. An AI doesn't need to be running through it's decision tree every 1/30th of a second. On the other hand, moving graphics have a visual benefit to updating every 1/30th. If AI and other things are really intensive, then split it up across several frames...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center