Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Tankshooter

Discussion in 'Made With Unity' started by Larsa334, Feb 9, 2011.

  1. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Hi all!


    I've been hanging around here for quite a while now without writing anything,collecting your wisdom and codegems. :D


    I'm working on a multiplayer tankshooter,right now there is only one tankmodel (Panzer VI Tiger),but I'm almost finished with a Sherman Firefly that hopefully will hold its own against the Tiger.

    Networking is taken from Leepos free tutorial,so to play change the name (DITT_NAMN sorry for using Swedish) to something else and start a server (with STARTA SERVER) and if you open 2 webplayers connect as a client with the ANSLUT-button.


    http://dl.dropbox.com/u/20727661/Firefly/WebPlayer/WebPlayer.html

    Tanks controls:

    Movement: Arrowkeys
    Turn turret: A-D
    Move Gun up-down: W-S
    Followcams: U-I
    Turretcam: O
    Reticle/Guncam: P
    Firebutton: SPACE

    As already mentioned in another thread about dynamic tanktreads:

    http://forum.unity3d.com/threads/77102-Dynamic-tank-tracks-Proof-of-concept?

    The choice not to let the Tiger be able to spin on one spot is a concious one,because tanks before 1945 generally couldn't do this without breaking the gearbox.Maybe I will let the Firefly be able to do this to even out the differenses between the tanks in firepower. :p

    The dynamic treads are made with bones that are connected to the wheels who in their turn is controlled by one raycast per roadwheel to follow the ground,and lastly one more raycast from the tanks body to ensure that the wheels only can move a certain lenght from the body to avoid a silly cartoony stretcheffect.Drive around the hills with camera U to see the effect.

    The turning of the tread is done with texture offset.

    The terrain is only a stand-in (sucks).Later I will build a Normandian landscape with bocage.

    Please comment and give me advice how to make a fun playable game.
     
    Last edited: Mar 15, 2011
  2. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Some pictures:






    Shootin'




    Dynamic treads that follow the ground using bones and raycasting.




    Working reticle in original style











    Right now I'm working on the textures for this Sherman Firefly.A worthy opponent to the Tiger. :)
     
    Last edited: Feb 10, 2011
  3. wertymk

    wertymk

    Joined:
    Dec 13, 2009
    Posts:
    104
    That's a great start. Reminds me of my learning project (http://koti.mbnet.fi/marwer/tankshock.html), which was a bit more action-oriented. I was also looking into dynamic tracks but gave up and just did the texture offset thing. Do you have any kind of damage model, or do the tank just have health?
     
  4. granada

    granada

    Joined:
    Oct 31, 2010
    Posts:
    135
    My type of thing this :D,you could make the reload a bit faster.Nice picture of a shell when reloaded.I like to use the mouse to fire.But it has a great look to it allready.I play this demo a lot( http://www.fancygoal.com/game.html )It might give you some more ideas to help you along.

    Dave
     
  5. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I actually played your game a long time ago when I was lurking around here without writing anything,so I'm not at all surprised to find that some elements are the same hehe. :)
    I havent had the time to implement a damagemodel yet,but I'm planning on one with different "damagezones".
    A hit in the motor maybe takes away 10 hitpoints while a frontal hit only is worth 2 because of the thick armour.
     
  6. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Thx for the great link and the kind words!
    I immediately saw some things I can "borrow". ;)

    The thing is that a skilled loader could load the 88gun in about six seconds.Maybe I shouldn't call my demo a shooter but a tanksimulator instead haha.It is all part of the balance of not making the opponent too weak.I'm planning on making the Firefly much faster and manouverable than the Tiger but with less armour (just as it was in reality).

    The GUI-graphics I have now is only stand-in to test the function.The next big thing is to build a small French town with fields and stuff,cause I'm getting real tired of driving around on a golfgreen all the time!
     
  7. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Todays updates:

    1.The tank can now rotate on the spot when standing still.Not the modern way when the treads move in opposite direction,but breaking one tread and letting the other drive the tank around.
    To make this convincing (hopefully..), I made a separate pivotpoint for each tread and the used transform.RotateAround in combination with if statements to make it work.The "rotationmode" switches back to normal when the tank moves over a certain speed.

    I'll fix the treadUV-animation later.


    2.I put a windzone in the explosionprefab so that the trees bend when they are in the "zone". :)
    Unfortunately I haven't found a way to let the wind fade out.Now it's just a timer that destroys the prefab.This causes jerky motion.
    Does anybody know how to solve this problem?It seems like windzones not was meant to be used this way...




    Link to the newest build:

    http://dl.dropbox.com/u/20727661/Firefly/WebPlayer/WebPlayer.html
     
    Last edited: Mar 15, 2011
  8. alonzo

    alonzo

    Joined:
    May 20, 2010
    Posts:
    63
    that's a really cool project, I like your progress so far. the colision between the tank barrel and a tree would be nice, too ;) because the tank is already coliding with the tree - I'm looking forward to see more of your work
     
  9. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Yeah!So you noticed that! ;)

    I have a configurable joint between the turret and the body to make things a little "bouncy" and when I added a collider to the barrel and smashed into a tree the whole thing began to spin around like a propeller,so I hoped nobody would notice *lol*.

    Thx for the kind words!
     
  10. justicar

    justicar

    Joined:
    Dec 21, 2010
    Posts:
    78
    Great work so far. I'd like to discuss with you turning this into a full game.
     
  11. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Very nice Larsa334.

    Some Tiger tank feedback for you, if I may.

    The optic is very good, though in the real Tiger you move the triangle down (strich) then you put the tip of the triangle back on the target, therefore elevating the barrel. As it is at the moment the shot always goes where the strich is.

    The recoil of the main gun should be at the first joint after the mantlet.

    A camera that was pan-able around the tank would be very nice, so we can see those tracks in action :)

    There is a very good description of how the TZF9b optic in the Tiger works here:

    http://pedg.yuku.com/topic/1728/t/Ranging-Turmzielfernrohr-TZF-9b-gun-sight-optics.html

    Jeff
     
  12. WebWolfRussian

    WebWolfRussian

    Joined:
    Feb 5, 2010
    Posts:
    123
  13. LoneWolfGabo

    LoneWolfGabo

    Joined:
    May 6, 2010
    Posts:
    172
    Hey very nice proyect you have here.
    There's something that i really need to know. How did you do the tracks movement? did you did it as an animation or is it scripted?
     
  14. Veli

    Veli

    Joined:
    Mar 10, 2009
    Posts:
    301
    Reminds me of Reign of Steel, but still a bit of a journey to go. Good luck anyway :)
     
  15. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Yes,you may! :)

    Sorry for the late answer,I've had the flu for almost a week now,first day out of bed.


    Great link!Thank you very much.
    Do you also happen to know how the Fireflys reticle looked and how it worked?

    I have now uploaded a new webplayer with the camerasolution that WebWolfRussian suggested.

    http://dl.dropbox.com/u/20727661/Firefly/WebPlayer/WebPlayer.html

    The twitching is also taken care of now,there was something wrong with the lerpfunction in the camerascript.
     
    Last edited: Mar 15, 2011
  16. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
  17. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Hehe,for example,the whole of Normandie is currently missing!! :)


    I will soon add the Firefly.Texturing is almost complete,the treads still looks like they are fresh out of the factory and one turrethatch is missing.
    I will also add normalmaps to save some triangles.The model now weighs in at 8000 tris.Mostly because of the suspension.



     
    Last edited: Mar 3, 2011
  18. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Hi Larsa334

    pm sent :)
     
  19. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I have finally imported the Fireflymodel into Unity.Worked very well!
    The only problem now is the suspension.
    The roadwheels are mounted in pairs as opposed to the Tigertank where every roadwheel is separate and can move independently.
    Don't know if I'll separate each half of the suspension and fake it or use a hingejoint to make it more realistic...

     
  20. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Like the look of the Firefly Larsa :)
     
  21. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Thx!!The textures are almost finished now,still no normalmaps.

    The suspension gave me a little trouble as expected...I went for the easiest solution and broke the suspensionarms up in two and parented the halves to the neareast wheel.I don't think that it is that noticable that it is fake.
    You probably won't be looking at the wheels that much when there are Tigertanks in the vicinity. :)

    I made the Firefly much lighter and faster than the Tiger,the suspension is also looser.Try it out in the new webplayer.

    The sounds and the reticle is still the same as the Tiger.I will fix that soon.

    Firefly Webplayer:

    http://dl.dropbox.com/u/20727661/Firefly/WebPlayer/WebPlayer.html

    Suspension in action right before a big jump:
     
    Last edited: Mar 15, 2011
  22. Mike L

    Mike L

    Joined:
    Sep 14, 2010
    Posts:
    1,035
    hmm, every time i try to do this, i get this

    $Screen shot 2011-03-12 at 15.50.25 .png
     
  23. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Yeah,I know.There is no camera in the scene until you start a server and spawn a prefab so what you see is probably some "leftovers" in videomemory.

    All you have to do to start the game is to fill in your name in <DITT NAMN> and press STARTA SERVER (Swedish for your name and start server,I know,I've got to change it to English!! :D).

    Drive with arrowkeys
    Turret-turn A D
    Gun up/down W S
    Fire SPACE
    Cameras U I O P
     
    Last edited: Mar 13, 2011
  24. Mike L

    Mike L

    Joined:
    Sep 14, 2010
    Posts:
    1,035
    ok, cool
     
  25. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I've changed the Swedish text to English now.

    If you open two webplayers as server/client each one gets a different tank! :)
    The server get the Firefly and the client get the Tiger.
    It would be fun to flip coins who get which tank haha.

    I noticed that I forgot to sync the Fireflys gun up/down in the networkview,the time is 02.16 in the night here so I fix that another day.....
     
    Last edited: Mar 13, 2011
  26. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Lars, you are doing a great job. If you want an Allied optic I have created one, it is not the Firefly's but it is Allied :) Is it possible to have a drivers view?

    Jeff
     
  27. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    You are too kind! :)

    I really would like the Allied optics!
    In the end I probably will make a correct Firefly-reticle,but I'm more than happy to use yours as a stand-in.

    A drivers view is very tempting to do! :)
    But,before that I will concentrate on the scenery!

    The question is what kind of game this will be.Is it a multiplayer where a whole team of people handles one tank or is it one where a single person handles the whole tank by himself.I don't know now.
    In the latter version the driver seat would practically have no purpose besides the "flashy" graphics.

    The map is very booooring now so I'm gonna build a couple of square miles of fake Normandy. :)
     
  28. murkz

    murkz

    Joined:
    Dec 26, 2009
    Posts:
    19
    Sent as SVG (inkscape) format :)
     
  29. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Uploaded a new webplayer after a couple of bugfixes.There was something wrong with the turretrotation in the last one.
    In fact I noticed that the bug had been there all the time!The only reason I didn't notice it was the slow rotationspeed of the Tigers turret.

    Both tanks now works in networkmode.Hits registers and an explosion + sound plays.
    The bug was that I was observing the prefab instead of the script...
    Now the turret and the barrel updates like they should on the clients side.

    http://dl.dropbox.com/u/20727661/Firefly/WebPlayer/WebPlayer.html
     
    Last edited: Mar 15, 2011
  30. Zylex

    Zylex

    Joined:
    Nov 25, 2008
    Posts:
    204
    Why don't you just reduce the radius over time or the wind strength?
     
  31. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    As I understand it you can not acess windzones directly,at least not in Unity version 3.1 (which I am using),but I can be wrong.

    EDIT:That is the component windzone,not the gameobject!
     
    Last edited: Mar 13, 2011
  32. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I made a reticle for the Firefly.There is still a lot of work left to make the gun hit where you are aiming.
    Normalmaps are also applied.

     
  33. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,998
    Look, I flipped over, but I can still drive!!!

    $whoops.PNG
     
  34. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    You didn't happen to bump into a tree did you? ;)
     
  35. Rush-Rage-Games

    Rush-Rage-Games

    Joined:
    Sep 9, 2010
    Posts:
    1,998
  36. Majatek

    Majatek

    Joined:
    Apr 17, 2011
    Posts:
    19
    Nice, but you do know that tanks can travel slightly faster than that ;)
     
  37. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    Yeah,but there is no point travelling any faster when the scenery look exactly the same wherever you go and there is a huge risk you'll go over the edge of the world. ;)
     
  38. the_professer22

    the_professer22

    Joined:
    Mar 3, 2011
    Posts:
    42
    neat... uh... can i have a prefab of the tiger?
    i am also building a tank game as a first project, and am having a lot of trouble getting my tank model to import correctly.
     
  39. thundercat

    thundercat

    Joined:
    May 9, 2010
    Posts:
    15
    Ditto - although my issues are with local vs global rotation of the turret, and another problem I'm putting off is texturing offset animation of the tracks. It's not a Unity issue I'm having, it's more to do with Google Sketchup where I'm making the tracks and the textures for the track segments not all being aligned in the same direction... meh. I'm trying to put off fixing the problem by focusing on other issues though. ;-)
     
  40. EpicTwist

    EpicTwist

    Joined:
    Apr 19, 2011
    Posts:
    83
    Is there an aimer of some kind? I joined a somewhat server and no one is playing. Could someone come online? :3
     
  41. jesseoffy

    jesseoffy

    Joined:
    Feb 20, 2010
    Posts:
    146
    Add boundaries. Otherwise I might *cough* just fall off the map. ;)
     
  42. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    The whole meaning with ones first project is to learn how things work.Sorry,but I don't want to ruin your learningexperience by simply giving away my model that took me about 2 weeks to gather information on,find good blueprints and about 30 hours to build. ;)
     
  43. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I had the same problem.Use local coordinate system:

    Turret.transform.Rotate(Vector3.up * TurretTime, Space.Self);
     
  44. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I'm not sure that you will be able to connect to a computer outside the LAN that the server is connected to.
    This demo builds on M2H's free zero the hero tutorial and is therefore somewhat limited.
    For testingpurposes it works great to open two webplayers and control both tanks yourself,but I wouldn't call it a great gamingexperience to play that way! ;)
     
  45. Larsa334

    Larsa334

    Joined:
    Jan 7, 2011
    Posts:
    39
    I will try to make a playable game out of this when I get the time. :)
     
unityunity