Search Unity

Third person shooter - Learning project

Discussion in 'Made With Unity' started by TwiiK, Mar 29, 2009.

  1. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    That's a nice and simple fix. Noted.

    However, I'll have to dive into the Unity GUI sooner than later and mock up a proper HUD. :)
     
  2. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    The gun scripts that create the bullet holes seem to work like a charm
     
  3. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    No I can not. Also, your way of asking is crude and borderline offensive. I ignored your PM's because of it.

    You may very well ask me for help with whatever, but asking me to give you my game is not gong to happen. If you're unable to start making a simple game without a complete source code then you're not able to get anything except a blatant copy, if that, out of my source code anyway.
     
  4. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Is there going to be an update anytime soon? I really like where this is going.
    Some ideas ( :D ):
    -Increase the ammount of ammo you get from pickups, for my weapons do not last long.
    -Maybe move the camera to the side of the character, like Dead Space or Gears of War.

    Some problems ( :eek: ):
    -The health pickup stops bullets.
    -My pistol stopped working when I ran out of ammo (obviously), but when I got more ammo, it wouldn't reload (This may be because I was to impatient to wait, for I was being chased by grey things).


    @artimese:
    Anyone on this forum can help you with your game (if you ask), but asking someone to hand over their source code for their game will get you nowhere.
     
  5. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Just wanted to say that it's over a week since I built the latest version of the project and was ready to upload it, but a memory problem is making it unplayable after a few minutes and I won't upload anything until I get it fixed. I have a thread about it in the scripting forum. See if you can give me a hand here: http://forum.unity3d.com/viewtopic.php?t=49562 It will be greatly appreciated. :)

    Basically, my problem is that I'm unable to clear up my used memory after having spawned a ton of objects without restarting the application.
     
  6. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Sorry, but I'm quite new to unity, so you'll know more about solving the problem then I will...

    For now... :twisted:
     
  7. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    The update is ready, but alas it's not playable. I may have to throw in the towel and remove the features that are dependant on it so I can update the project. The memory problem may even be a core technical limitation with how memory handling works, but I'm hoping I will find out of it or that someone will enlighten me soon enough.

    The ammo etc. is very much just a simple test. I will see how I handle it. I will playtest the next update to see how to modify the amounts, but there's no guarantee I will use ammo in later versions.

    I originally wanted the camera to the side, but I wasn't able to script it to work properly. I have a new camera now and I can probably move it to the side, but I'll have to see about it. I have some ideas that I think will work best with the character centered in the image.

    The health issue has been fixed. There's bullet penetration in the latest version and it adds a lot of cool features as well as fix some raycast problems I had. :)

    The pistol issue is still existant because I haven't looked at it. :) Pistols and reloading doesn't really fit into what I have planned for the game so it may disappear soon.
     
  8. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    how was it crude and borderline offensive? you dont know the meaning of crude, all i was asking for the soarce, and a blatant copy is really more than all i need... cause its just the camera that i really like about your game and i just need to use it.
     
  9. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Are you serious?

    You only "need" my camera, but you ask for my source code? Sure, I'll share my camera. I've attached a Unitypackage with my camera and an example scene.

    As you can plainly see it's the default included FPSwalker with the default included orbit camera script and 1 line of extra code to make the player face the same direction as the camera.

    You asked for my entire source code when you were instead interested in one simple thing. I hope you realize that asking for the latter was what gave you results.

    Enjoy.
     

    Attached Files:

  10. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    I totally forgot about this one, but I have attached a unitypackage containing everything that makes the pistol work. It's not pretty, but who cares? :)

    You never answered when I asked what exactly you were asking, but the included pistol has more or less what the pistol in my game has:

    - fires one shot per click
    - reloads when you use up all the ammo in the clip
    - instantiates a bullet and a bullet casing for every shot
    - has muzzle fire effects
    - probably some bugs :)
     

    Attached Files:

  11. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    New version uploaded

    Click the title, image or here to try it out.

    Changes include
    Misc:
    - New sounds on a lot of things
    - New sprites and effects
    - Quite a bit more optimized
    - Control time with the scrollwheel
    - New skybox thanks to the good guys over at 3dattack.us
    - New Sun flare
    - Better aiming
    - Better camera
    - Fixed some bugs

    Weapons:
    - Bullets are affected by gravity and air resistance
    - Bullets can pierce multiple enemies and cover (The last gun shoots through everything)
    - 6 new/changed weapons (don't remember what was in the old update) Pistol, Shotgun, Machinegun, Grenadelauncher, Rocketlauncher and some kind of recoilless rifle

    Enemies:
    - 4 types, the default box, a box armed with a laser rifle, a box armed with a rocketlauncher and a really dangerous big box
    - They can now gib on death
    - Blood splatter when hit

    There's probably a lot more that's been changed because almost everything has been rewritten since the last update.

    I haven't really playtested it much so I have no idea how well it runs or how hard it is. A tip if you're struggling with the difficulty is to slow down time and use the pistol. It packs a punch and is not affected by the slowed time so you can get away and take out most enemies in the process.

    I have however tried it on my own machine: 2,4ghz Q6600, 4gb ram, 8800GT and it runs butter smooth all the way through, including the last wave with 100 enemies on screen at once.

    I also tried it on my old macbook pro: 2ghz, 2gb ram, some kind of ati gpu, x1600 or something. And it ran smooth for the most part. Some hiccups when blowing up a lot of enemies at once, but very playable.

    Feedback appreciated and I promise consequent updates will come more rapidly. :)

    Cheers.
     
  12. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Nice upgrade, especially with the time scale shifter, just askin if your going to change the camera up, like if a terrain is in the way, it comes closer to the player, just to make it look a little more decent, other than that its good.
     
  13. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    I played, and found a couple of glitches.

    Sometimes, the laser shooting guys would get stuck in a position where they could not move, or shoot.

    The most serious glitch: After a few rounds the game slowed down to 3.00 FPS. THREE!
    Everything else on my PC was running fine when that happened.

    Despite the bugs above, keep up the good work! :D
     
  14. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    And another thing, please remove the movable crates and replace them with something static. There was one or two left in the center structure, and I couldn't get to them. I resorted to mindlessly bombarding the center with grenades, but failed miserably.
    Either that or the game ends at wave 4...

    And the plasma/laser gun was removed, right? because I'm still picking up ammo for it.
     
  15. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    I removed the feature that was really causing me memory problems, but still the memory usage increases slightly over time and doesn't return until you exit or restart the web player. I have no idea why this is.

    But what kind of computer do you have? Asking because I never saw anything lower than minimum 20-30 fps on my macbook pro. The last version of the game ran fine for you, but this one does not? For me I could only handle about 50 enemies on screen at once in the old version, but it plays fine with 150 in this version.

    I think there should be 8 or 9 waves. :) I once had the problem that I was able to throw enemies out of the map, but I've added a collider out there now that destroys everything it touches so the enemies should be somewhere inside the map.

    I'll fix the crates. They really don't do anything except add drawcalls at the moment. Maybe I'll even go the extra step and actually create a map in 3ds max, but we'll see.

    I thought I removed the ammo for the plasma gun. I'll fix that right away.

    artimese, I actually think the included Orbitcamera script or the modified one in the scriptswiki does this. I just haven't bothered with it. I'll see if I can fix it in the next update. :)
     
  16. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    I tried it at work now and I didn't collect a single plasma ammo. They were the purple ones in case you mistook the green grenades for being the plasma ammo.

    Also, the framerate never dips for me on this computer. It's constantly 62fps, even when blowing up 20 guys at once in the last wave.

    Btw, there's 8 waves so when you're at wave 9 you're done.
     
  17. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Oh, so the purple ones are the plasma. I though the lightning bolts were for the plasma rifle. I should have know, coz I played Quake 3 for a while.
     
  18. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    You're right, the purple was the plasma in Quake 3 as well, but that's just a coincidence. :)

    The lightning used to be the artilery, but I changed it to the railgun thingy. I will add the artilery as an ability on a cooldown later.
     
  19. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    After more play testing (this thing is addictive), the game glitched at the end of wave 1, when I didn't got to wave 2. I searched the map and found nothing else to kill.

    How does your wave system work?
     
  20. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    It's still more or less a blatant ripoff of the example Spk posted in his Paintrain thread. I have however looked at it and I'm starting to understand most of it. :)

    I can add waves and per wave I can add different types of gameobjects to spawn. So for instance in Wave 4 I have the normal enemy in one slot, the laser enemy in another slot and the rocket enemy in the last slot. Per gameobject I can define how many I want active at any given time and the total amount for that wave. So for wave 4 I have something like:

    Total / Active
    60 / 20 - normal enemy
    15 / 5 - laser enemy
    9 / 3 - rocket enemy

    The enemies are spawned randomly from about 10-15 spawn points at set intervals if there's less enemies in game than the active amount of that type.

    I haven't actually encountered a scenario where I was unable to continue to the next wave after I added the collider outside the map which destroys stuff.

    May I ask you again what your system specs are? And does the game start out running smooth and then progressively start going slower and slower?

    Edit: Actually I can't imagine computer speed and browser affecting the things you mention so I'm almost lead to believe we have different versions of the webplayer installed. I have version 2.6.1.31223 installed both at home and at work. I will download the latest to see if that's what I have.

    Edit: 2.6.1.31223 seems to be the latest. Would you care tell me what version you have? :)
     
  21. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    System Specs:
    Pentium Dual-Core CPU T4300 @ 2.10GHz
    4GB RAM
    Vista *shudder*
    ATI Radeon something-or-other(I actually don't know, but it has 1GB memory :D)

    The game starts out just above 60 FPS, and stays that way. It was when I died and respawned that it suddenly dropped to exactly 3.00, and stayed there.

    Thankfully, this hasn't happened again.

    Webplayer Version: 2.6.1f3 (Checked via the webplayer plugin download page)
     
  22. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Same version then and your computer looks like it's more powerful than my macbook. So I have no idea then why you couldn't continue to the next wave. Quite the conundrum. :) Or just a basic bug. Eitherway, I will get to the bottom of it.
     
  23. showoff

    showoff

    Joined:
    Apr 28, 2009
    Posts:
    273
    I have a question for u TwiiK. How do u get the blood decals on the NPCs. Are u doing the same thing as ur doing with the bullet decals or are u doing something different?
     
  24. dbp

    dbp

    Joined:
    Mar 3, 2010
    Posts:
    324
    best game made in unity i've seen so far. game mechanics are simple but very funny, the enemies are just awesome. make a cooler player model, work out the game balance a bit more, keep timescale at 1.0 and this game is finished imo =D

    thumbs up
     
  25. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Here's the hit part of my bullet code:
    Code (csharp):
    1. void OnHit (RaycastHit hit) {
    2.     Quaternion rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
    3.  
    4.     if (hit.rigidbody)
    5.         hit.rigidbody.AddForce( transform.forward * impactForce, ForceMode.Impulse );
    6.    
    7.     if (hit.transform.tag == "wooshTrigger"  playWoosh) {
    8.         audio.clip = bulletWooshSounds[Random.Range(0, bulletWooshSounds.Length)];
    9.         audio.PlayOneShot(audio.clip);
    10.     }
    11.  
    12.     if (hit.transform.tag == "Geometry") {
    13.         decal = Instantiate(bulletHole, hit.point, rotation) as GameObject;
    14.         Instantiate(impactEffectConcrete, hit.point, rotation);
    15.         PlayImpactSound ("Geometry");
    16.         hasHit = true;
    17.     }
    18.  
    19.     if (hit.transform.tag == "Crate") {
    20.         decal = Instantiate(bulletHoleWood, hit.point, rotation) as GameObject;
    21.         decal.transform.parent = hit.transform;
    22.         Instantiate(impactEffectWood, hit.point, rotation);
    23.         PlayImpactSound ("Crate");
    24.         hasHit = true;
    25.     }
    26.  
    27.     if (hit.transform.tag == "Enemy" || hit.transform.tag == "Player") {
    28.         decal = Instantiate(bulletHoleFlesh, hit.point, rotation) as GameObject;
    29.         decal.transform.parent = hit.transform;
    30.         Instantiate(impactEffectEnemy, hit.point, rotation);
    31.         PlayImpactSound ("Enemy");
    32.         hit.transform.SendMessageUpwards("ApplyDamage", damageObject, SendMessageOptions.DontRequireReceiver);
    33.         hasHit = true;
    34.     }
    35. }
    As you can see all I do when I hit something movable like a crate or an enemy is
    Code (csharp):
    1. decal.transform.parent = hit.transform;
    to make the decal a child of the object hit.

    Thanks. :)

    Models will come when I find a style I like. Why do you want to keep the timescale at 1, if you don't mind me asking? :)

    I'm pretty sure the timescale thing won't stay like that as I'm used to using the scrollwheel for changing weapons in games and I will probably implement that here as well, but I may still include some kind of slow time ability.
     
  26. Saihtam

    Saihtam

    Joined:
    Apr 16, 2010
    Posts:
    24
    This is so much fun! I've been playing it a lot today!

    Fudge the whole "keep timescale at 1". That's one of the best parts of the game. Turn time down to 0, aim gun at an enemy, fire 4 shots, speed up time and it's like you've hit him with a shotgun!

    And I love gathering up enemies with timescale on two, then slow time and fire missiles like crazy! ;)

    Awesome game. Change player model, rest is crazy cool!
     
  27. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    New update

    Changes:
    - Crates removed. Replaced by some static geometry
    - Camera distance changed slightly
    - Howitzer damage increased and now gibs everything
    - Fixed bug which caused rockets and grenades to explode twice.
    - Optimized some parts of the code
    - Increased the size of the colliders of pickups to make them easier to get
    - Removed wave 3 so now there's only 7 waves for the time being

    Click the title or here to try it out.
     
  28. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Agreed.
    (That trick works with the grenades and rockets too :D)
     
  29. dbp

    dbp

    Joined:
    Mar 3, 2010
    Posts:
    324
    the reason why i want a fixed timescale is because the speed is one reason why this game is so much fun. it's just awesome when those huge waves of enemies attack you and you can blow them all up, but if i have the chance to slow down the time and think about which of these guys i should shoot next and where i can escape to, this almost turns into a tactic-shooter, which i guess it isn't supposed to be. i only played a couple of rounds, but i found it just so much more fun when i played at 1.0 timescale or even a bit faster, even if it got pretty hard after a few waves of enemies
     
  30. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Valid point. :)

    Wave based shooters are usually about getting the highest score and being able to slow down the game and/or pause it at any given time doesn't really fit in there.

    So my plan is to either have the slow motion as a depletable resource or rechargeable ability or have different game modes. Maybe one score mode with strict rules and a sandbox mode where you can fool around.

    However, I don't agree with you about the game being almost finished though. :) I have a billion todos on my list including:

    - An experience system where gained experience can be used to upgrade things like health, weapons, abilities etc.
    - Serverside scoreboards
    - Serverside saving of players for persistent play with login and all the stuff this requires
    - A lot more enemy types and massive bosses which shoot all kinds of quirky projectiles.
    - Proper lightmapped levels made in 3ds max to replace the placeholders that are there now. Haven't decided if you progress through the levels or that you choose a level at the beginning and there's different scoreboards, enemies etc. per level.
    - More weapons
    - Proper HUD
    - Ability to change settings, controls, sensitivity etc. ingame
    - Maybe coop/multiplayer (Everything else has a higher priority)
    - Achievements, of course :). Seems to be, without a doubt, the most important feature in any game these days.
    - And probably a whole lot more I'm forgetting at the moment.
     
  31. Jon-Huhn

    Jon-Huhn

    Joined:
    Jan 26, 2009
    Posts:
    85
    Gotta say I'm happy with the fact that the player's view/aiming is tied directly to the mouse input, without any kind of accelleration built into the movement. I hate it when cameras have lag in them, it makes it feel so unresponsive and squishy. This is nice and tight.
     
  32. blobbles

    blobbles

    Joined:
    Mar 22, 2010
    Posts:
    9
    Here is what happened. I got 1050 bullets so I... had fun. (made me feel like solid snake a little) and then I got ambushed by LASERS. :( THEN I decided to use rockets. I commited suicide kinda. :cry:
     
  33. Taintspore

    Taintspore

    Joined:
    Sep 29, 2009
    Posts:
    185
    @Twiik

    I just started really doing anything in Unity a couple of weeks ago so decided to put together a prototype for my own learning purposes.

    I was just browsing the forums and stumbled across this thread. I have to say awesome game/demo/prototype!

    It seems you've solved a problem I've been trying to work out, so I thought I'd ask.

    In my project I've got a bunch of cubes (w/rigidbody + capsule collider components). Their behaviour is more or less the same as in your game (swarm the player, no guns).

    I wrote my own controller script that sets the cube's rigidbody.velocity in fixedUpdate. I put in a grounded state (so they can't change direction unless they're on the ground) which is updated in onCollisionEnter/Exit/Stay (for some reason onCollisionStay is never called).

    The problem I'm having is that the cubes get jittery when they bunch up, and I can't stick nearly as many in the scene as you do without a huge FPS drop.

    Any hints?

    Cheers and again I love the demo!
     
  34. Texel

    Texel

    Joined:
    Dec 25, 2009
    Posts:
    61
    Taintspore, I'm fairly certain Twiik is using character controllers rather then actual rigidbodies for the enemy swarms- Essentially, all you would need to do for what you want is to move when isGrounded is true. Character controllers have relatively simplified physics compared to rigid-bodies (You can't knock them down), so Twiik is probably just swapping them with a rigid-body prefab when he wants to knock them down.
     
  35. Taintspore

    Taintspore

    Joined:
    Sep 29, 2009
    Posts:
    185
    @Texel

    Thanks for the reply!

    That was the first thing I tried but when the cubes surrounded the player it got REALLY choppy when they started pushing on one another to try to reach the player. I think I had between 5 and 16 cubes swarming the player when I tried that. The frame rate I get with what I'm doing now is much better, although the behaviour is slightly off...

    I might have to give it another shot with the character controllers, maybe I did something weird.
     
  36. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    I'm not sure I've posted in in this thread or Spk's paintrain thread, but I actually started out with character controllers for the enemies, but apparently those are horrendously expensive and I could only have a couple of enemies at once before everything started to run choppy.

    You are correct that I am in fact using rigidbodies. It was Spk who gave me the tip after I saw how many enemies he had on screen at once. I'm not sure why you can't have as many enemies as me in the scene at the same time if you're doing it with rigidbodies, but I'm pretty sure it's related to this: http://unity3d.com/support/documentation/ScriptReference/Rigidbody.MovePosition.html

    I'm almost entirely sure I'm using that function to move my enemies and not by changing their velocity. I will give you a proper reply once I get home from work.
     
  37. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4.  
    5. public class Agent : MonoBehaviour {
    6.  
    7.     public Transform target;
    8.     public int rotateSpeed = 2;
    9.     public float moveSpeed = 5.0f;
    10.  
    11.     void Start () {
    12.         if (target == null  GameObject.FindWithTag("Player"))
    13.             target = GameObject.FindWithTag("Player").transform;
    14.     }
    15.  
    16.     void FixedUpdate () {  
    17.         if (target) {
    18.             Quaternion rot = Quaternion.LookRotation(target.position - transform.position);
    19.             float rotationX = rot.eulerAngles.y;
    20.             Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
    21.             transform.localRotation = Quaternion.Slerp(transform.localRotation, xQuaternion, Time.deltaTime * rotateSpeed);
    22.             Move();
    23.         }
    24.     }
    25.  
    26.     void Move() {
    27.         transform.rigidbody.MovePosition(transform.rigidbody.position + transform.TransformDirection(0, 0, moveSpeed) * Time.deltaTime);
    28.     }
    29. }
    30.  
    This is the complete code that makes my enemies follow my player. I've removed some of the oncollision and ondeath stuff to remove the clutter.

    Hope it helps.
     
  38. Taintspore

    Taintspore

    Joined:
    Sep 29, 2009
    Posts:
    185
    Thanks Twiik!

    You've definitely handled rotation more elegantly than I did.

    I'm hoping it's the way I'm moving them around that's the issue. I'll test and post results when I get home.

    Thanks again!
     
  39. Taintspore

    Taintspore

    Joined:
    Sep 29, 2009
    Posts:
    185
    Just tested it out and whaddaya know. I can get about 128 on screen swarming the player before the framerate starts to dive. I've got a boidlike behaviour going (the original slow N^2 algorithm) so with some optimization I should be able to push the framerate higher :)

    Just out of curiosity, did you build in a grounded state for gravity? Using the gravity in the project settings makes everything floaty unless I crank it super high (-981 vs the standard -9.81). That and the for some reason my onCollisionStay never seems to fire...

    Anyway, thanks for the help, I'm not sure why using movePosition made a difference but I'll definitely look into it.

    Thanks again!

    [edit]
    ok that's weird, now -9.81 works fine...
    [/edit]
     
  40. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    The movement code for my enemies is currently what I posted here. I'm not doing any checks to see if they are on the ground. The both turn and move forward in the air. :)

    They wouldn't be able to get over obstacles if I didn't let them fly a little. :)
     
  41. JiffOrange

    JiffOrange

    Joined:
    Mar 26, 2010
    Posts:
    22
    Hi TwiiK,

    Fantastic little game you have here mate, wasted almost an hour this morning playing on it ....simple, elegant but very addictive :D

    I stumbled on your implementation of spawn waves and the link to the other thread. I really like what you are doing here and would like to employ the method myself. However when I start my game after the scripts compile I get this error:

    Code (csharp):
    1. Assets/Scripts/AIScripts/gamedirector.cs(4,44): error CS0246: The type or namespace name `ISpawner' could not be found. Are you missing a using directive or an assembly reference?
    Any idea what it is referring to? I'm not very good with code (learning slowly :) mainly do modeling) and would appreciate any help you or anybody else can offer. I have been using Java mainly before, so perhaps I'm out of my depth with C# but guess you have to try! Anyway fantastic game, reading this thread has been an inspiration to keep going, after seeing your own toils and troubles :D

    Thanks,

    Jiff
     
  42. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    It took me almost an entire day to make Spk's scripts work in my game because his code was way above my level. There's no need for you to go through the same. :)

    I will post an example of my version of his wave system when I get home from work.
     
  43. Taintspore

    Taintspore

    Joined:
    Sep 29, 2009
    Posts:
    185
    I'm hoping that the capsule colliders let them get over little things. :)

    It'll be nice if I can get a jump/mantle/climb behaviour working.
     
  44. JiffOrange

    JiffOrange

    Joined:
    Mar 26, 2010
    Posts:
    22
    Thanks TwiiK, really appreciate it ...yeah it's way over my head too :) I hope one day that I will be able to get to his level of programming expertise :) but I'm some way off. Got to start somewhere though I suppose. Anything I can contribute to repay the kindness (a model or something), don't hesitate to ask :wink:

    Cheers,

    Jiff
     
  45. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    New update out

    The most exciting update since the start of the project in my mind. :)

    I've made no changes to the game, but I've successfully connected my game to my drupal site so you now have the option of creating a user on my site and uploading your high score to have it displayed below the game.

    However, I was unsuccessful in my attemps of using OnApplicationQuit() to upload the high score so for now it's a button in the menu of the game. Click it whenever you want to upload your score. Your newly uploaded score will overwrite your old score if it is higher.

    There's surely some bugs and things are not very polished at the moment, especially the site itself which is just a basic framework, but hopefully things will work.

    I've tested it in the latest versions of Firefox, Safari, Chrome, Internet Explorer and Opera with the latest version of the Unity webplayer and everything works perfectly.

    Remember that you can click the "Click to focus on the game window"-link to hide everything surrounding the game window and get rid of that high contrast white background for a more pleasant experience. :)

    Planned features for logged in users are:
    - Save your progress. Continue your session from any computer
    - Achievements
    - Unlocks
    - Stats
    - Perhaps gifts?

    Guests get nothing! Well, except for the game. :)

    So the site is up (and very basic), the game is hosted on a new link and I've enabled google analytics to see just how many of you there are and how much bandwidth you steal from me. :)

    Click the title or here to try it out.

    PS: I will have to go through my old posts and update the links so some of them may link to the old game for a while.
     
  46. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    @JiffOrange, here's the 3 scripts that makes my wave system work. I looked at them before uploading and I realized I have barely touched them so all the credit should go to Spk for his work on this. :)

    I saw quite a bit of code I don't use in there as well so I may have to go through them and clean them up and properly understand what they do at one point.

    There's 3 things you have to do to make it work afaik.

    1. WaveListeditor.cs must be put in a folder called "Editor" in your Assets folder "Assets/Editor/WaveListEditor.cs".

    2. Define a tag called "EnemySpawn" and add it to at least one gameobject in your scene. If you don't do this Unity will crash. :) In the CollectSpawns function somewhere in one of the files I collect all the enemyspawns and apparently it totally craps out if there isn't at least one in the scene. I just made an empty gameobject and put the robot icon from the 3rd person platformer tutorial on it so I could see it in the scene view and then made a prefab out of it.

    3. Create an empty gameobject and put the SpawnControl.cs and WaveList.cs script on it. If everything is working as it should you should now be able to add waves and wave entries via buttons here now.
     

    Attached Files:

  47. Blacklight

    Blacklight

    Joined:
    Dec 6, 2009
    Posts:
    1,241
    Uh-oh

    Another FPS problem.

    After playing you game on level 3, I reduced the timescale to 0.0, and paused the game. I left for a minute or so, and when I tried to unpause it, the FPS dropped to NaN, then 3.00

    Reseting the game didn't work.

    Hopefully, you can get to the bottom of this.
     
  48. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    You haven't experienced this in any other Unity game? I will try to replicate what you're saying on my macbook which is already on the low end of things. :)

    Small fix to the game site:
    I noticed that if you couldn't fit the entire highscore table in the browser window while playing scrolling the mousewheel would also scroll the page.

    To fix this I changed it so when you press the focus button everything except the game frame is rermoved from the page so it shouldn't scroll the page anymore.
     
  49. Artimese

    Artimese

    Joined:
    Nov 22, 2009
    Posts:
    794
    Excellent change to the game, now we can finally play for highest score! :p

    I had a small favor to ask you, if its possible to post your audio for the machine gun, its near to realistic and i could really use it.

    Thanks, and good job again on the upgrade.
     
  50. NoMaD

    NoMaD

    Joined:
    Feb 1, 2010
    Posts:
    41
    @TwiiK

    Can you please explain why there are 'Total' and "Active' values in the wave script?
    Because if there are 5 total and 2 active it only spawns 2... What's the point in 'Total' then? I'm confused. And I can't get the second wave to start.