Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Grid Wars clone

Discussion in 'Made With Unity' started by TwiiK, Mar 13, 2011.

  1. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    After being away for a long time and not having the drive to continue on one of my previous projects I took a tip from KyleStaves and decided to just rip something off to get things rolling again. Deciding upon Grid Wars this would also give me a chance to explore the possibilities of Unity's particle system.

    I will take this clone as far as I'm able and then post the whole thing here on the forums for people to do whatever they wish with.

    Currently I have basic movement, the 2 most basic enemies and some shooting going on. Some light trickery with the particle system allowed me to have some cheap, good looking particles as you can see here:
    $topdown.jpg
    Only 4 draw calls for all those particles, sweet. :)

    But apparantly there's more to performance than draw calls and I'm noticing a very evident drop when there's a lot of them on screen at once. Not sure what casues the drop and if it's something I can remedy, but it may just be that drawing that many particles is expensive? Anyway, trying to compete with an engine created specifically for one game is perhaps futile. Grid Wars can even handle a seemingly infinite number of enemies on screen at once without any drop in performance. Shall be fun trying to recreate that. :)

    I've asked for permission to use the assets of the original game which would save me some time in the development process.

    A webplayer will follow shortly. Just have to sort out a few kinks first.

    Here is the link to the original (clone) for those who haven't heard about it: http://gridwars.marune.de/
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,021
    So many colors...! So pretty...!

    Looks awesome.

    It will be interesting to see what causes the slowdowns as well, I don't have any ideas, but this looks like the kind of project that may lead to figuring out some kind of optimizations unity needs to do (and hopefully the devs will implement them)
     
  3. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    1 quick question:
    - Is there and easy way to make something pixel perfect in Unity without resorting to the Sprite Manager addon?

    And another:
    - Is it possible to set the resolution of the game window inside the Editor? Perhaps open it in a popup or something?

    And a last one:
    - Is the texture filesizes displayed inside the Editor just telling you what the maximum size of that format can be or the actual size of the current texture? When I import a 5kb texture and it becomes 64kb inside Unity I begin to wonder. :p
     
    Last edited: Mar 13, 2011
  4. Tudor_n

    Tudor_n

    Joined:
    Dec 10, 2009
    Posts:
    359
    Not unless you're willing to go into GUITexture land and meet all it's "special" inhabitants.
     
  5. Krobill

    Krobill

    Joined:
    Nov 10, 2008
    Posts:
    282
    Of course there is. Sprite Manager is no addon to Unity, it's just a script doing pretty basic things that anyone can do. And there's no need to resort to the GUI system of Unity.

    The pixel perfect issue has been covered abundantly, I've answered the same question here.
     
  6. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Great stuff, Krobill.

    Will check that out. The plane size thing is puzzling me though seeing as the size of the plane depends on how big you make it in your 3d application and the import settings, does it not?
     
  7. Krobill

    Krobill

    Joined:
    Nov 10, 2008
    Posts:
    282
    with the orthographic size set to half the screen height resolution you get 1 Unity's unit = 1 pixel. It's up to you to make your imports make that happen. Generally though if you aim for a 2D game with Unity, you'd be better off with geometry generated at runtime through code. No sense in modelling quads in a 3D package to 'just' apply bits of bitmap on them.
     
  8. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Good point.

    Alas, my competence falls short of actually generating meshes and texturing them through script so I will have to decide if I'll bother trying with this pixel perfect stuff or not. This is probably the only 2D game I will make with Unity either way. :)

    Thanks for the help.
     
  9. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Ok, that was actually a lot easier than I thought. :)

    And it worked. The sprites are pixel perfect now.
     
  10. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Here's a webplayer if you want to test it out.


    http://www.twiik.net/sites/default/themes/twiikv2/WebPlayer.html

    Getting things to be pixel perfect set me back a bit as all the velocities etc. had to be tweaked again, but now they're better than ever and things are looking great.

    In the webplayer I'm just spawning 300 enemies to test performance and it runs smoothly on my machine with up to 600. The editor claims 300+ fps with 300 on screen at once. The draw calls never go above 14 which is nice. :)

    More to come.
     
  11. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Nice, plays smooth as silk here, good job. After reading your initial post yesterday and trying out the original, I had some thoughts circling around my head. For the background you could use a single mesh and use a vertex shader that's passed the player location or several locations to move the vertex positions away from you to get the background grid effect they use.
     
  12. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Thanks for the tip.

    The grid was actually something I was going to let people try to figure out on their own if they felt like it because I had no idea where to even start. :)

    Will see how far I try to take it.
     
  13. Jesper

    Jesper

    Joined:
    Feb 12, 2011
    Posts:
    85
    looks cool :)
    Did you use unity pro for this project?
     
  14. besieger1

    besieger1

    Joined:
    Jul 26, 2012
    Posts:
    34
    How did you create the particles, I am trying to recreate this project. Would i be able to get a copy of this project?
     
  15. thegdeveloper

    thegdeveloper

    Joined:
    Feb 25, 2013
    Posts:
    134
    great job, what can I read to create these kind of effects?
     
  16. silkroadgame

    silkroadgame

    Joined:
    Apr 9, 2013
    Posts:
    101
    Your colors are quite proper and good!