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

Space Game Starter Kit [Released]

Discussion in 'Assets and Asset Store' started by ArenMook, Oct 11, 2011.

  1. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yes but then how do you tell what's in front of the ship and what's behind? One way would be to draw bigger dots for things behind the ship (closer to the camera) and smaller ones in front. Another would be to draw lines toward the XZ plane... So far I am siding with the first option.
     
  2. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    I was thinking of having an x / y grid in the corner of the screen and with the ship position in the centre of that grid. Then if an object is in front, it will appear as a dot on top of the centre point and if it's behind, it'll show below it.

    Thinking about how other space ship games do it, I find sometimes they don't bother with radar and instead have a system where you can cycle through all possible targets in the scene and whichever target you have selected is either highlighted on the screen if its visible or there appears an arrow pointing to the direction you would have to turn the ship in order to see that target. Perhaps that would be more useful?
     
  3. Deleted User

    Deleted User

    Guest

    It depends on how realistic you want to make your game.
    I for example like much more the standard radar like you describe with x/y grid.
    But its sometimes hard for new players to get use to that kind of radar system. ( and i think that is the biggest problem if you care about new players ).
     
  4. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    First off, thank you so much for this. My first Unity project is a space sim, which is fairly well plotted out on paper. I'm an experienced programmer, but still a bit new to Unity and game development, so there are some details I've found in your code that finally made some things click for me. Thanks a bunch.

    You asked these questions earlier so I figured I'd respond:

    - What interests you in this kit?
    My first project I want to prototype is a space combat sim. Control-wise it's very different, but there are a lot of mechanics in your project I was just starting to work on myself, so I wanted to see how someone else approached the situation before I got too deep into it myself.

    - What platform are you targeting?
    PC/Mac.

    - What genre is your game going to be?
    Initially just action multiplayer deathmatch - if it progresses to fulfill it's initial vision and not just remain a prototype, then team-based strategy as well.

    - What features are important to you?
    * The missile mechanic was particularly helpful. It's similar to something I had been envisioning, so it's really a good starting point for me to add my own ideas.
    * A radar of some sort is something I would like to do. I was toying with the idea of doing a smaller 3d wireframe type representation of the ship and surrounding objects. Not sure how I would implement it, though. That's probably beyond the scope of your kit, a simple radar would do fine. :)
    * Basic kill/death tracking
    * Basic sound effects, they don't need to be fancy. Just having an example to see is really helpful.

    - What would you like to see improved?
    * Visual indication of when the plasma beams hit an object, a basic particle emitter I guess.


    - What would you like to see more of?
    * More HUD elements that reflect the status of the ship. Probably just energy/health. A visual gauge instead of numeric counter would be nice.
    * Some generic documentation (not code) about how the project is set up conceptually. Especially about:
    - cameras/layers and why they were done the way they were
    - basic starting notes on how your GUI system works and how to extend it, or add your own features would be nice.
    - description on how you dealt with syncing physics states in multiplayer (I've gleaned a good bit from the code, but an English explanation not in code would be very helpful for people to see the big picture on how things fit together)

    So, now for my own questions. :)

    * Have you done any load testing to see how many players your scene can realistically handle and still offer a good experience? I feel strongly about having physics-based controls, but I know physics and multiplayer are often bad combinations. I haven't looked at all of the code in detail yet (just bought it about 4 hours ago), but I'm curious as to your thoughts on authoritative vs non-authoritative in a game like this.

    * I'm interested in the scale and what you did with putting the planet in a different layer. Big space environments often lead to floating point imprecision, is this why you used different layers? If you wanted to have, say, 5 separate areas, astroid fields for example, each of which being a great distance from each other, would you put the objects in each area in it's own layer?


    I'm sure I'll have more questions, so I'm going to cut myself off for now.

    Thanks again, what you've done here is really helpful, and I appreciate that you've abstracted the code nicely and done it in C#.
     
  5. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Wow, that's a very in-depth response, thank you for that.

    I think you will find the next update to be pretty useful. I've added a 3D HUD representing the player ship's energy and health, and I'm adding a smaller version of the same indicators to the enemy ships. I've also added a fair bit of documentation to the UI system, and next week I plan on working on the UI pretty much exclusively, adding a variety of tutorials and examples. The complete 3D UI will be a stand-alone (and cheaper) kit, but all the tutorials and documentation will be freely available, so it will still help you out a lot since you already have it bundled with the project.

    I haven't done any load testing, but due to the optimizations used in the Spaceship class I would say it should be able to support quite a few simultaneous players. Playing the game the amount of data sent out rarely passes 1 kb/sec from what I saw, usually hovering around 400 bytes/sec. Physics calculations are all done locally, and and each client is only responsible for sending out updates for the objects he "owns" (objects that client created). In most cases that's just a matter of sending out creation, collision, and destroy events, and only in rare cases does it involve more frequent updates (currently that's for the spaceships and missiles).

    The layers are indeed used to address the floating-point precision issues, but for the graphics card rather than the CPU. It would be a bad idea to place a massive far-away planet on the same layer as the near-camera spaceship, as there would be a very significant loss of depth precision due to near and far clipping planes being so far apart. I addressed that problem by separating the drawing into two layers -- one for the distant, massive objects, and one for normal objects.

    That said, if you wanted to create 5 separate far-away areas all in one scene, you might want to consider loading each part of the scene additively as the player gets close to it (and unload the previous one) -- and consider teleporting the player back to 0 0 0, with the scene loading around there as well. Come to think of it, that would be a pretty cool way of handling being able to travel from one star system to the next without any loading times...

    Now I'm getting ideas. :)
     
  6. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    That's kind of the direction I've been thinking, I'm just not really sure how to implement it. :) My idea was to be able to let players jump to the individual locations... but theoretically they should be able to fly between them as well, it would just take a while. Have you seen what you described done anywhere, or happen to know of any examples that use a similar technique? Also, wouldn't that cause conflicts in multiplayer with syncing transform locations? Or would you do some hackery where you test to see which "area" a ship is in before informing them of other ships, thus only informing clients of ships in their own area?
     
  7. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Hackery, pretty much. You'd have to separate your galaxy into quadrants. Take a look at Tools.EncodeFloatToInt -- It's able to encode a floating-point position into an ID that can be used to determine where the player is. Each player would be changing its game channel as they travel the galaxy, and since the events are only sent to all players in the same channel, only those in the vicinity would get the events.
     
  8. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Energy/health bars can now be seen in the latest beta build. I'm not too happy with how they look, personally... but better than nothing.
     
  9. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Awesome. I suppose, but for a starter kit it doesn't need to be crazy fancy, just easy to understand. Thanks for adding that.

    Are you still planning on doing the procedurally generated star map that was mentioned in a previous post?
     
  10. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Yes. Looks like the radar is the most requested feature though, so I'll work on that first.
     
  11. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
  12. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Thanks, but no need. The implementation I am working on is completely generic and stand-alone, and won't suffer from the problems that thread's author is describing in his thread. Steps to use the radar I am working on: attach is to the "player" -- whatever your "player" is (in the kit's case -- the spaceship), and tweak the parameters such as "range". To see targets show up on the radar, attach the RadarTarget script to them. That's it -- the radar itself does the rest.
     
    Last edited: Nov 8, 2011
  13. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Are using a similar approach to how you do your "near miss" detection by basically using a sphere around the ship as a trigger?
     
  14. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    That's how the near miss detection works yes, but -- similar to what? The radar? The radar doesn't use physics. RadarTarget has a static list of objects the Radar goes through and chooses the ones within range.
     
  15. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Sorry, yeah, I was talking about the radar. Ok, I see.

    I had been trying to think of a way to have a radar that tracked objects based on how much heat/electronic emissions they generated. It occurred to me that your approach to the near miss thing might work. So, onTriggerEnter get the heat/electronic values and check if the radar is "sensitive" enough to detect it, if so, draw it. But... it also may be terrible performance-wise.

    Can't wait to play with your version. You have no idea how much time you have already saved me. :)
     
  16. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    The radar may pick up targets, but displaying them is up to you. It would be trivial to see how much heat the object is generating and scale the radar blip to match, for example. It would also be quite easy to implement areas that "adjust" nearby heat signatures -- a hot object near a cold object can cancel each other out for example.
     
  17. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    neat. I bought this last week to do some prototyping with, looks good.

    I think the hud offscreen target icons in the latest beta are hard to see and a little confusing to determine directional movement. If you have a look at Rise of Glory they have a neat visual indicator system for off screen targets that gives both direction and relative distance so you can prioritise.

    ty!
     
  18. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Agree with that ... I like how Rise of Glory handles the off screen indicators.

    I'd like to see a health / energy indicator on target ships and such you would know whether a ship is almost destroyed or at full health. It's something I'm struggling with in my current game. How would you incorporate something like that in this game?
     
  19. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Already done, Raj. :) Try the latest beta build.

    P.S. Space station heals damage now.
     
    Last edited: Nov 8, 2011
  20. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    My bad ... didn't see the previous link. Checking it out now.
     
  21. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Just played the latest demo ... it's fantastic. I really enjoyed shooting the other ship. I noticed that once you hit it with a missile, it seems to just continue moving and doesn't come to a halt. That makes sense from a physics perspective but it was strange at first. Great game ... I can't wait to start building on this one.
     
  22. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    When AI is in place, it will take care of slowing down the ship. Until then though, all momentum is simply conserved. :)
     
  23. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    AI. That would be ... awesome. How extensive are you planning on making it?

    Here's a random question... how long has it taken you (approximately) to get this to where it is right now? Is it just you working on it, or do you have a few people?
     
  24. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Just me, in my spare time. Most of this was created in a week I took off back in August. I spent about a week more on it after that doing updates. So in total -- about two weeks worth so far.

    The AI would have to be pretty simple -- just fly the ship, shoot at enemies. Writing an extensive AI system is an enormous task and would be way outside the scope of a starter kit.
     
  25. Deleted User

    Deleted User

    Guest

    I see you made all seen items at front of you marked on screen its okkei but there will be a problem in asteroid belt or when facing more than 5 enemy's. If you would made possible to switch targets from one to another ( visible on radar also ), it would be visual more pleasing also making it more flexible by letting players switch between friends and foes would be just great.
     
  26. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Ideally, in a game asteroids shouldn't be marked at all, they're only marked right now for demo purposes as most people who try the demo won't run it in multi-player. In an actual game the target reticle should only be placed on objectives and enemies.
     
  27. buenofelipe

    buenofelipe

    Joined:
    Nov 9, 2011
    Posts:
    4
    I would love one of these Starter Kits to make my side scrolling space shooter (like Gradius and R-Type). =)
     
  28. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Take a look at the SWTOR / Star Fox space combat demo included in this package. Just change the camera to be orthographic and there you go -- a side scrolling space shooter. :)
     
  29. Deleted User

    Deleted User

    Guest

    Of course that things like asteroid should be marked. For example in asteroid belt you can estimate how far are objects ( because marked things should not only show how much life they have but the distance also ), or/even when in your game items will be mine able. That is even bigger reason why asteroid and other similar things should be marked but of course its up to developer and his game.
     
  30. Maurice-Hoffman

    Maurice-Hoffman

    Joined:
    Jan 22, 2009
    Posts:
    182
    Hello Arenmook can you make a webplayer of the star fox space combat demo ? Thanx in advance.
     
  31. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Update it with what? I haven't touched that demo in a while.
     
  32. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Version 1.11 has been submitted to the asset store. It mostly features polishing-related changes: fixes to multiplayer, more comments, simplification / reworking of some systems, visual improvements to targeting indicators, health/energy bars, and some other stuff. The radar system is unfinished so I chose to delay it until 1.12.
     
  33. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
  34. Maurice-Hoffman

    Maurice-Hoffman

    Joined:
    Jan 22, 2009
    Posts:
    182
    Thanks ArenMook I have bought your starter kit it is great.
     
  35. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Been toying with things and have some questions now.

    * I had read somewhere that assigning NetworkViews to projectiles could be an issue when you have a lot of them, but I don't have enough experience to really know one way or another. If there were 10-20 people in a room mashing the fire button, would creation/destruction of that many objects with NetworkViews be a problem? I've seen other examples that use RPCs to tell the ship to fire on the other computers, so the projectiles only instantiate locally on everyone's client... I could see things getting out of sync with that solution though. Any thoughts?

    * Are you interested in attempting to load test the multiplayer? I'd be curious to actually try and get 10-20 people together and see how it goes.

    * For movement, the player ships are only physics controlled locally, and on other clients rigidbody.isKinematic is set to true, and only the transform/rotations are synced, thus movement is non-authoritative... am I getting that right?
     
  36. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    The NetworkViews are being used as unique identifiers in this case, with RPC functionality. They aren't used to sync anything so they shouldn't be expensive on bandwidth. It should be alright, but some load testing might be useful.

    Load testing might be interesting after I add respawn functionality.

    All physics are simulated on each PC individually and sync'd based on the state of the NetworkView that owns them. They are only kinematic at the very start while they are being positioned.
     
  37. Deleted User

    Deleted User

    Guest

    ArenMook i have a question for you.
    Its more like a support question but what if i am using your kit changing it a little to adjust it to my game and than you have another update that gives a lot of things that i need. Dose that mean i have to start everything from scratch or it will update all the files from YOUR kit that i am using in my game ?
     
  38. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    To be honest with you I'm not certain how Unity handles updates to kits. My guess is it that doesn't, and simply copies the new files over old ones. How extensively have you've modified the files inside the SGSK folder? If not at all, then just delete the old SGSK folder and extract the new one in its place. If you've modified them, then I suggest extracting the updated version elsewhere, then merging changes more carefully. If your files are versioned (SVN, Mercurial, etc) then you should have a history of what you've changed, making this process fairly painless. If not, then it might be a bit more of a hassle.

    P.S. Don't forget about the files inside the Library folder (zipped up ones).
     
  39. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I seem to be getting this question frequently lately so I'd figured a post here might help. The question is: "how much do I charge to customize the kit?", and my answer is always "it depends on the amount of changes and whether the changes are exclusive to you, or can be incorporated into the kit on the asset store". It's hard to ballpark an estimate without a clear scope. Time is another factor -- if you want your changes ASAP, then I have to put what I'm doing on hold for you, which may not be ideal. So far I've been prioritizing my tasks based on the number of requests I've received, which currently puts the stand-alone 3D UI system at the top of the list (with examples such as in-game inventory system and ship customization), followed by the radar system addition to the space kit.

    PMing me for this works best. :)
     
  40. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Not sure if anyone else has had this problem:

    I have a completely different control scheme than what the Starter Kit provides (I have an in-cockpit view with FPS style controls), unzipping the Library Assets as instructed overwrites previous Input Settings. This is annoying, but it's not that big a deal, would be nice if Unity provided a better way to deal with situations like this at some point.

    I revisited my control scheme, abstracted the code a little, seemed ok. But, when I went to modify the Project Input settings and re-add my previous control axes, it looks like no matter what I do I get log messages along the lines of:

    "UnityException: Input Axis Horizontal is not setup."

    None of this ("Horizontal" axis) is anywhere in my code (it USED to be in my code before I changed it a week ago), or the Starter Kit code - so my assumption is that it must be some holdover in the Library files... but I don't really know what to do about it.

    I haven't revisited my control scheme since I unpacked LibraryAssets into the Library directory. I didn't worry about mixing two projects together, because as of now my project is very small, it's really just a few assets plus my controls demo, so I wasn't worried about conflicts. Can anyone think of some thing that would prevent Unity from recognizing modifications to the Input Settings? Or know whether or not this is indicative of a different problem altogether? Maybe it IS recognizing the Input Settings, and it's not recognizing my new code... I can't really tell, but I get no compile errors.
     
  41. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Fixed!

    Sorry... clearly I haven't slept in a while. I mistakenly made some properties public, changed the code, and didn't realize they were still set to the old values in the Inspector. Boy, I feel silly.
     
  42. Deleted User

    Deleted User

    Guest

    ArenMook a little earlier in post you said something about creating multiplayer network for people to be able to test the kit.
    Well maybe you could just take the " Photon Unity Network " that is already free in asset store and just connect it to your kit, job done you have your space game kit with photon server. I think it would be better than creating server from scratch because Photon can provide you already with unlimited servers ( for a price of course ) and 10 player server for free.
    Its just an idea but if you ask me i would look forward to it, its nice to see it working on multiplayer level.
     
  43. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    Edit: Late reply I see. Nm.

    Thinker: The kit comes with built-in networking functinality. When you hit the "Host" button", you actually are hosting a game and others can connect to you if they know your IP.
     
    Last edited: Nov 20, 2011
  44. Deleted User

    Deleted User

    Guest

    Yes but with Photon we can create servers, not making game depending on us being online all the time.
     
  45. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    For a persistent server, sure. That's way outside the starter kit's purpose, however. :)
     
  46. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    Here's a feature request:

    Would you be interested in adding a simple raycast-based weapon, since you already have a projectile and missile example?
     
  47. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    I can put it on the list, but it's really simple. That's why I didn't do it. You just raycast from a point in a direction, if something is hit, apply damage.
     
  48. edhardyboy

    edhardyboy

    Joined:
    Nov 18, 2011
    Posts:
    8
    Hi there :)
    would you be able to turn this into an airplane script instead of a space ship?
    thank you
     
  49. ArenMook

    ArenMook

    Joined:
    Oct 20, 2010
    Posts:
    1,902
    o_O This is, after all, a space game kit...
     
  50. djinni69

    djinni69

    Joined:
    May 10, 2010
    Posts:
    174
    I demand zoo animals and fantasy styled bathrooms!!!
    *snicker*