Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

C&C style RTS Community Project - Generals

Discussion in 'Works In Progress - Archive' started by Martin-Schultz, Feb 6, 2009.

  1. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    UPDATE TO VERSION 1.1 (august 2009)

    I'd like to share a Unity project that I have sitting on my disk for some time now. Idea was to create some kind of "Command Conquer - Generals" style RTS clone as pet project and as there was this nice competition over at TheUnityArtist.com (here and here) created by Thomas Pasieka I thought about releasing my work so far for free and try to make a community project out of it. So anyone is welcome to download the current little RTS demo project, improve it, send improvements back to me and I make new versions available for all again.

    If that sounds interesting to you, please check out here the first version:

    Current version is 1.1
    http://www.decane.net/external/generals/Generals_Community_1.1.zip (133 MByte)

    Older versions:
    http://www.decane.net/external/generals/Generals_Community_1.0.zip (101 MByte)

    Play it online here:

    http://www.decane.net/external/generals/index.html
    Please not that this webplayer uses right-mouse clicking too for moving on the map, deselecting units and such.

    All the art assets from this game are free for personal and commercial use. Only thing asked for is: Give something back to the project if you like it. That's all. If you have an improvement, send it in to me, I'll patch the current version and make a new download zip available for all, right here in this thread.

    Screenshot:


    It's a lot what is needed for the project:
    - Nice buildings
    - Map with fog-of-war
    - Vehicles
    - Particles systems
    - Sounds
    - Code! Unit formation code with a unit priority system, path finding, basic AI code
    - Menu and game interface
    - Some music is already included, but maybe more?

    Anyone interested in joining this project and work on it as pet project?

    Best
    Martin
     
    OvenproofSet390 likes this.
  2. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Haven't checked out the source, but from your list I gather you've already covered AI opponents?
     
  3. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Hehe, seems I wrote it misunderstandingly... no, what I mean originally was if you or someone familiar with your path library would be interested to put in path finding. I'll correct the above text. :)
     
  4. WebGameScratches

    WebGameScratches

    Joined:
    Feb 1, 2009
    Posts:
    2
    Looks sweet. I am a really big fan of Generals and Generals Zero Hour. I hope that this project will be realeased someday as a ready-to-play product.
    Can you upload made music anywhere separately?
    Thank you for making it.
     
  5. akabane

    akabane

    Joined:
    Apr 26, 2007
    Posts:
    143
    I'm making a RTS project myself, and i'm starting to create something with the help of some friends and the unity chat members, since i'm not a programmer.
    Right now i'm at creating buildings on terrain, when it'll be finished and polished i'll pm you :)
     
  6. amcclay

    amcclay

    Joined:
    Aug 8, 2006
    Posts:
    143
    Hey Martin, I can't thank you enough for sharing this project. I'm struggling to make a 3D point-and-click puzzle / adventure game and this is a huge help as a I'm just trying to come to terms with the physics stuff.

    I'll be sure to post anything that I think might contribute to the system, though I'll more likely be taking things out than putting things in, I still might come up with something that could help.

    Thanks again!
     
  7. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Glad to hear the project helps you! You're most welcome! :)
     
  8. Train

    Train

    Joined:
    Apr 22, 2008
    Posts:
    344
    Hmm...i have a theme music, but at the moment the game have no main menu. But i have shot sfx for this project and explode sounds. All is done at ready to use.
     
  9. TomDOW2

    TomDOW2

    Joined:
    Jun 26, 2009
    Posts:
    7
    I have always wanted to make a Supreme Commander style game - this will be a fantastic help. I`ll try to make a menu system but cannot promise much.
     
  10. TomDOW2

    TomDOW2

    Joined:
    Jun 26, 2009
    Posts:
    7
    I cannot extract the zip file - I don`t know why gut it keeps telling me that "There is already a file of the same name in the folder specified, please choose another name" does not matter where I extract it to - it still does not work. I have had this problem on Windows Vista Home Premium (newest Service Pack) and Windows Vista Ultimate (newest Service Pack)

    Please could you post a non zip file
     
  11. TomDOW2

    TomDOW2

    Joined:
    Jun 26, 2009
    Posts:
    7
    I tried extracting it using Z Zip. It told me that the host OS was Unix, does anyone have a working windows copy?
     
  12. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Update to version 1.1!

    Lots of code cleanup. The unit manager got cleaned up and works now via a singleton instance. The unit selection script got fixed and cleaned too and works way better now.

    Also fixed is that the selection rectangle work now regardless from where you start to draw it. It uses now a texture instead of a gui rect. The unit selection is now done while the mouse is beeing dragged and not anymore only when the mouse button is released, so more like a "live selection".

    You find the new download link in the first post of this thread.

     
  13. MadMax

    MadMax

    Joined:
    Aug 5, 2009
    Posts:
    203
    Well it is a lot better now. However, it still has a problem where if you select a unit it does not always follow your move orders. At least now, it seems too un-select the unit when it has this behavior. Still this is very annoying and buggy.
     
  14. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Ah yes, a small change. It needs the same "blur" clicking function like for the right mouse button, then it's smooth.
     
  15. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    I've re-uploaded V1.1 withe a smooth factor for the left/right mouse button selection. Should work better now.
     
  16. rawrman2381238

    rawrman2381238

    Joined:
    Jan 28, 2008
    Posts:
    122
    What about the great music? Are we free to use it in other projects along with the art?
     
  17. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Yes, it's free for commercial and non-commercial use. The only thing I ask for is to get credit for the music or art if possible. :)
     
  18. Alvarus

    Alvarus

    Joined:
    Apr 10, 2009
    Posts:
    203
    I've been meaning to download this to take a look, since I'm working on an RTS. Great idea, though. I'm PMing you my contribution, one fairly decent building.
     

    Attached Files:

  19. Alvarus

    Alvarus

    Joined:
    Apr 10, 2009
    Posts:
    203
    It's not the greatest, but it should work. Sent in a tank for the open source RTS project. Same terms as Herr Schultz, please credit me if using my artwork.
     

    Attached Files:

  20. Volumunox

    Volumunox

    Joined:
    Nov 4, 2009
    Posts:
    1
    I like the idea of a community project and i'm thinking of contributing something.

    Do you have a specific style in mind ?
    And what would be your polygon limit on the different objects of the game ?

    i've been meaning to do some 3D again.
     
  21. marvinhawkins

    marvinhawkins

    Joined:
    Oct 3, 2009
    Posts:
    55
    Hi!

    Thanks again for this great boost Martin! I've been trying to add combat to this mod. It's not much but I'm trying to create a function that "kills" a unit when he's hit by an object with the tag "missile" that comes out of the Turret. logically I tried to Destroy the game object that got hit. Unity doesn't like that. I get an error message. (Null Reference) For now I have just "moved" the tanks hit. I get some type of weird era too. What I want to do is remove the game object once he takes enough hits. Only problem is for now each unit is using the same script.

    So the question: How can I remove the hit object without causing a Null Error.

    Here's the code:

    Code (csharp):
    1. function OnCollisionEnter (collision : Collision)
    2. {
    3.  
    4. if  ( collision.gameObject.tag == "missle")
    5.    
    6.       {
    7.     Destroy (gameObject);
    8.     print("Hit by a missle");
    9.     transform.Translate (Vector3, x, y, z) ;
    10. //var attackedunit = gameObject.GetComponent(Transform);
    11.  
    12.     }  
    13. }
    14.  
     
  22. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    hey, I'm working on a game involving hits/destroy, etc, my code goes something like this:


    function OnTriggerEnter (other : Collider)
    {
    if (other.gameObject.CompareTag ("Missile"))
    {
    Destroy(gameObject);
    }
    }


    That's about as simple as it can get, works just fine for me! This code would be placed in the tank's script somewhere, thus the " if other = "missile" ("other" is whatever hit us), and then "destroy game object" (destroy whatever object this script is on).

    Hope that helps!
     
  23. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    addition: I'm still very noobtastic with programming, but I would bet your error was called by FIRST calling the "Destroy" command, THEN calling the other stuff.

    Can't call commands on something if it has already been destroyed! :p

    (could be completely wrong though...haha)
     
  24. XFunc_CaRteR

    XFunc_CaRteR

    Joined:
    Jan 3, 2010
    Posts:
    7
    Don't bother with "fog of war" - as in black areas on your map. You don't need it. Using darkness to represent fog of war is an artifact that appears only with Civilization - all the RTS's inherited that idea from that game, but it didn't exist as a visual concept prior to that.

    True fog of war is just the idea that you can't see the position of enemy units. But in a modern battle you should ALWAYS see the map. Why? Because you are a general: you have a map of the battlefield. You're not exploring, you're fighting a battle.

    Just make a map, and if the unit is not visible, leave it undrawn. That's all the fog of war you need.

    World in Conflict, for example, works fine using this very system.
     
  25. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    what? no fog of war? Obviously, it is just something made up arbitrarily long ago by the Ancient Ones of RTS games, but it does serve good purpose! At least to my mind, having the fog tells me that I cannot "see" units in that area- otherwise I'm liable to overlook huge areas of terrain, because they look exactly like the rest, and then suddenly units start popping into existance along that line? Not cool, not realistic, not fun. (in my opinion).

    This project needs a revival! I think a LOT of people would be interested, but sadly no real progress :(
     
  26. Martin-Schultz

    Martin-Schultz

    Joined:
    Jan 10, 2006
    Posts:
    1,377
    Feel free to add your improvements back into the project.
     
  27. yahodahan

    yahodahan

    Joined:
    Apr 26, 2009
    Posts:
    1,380
    haha, I know, I know- I'm all problems and no solutions!

    soon as I have time (tonight?) I have several goodies to add!
     
  28. jin76

    jin76

    Joined:
    Mar 4, 2010
    Posts:
    364
    hey guys, i like ur game, and it insipired me to make my own rts style game. i was having trouble making a group select and move with mouse script, i know the functions are in the vehicle script, but i could not seam to seperate it from the other vechile stuff that i dont need can some one please help me to get the parts i want or tell me how to make a new select and move with mouse scrpt similar to this.

    thanks again for sharing ur project its great help to teaching noobs like me.

    any help would be great.
    thanks :D
     
  29. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,551
    Last edited: Oct 31, 2011
  30. TobiasLingen

    TobiasLingen

    Joined:
    Jul 29, 2008
    Posts:
    13
    at underdog:
    This fog of war is really nice...

    at Martin:
    Did you implement Pathfinding in your project already? If not, take a look at Aaron Granbergs A* pathfinding 2.5. It works great. I tried it with my own RTS-project, and the only thing I had to do, was to write a few lines of code.
    It shouldnt be difficult to implement it in your project either.

    My next step in my own Project will be to avoid collision of multiple moving units. I thought about crosschecking the paths of the units, but this would need an additional variable at each point of the path, which contains the estimated time the unit will be at this point. Then I can compare all paths and for example order a unit to stop for a while or find a way around... I am not happy with that... I think, I have to rethink the whole thing...
    But maybe someone has a better idea?
     
  31. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    You better don't do individual paths right from the start.

    Create dynamic flocks (force areas, softbody blobs or whatever you want to call them) and search a path for them and then make the ai resort local movement constraints between each other.

    If you have an AIGameDev premium subscription you will find a few interesting videos / classes on how the devs of Demigod / Supreme Commander approach it as well as a Blizzard way of doing it related one.
     
  32. zergmouse

    zergmouse

    Joined:
    Jun 30, 2010
    Posts:
    216
    sorry to necro this thread but I had a question about the healthbar prefab.

    The healthbar prefab has two elements "health" and "background" ... ok well background exists but I cant find the Health peice anywhere. I think it is supposed to be embeded into the prefab but it is not in v 1.1

    This is causing alot of problems trying to port this into my environment. I tried to make my own health element but i keep getting the error "Prefab "GameObject's can not be made active"

    any advice?
     
  33. CrazeDevelopment

    CrazeDevelopment

    Joined:
    Nov 26, 2010
    Posts:
    22
    Sorry, for yet another Necro(I'm sad this topic died at all)

    I am also curious about the healthbar prefab and code, I have attempted to replicate it... and modify it, however it gives me a host of errors...

    I am interested in continuing development in the RTS area for Unity, I am not interested in purchasing a $200 prefab from some group, that is not really built around my needs.

    I suggest actually reviving or rebuilding a thread for this type of project. This genre of game is still popular and I am extremely surprised to find a very, very large lack of projects or documentation on this type of project.

    If, however, the revived conversation and development already exists, I'd love to be linked to it.

    Thanks,
    Craze.
     
  34. tet2brick

    tet2brick

    Joined:
    Jun 24, 2009
    Posts:
    77
    Hi,

    Just to thank Martin for sharing this project, I needed a group select system and I adapted it to my needs, great work and many thanks :)

    I used a different approach for knowing wich unit is selected, when the camera rotates sometime with your code units where not selected on the fringe of the 2D rectangle, but were inside it, I finaly used a "point-in-polygon" function based on the 4 raycast casted by the 4 corners of the 2D rectangle

    (if that interests someone : http://forum.unity3d.com/threads/69067-Rts-unit-selection-problem )
     
  35. pixelone

    pixelone

    Joined:
    Apr 16, 2010
    Posts:
    157
    @ Martin Shultz - Great work. I downloaded it yesterday to play with it. Although it's just the two tanks it was quite entertaining. :) I play Halo Wars so I know how far this can go. Where is the project now? I would love to see how far it has come. Thanks again. I was more looking to do an RTS on the iPhone/iPad.. something about having "total war" in the palm of your hands. Cheers mate!
     
  36. dpas69

    dpas69

    Joined:
    Dec 30, 2010
    Posts:
    1
    Anyone know how to convert the code so itll work on android and iphone? would really appreciate it :)
     
  37. enyllief

    enyllief

    Joined:
    Oct 17, 2010
    Posts:
    36
    Truly... awe-inspiring. Thanks for the project.. it'd be nice to improve it. Anyone started toying with it? BTW, the conversion to the newer version of Unity is a piece of cake. ;-)
     
  38. gamenut30111

    gamenut30111

    Joined:
    Nov 7, 2009
    Posts:
    399
    Yeah, this project is really what led to mine. You can still see elements of this in mine. Amazing job!
     
  39. BillG

    BillG

    Joined:
    Mar 2, 2011
    Posts:
    13
    Is this community project dead? I am new to Unity. I have been a C# programmer since 2005 and before that C and C++ and have been in the IT field for over 25 years. Yes, I am an old man.

    Bill
     
  40. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Dead is relative.
    Its there but the community always only took part to a very little degree, but I'm sure with a few pushing in there will be much more movement again
     
  41. flashknight33

    flashknight33

    Joined:
    Mar 1, 2011
    Posts:
    1
    Hi ,i'm flashknight33 leader of c&c the vortex mod for gen.zh
    www.moddb.com/mods/mina-raouf
    i like the idea and i would love to help :) ,if u need models u can pm me here or at moddb ;)
     
  42. salsicha

    salsicha

    Joined:
    Mar 3, 2011
    Posts:
    4
    This thread may be dead, but I just started learning how to use Unity. I like strategy games so this project seems like a great jumping off point. I've made the following changes and will probably make more in the near future:

    shells do damage
    health bar shrinks
    right click selects target (instead of moving camera)
    w-s-a-d moves camera, q-e rotates camera
    added mini-map and 'blob' models for mini-map camera

    I will probably get multiplayer working, and maybe some A* pathfinding, but AI is beyond my scope.

    Alex

    http://presentcreative.com/Generals_Community_1.2.zip

    Unity3D 3.3 required.
     
    Last edited: Mar 17, 2011
  43. leonardoaraujo

    leonardoaraujo

    Joined:
    Jun 3, 2010
    Posts:
    87
    Hi salsicha I think that the link is broken.
     
  44. salsicha

    salsicha

    Joined:
    Mar 3, 2011
    Posts:
    4
    Try using Firefox
     
  45. salsicha

    salsicha

    Joined:
    Mar 3, 2011
    Posts:
    4
  46. Deleted User

    Deleted User

    Guest

  47. Havok

    Havok

    Joined:
    Aug 21, 2009
    Posts:
    36
    It will be a great pity if this project dies.
    I think that the scripts in here is huge in terms of learning not to mention the fact that it could very well become THE resource for people wanting to make RTS games.
     
  48. Kyzyk

    Kyzyk

    Joined:
    Mar 14, 2011
    Posts:
    205
    lol at how old this thing is...
     
  49. salsicha

    salsicha

    Joined:
    Mar 3, 2011
    Posts:
    4
    Anyone else interested in collaborating?
     
  50. RoDester

    RoDester

    Joined:
    May 21, 2011
    Posts:
    64
    How maybe I could help with some easy models in my spare time?

    Im no scripter, really bad animator, and I can do some decent no organic models, like simple boats and stuff.

    Hope you get network working.

    How do you make the unit shoot shells?

    And damage?

    Some example of a model I did.



    Althow sometime they dont export well, and sometimes the models mesh doesn´t work and textures.

    Hope you expand the game :)