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

Jarheads

Discussion in 'Works In Progress - Archive' started by GarethIW, Aug 18, 2014.

  1. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Jarheads (Work in progress)

    A squad-based action/tactical shooter with voxel destruction. Full campaign mode (single player or two player online co-op) and online multiplayer with a variety of modes including Deathmatch, Team DM, CTF, King of the Hill and more.

    I'm a one-man-band and I've been developing the game on and off for a year now. The game started out in XNA/Monogame and I recently (beginning of July) ported it over to Unity. This is my first Unity project.

    I've been building the game multiplayer-first, and have only recently started working on the campaign side of things starting with enemy soldiers and AI. I have lots of plans for different mission types, vehicles and turrets, and other multiplayer modes.




    I've just had a three-week sprint on porting the map editor over to Unity, taking advantage of nGUI to make it a little more user-friendly than the Monogame version was. Here's a video of the editor plus a couple of minutes of testing/walking around the map at the end:


    I'll post semi-regular updates here, twitter and tumblr. Please feel free to ask any questions!
     
  2. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Hey GarethIW

    I absolutely love the art style. Naturally you're not making your levels out of thousands of cube GameObjects; how do you go about creating your worlds? Do you use procedural geometry?

    Thanks,
    Ves
     
  3. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Thanks!

    It's a voxel engine, so yes - procedurally generated meshes. You can kinda see it in action in the editor in this shot. Each chunk is 32x32x32 voxels. The maps are loaded at runtime from a custom file format that the editor outputs.

     
  4. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Playing about with the AI. All working in online co-op as well, thanks to the awesome Photon.

     
  5. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    Are you networking the voxels? Is this a nightmare?
     
  6. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Yeah, the voxel destruction is all networked. The master client deals with explosions and keeps a buffer of all voxels that have been destroyed since the last update. Additionally, each client keeps a record of all voxels that have been destroyed since the start of the game.

    Every update, if there's been any destoyed voxels, the master client sends out batches of V3 arrays (xyz co-ords of destroyed voxels) to each client.

    When a new player joins, the master client streams the "all destroyed voxels" list to the new player, so they enter the game seeing the landscape in its current state.

    If the master client leaves, the newly-assigned master client will already have the "all destroyed voxels" list, because every client keeps that list in memory.

    ----

    Progress update: Working on a new title/main menu scene, using 4.6 uGUI to make a multiplayer game browser:



    During a project, I like to switch between the "boring" stuff like this and the fun gameplay stuff to keep things interesting. Prevents burnout at the end when you've got all your mechanics in place but still have to design 50 levels, make a tutorial and a title screen and menus and all the other "final 10%" stuff :)
     
    VesuvianPrime likes this.
  7. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Making great progress with the 4.6 UI stuff. I think I've outdone myself...

     
  8. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    A long multiplayer deathmatch test session. Still a few issues with explosions to iron out, but it's getting there.

     
  9. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    More messing about with new UI, this time to display objectives while loading. This was nice and easy using the UI masking component.

     
    VesuvianPrime likes this.
  10. VesuvianPrime

    VesuvianPrime

    Joined:
    Feb 26, 2013
    Posts:
    135
    I never thought to ask: how do you handle collision?
     
  11. LightSource

    LightSource

    Joined:
    Sep 29, 2012
    Posts:
    249
    I can dig it.
     
    GarethIW likes this.
  12. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    cannon fodder. classic game.

    dont care for voxel stuff myself but looks like a solid effort
     
    GarethIW likes this.
  13. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Manual ray/AABB checking of the chunk/voxel arrays.

    I tried using MeshCollider, but it takes too long to generate intially, and you can't seem to update the collision mesh when you change the MeshFilter mesh. And even if you could, that would probably take too long as well!
     
    VesuvianPrime likes this.
  14. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
  15. FrischGebraut

    FrischGebraut

    Joined:
    Jul 24, 2013
    Posts:
    28
    The game looks awesome :)
    Also the your voxel engine seems to be really performance efficient. Are there any advanced tricks you use to get this kind of performance? Somthing like threading, greedy meshing, culling etc.
    Really looking forward to this game ;)
     
  16. randomperson42

    randomperson42

    Joined:
    Jun 29, 2013
    Posts:
    974
    Nice job, the game looks very fun.
     
  17. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Reminds me of Cannon Fodder! Would love to play this!
     
  18. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Hey thanks all. A lot of people have asked me about whether I'm releasing the engine that I'm using for Jarheads. My original answer was "I will, but not until after release the game". But it got me thinking about it to the point where I started experimenting over the holidays.

    Last night I submitted PicaVoxel to the asset store. While it's not exactly the engine used in Jarheads, a lot of the things I learned about voxels and optimising during the making of the Jarheads engine were put into PicaVoxel. And now I've learned a whole lot of new stuff that I'll be taking back to Jarheads going forward!

    Jarheads also went into Alpha over the holidays. You can play a five-mission slice of the campaign, as well as multiplayer (although it's not very active right now so you'll need to grab some friends!) over at the Jarheads website.

    I'll do a proper post about PicaVoxel when it gets through submission. Fair to say that for the rest of the year I'll be splitting dev time between PV and Jarheads.
     
  19. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    So here's the thing - the game started out in XNA/Monogame so I had to do all of the rendering myself. When I bought the engine over to Unity it actually slowed it down a fair bit due to the slight delay you get when setting the mesh data back to the MeshFilter.

    I use threading to do the mesh calculations, right up to the point where I've done the ToArray()s on the list of vertices/indexes. Then the main thread sets the data back.

    In Jarheads, because I'm not using MeshColliders the hitching is barely noticeable until there's a huge amount of explosions, and a lot of that is down to the particles as well.

    In PicaVoxel, I use a balance of flattened arrays, threading, greedy meshing, and using the native Shuriken particles to squeeze as much perf as I can out of managed code. There's probably still more optimisations I can make but until Unity lets us set the MeshFilter data on another thread (or better yet, speed it up!), there will always be the danger of hitches.

    There's also the matter of the chunk size you use. I find that 16x16x16 chunks are optimal, but you're still limited in the number of meshes you can generate on the fly per update, especially on laptop/mobile-grade CPUs where threading is either not an option, or actually becomes an overhead.

    It sure is fun to mess with, though!
     
  20. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Congrats on doing something somewhat original, with the whole voxel thing.
     
    GarethIW likes this.
  21. GarethIW

    GarethIW

    Joined:
    Jun 24, 2014
    Posts:
    50
    Thanks!

    I'm quite a fan of non-textured voxel art, the kind of thing that artists are creating with MagicaVoxel and Qubicle. It's like 2d pixelart, but in 3D. Think Crossy Road, Voxatron etc. That stuff is the inspiration behind both Jarheads and PicaVoxel.