Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Games ARPG

Discussion in 'Works In Progress - Archive' started by TwiiK, Nov 15, 2016.

  1. TwiiK


    Oct 23, 2007

    The A stands for asset flip, as coined by Jim Sterling. :p

    Heh not really, it's going to be a fairly traditional action role-playing game, but hopefully I can show that it's possible to create something that looks and plays rather well without making a single asset yourself. Everything you see in the above image was not made by me, but is assets I've found, most of them from the Asset store, all of them free. The most prominent one (the low poly town) was only free because of my Unity Pro Level 11 membership, but it's dirt cheap and I still think it's amazing what you can do in a very short amount of time by just slapping some assets together. I'm sure the assets creators spent a long time making all the assets, but I've only spent a weekend on the game at this point, and yes, I know it's not much of a game at the moment, but in my opinion it's a solid foundation for one, and working on it feels like modding an existing game rather than making a game from scratch, and I can see why people enjoy this approach to game development.

    You can download a Windows standalone from here if you want to test it out:

    Originally I wasn’t going to make this game at all, I was struggling with getting back into Unity after being away for a while (as I always do) and I was looking for an interesting tutorial to revitalize my passion for game development. :p I came across this tutorial by GameGrind on how to create an inventory system and I thought that was something I could use for an X-Com type game I was working on the last time I was working with Unity, and I remember trying to make an inventory using the old Unity GUI and thought it was absolutely dreadful so the fact that this tutorial series was just a few hours long and the end result looked so promising really peaked my interest. When I reached the end of the tutorial I really wanted to see how polished I could make my inventory and I felt like the tutorial approach was a bit limited so I wanted to try and recreate the inventory seen in a game like Path of Exile, but to do that I needed some quality art (obviously) because it's so much more fun to prototype with good looking art. :D I ended up discovering some on and from there things spiraled out of control and now I'm completely obsessed with this project, it's so fun to work on and everything comes together so effortlessly.

    I will post a list of all the assets currently in the game at the bottom of this post and I will try to keep it up to date whenever I update the game for anyone wanting to get their hands on the same assets.

    If you download the assets yourself you'll discover that I've tweaked some of them a bit, and that's where the fun comes in, they are so easy to tweak. For example I knew I wanted my character to be able to equip different weapons, but the knight model came as one combined mesh, but with just a quick trip into 3ds max to detach his sword and shield and export him again I had that problem fixed, all the animations and textures still worked perfectly. Of course he looks a bit odd while not wielding anything or if he's wielding something very different from his original sword and shield, but if this project ever gets to a point where I'm serious about it I can just put a bit more effort into that particular asset or replace it with an asset of my own that fits the needs I have for it. Another example is the low poly weapon set which came with a purple potion model and I had no purple potion icon in my icon set, a quick trip into Photoshop fixed that and suddenly I had a model and an icon that looked like they were made to fit together from the start. One last example is the town asset which came with both a night time scene and a day time scene so I combined them through some clever scripting and presto you have something that is way cooler than the sum of its parts. To spice it up further I made a script which gathers all the emissive windows for all the houses into an array, shuffles the array and then enables the windows one by one each time it becomes night to give some feeling of life to the town. And prototyping with the new UI is just a dream. I thought I should put some settings in there to let people with less powerful computers turn off the image effects as well as let people control the time of day and I was able to do that in 10 minutes and have it look nice.

    We'd better get back 'cause it'll be dark soon and they mostly come at night. Mostly.

    I'm not sure what will become of the project in the end, most likely it'll be a perpetual hobby project I can dabble with whenever I feel like it.

    I will add a roadmap when I know what features I want to work on and in what order.

    Asset currently in the project:

    UI by Ravenmore (Free):
    Inventory Icons by Ravenmore (Free):
    Zombie by M.eye (Free):!/content/17622
    Chest by Fairy shop (Free):!/content/72345
    Knight by Dungeon Mason (Used to be free, now $5):!/content/72070
    Low poly weapons by SICS Games (Free):!/content/71680
    Low poly town by Evgenia ($25):!/content/22258
    Dungeon Level Kit by Hedgehog Team ($20):!/content/35681
    Lowpoly Toon Cat Lite by Polydactyl (Free) :!/content/66083
    Toon Elf character by BBSoftware & Snowball ENT ( Free):!/content/19572
    Floor Segment by ZugZug Art (Free):!/content/20330

    Barely noticeable and only there because I own them and was curious how'd they look in the game:

    SSAO Pro by Thomas Hourdel ($25):!/content/22369
    SE Natural Bloom & Dirty Lens by Sonic Ether ($20):!/content/17324
    Filmic Tonemapping by Paroxe ($27):!/content/29341

    All of these image effects can easily be replaced by the free post processing stack made by Unity.
    Last edited: May 1, 2017
  2. TwiiK


    Oct 23, 2007
    I recorded a short video of me opening the only chest currently in the game, enjoy: :p
  3. ToshoDaimos


    Jan 30, 2013
    You made a nice prototype. Now, try to sell it to real gamers. That's where you will be judged.
  4. TwiiK


    Oct 23, 2007
    Thanks for the kind words. :)

    As for the "judging", there's no doubt in my mind that I could get this game Greenlit on Steam in its current form if I wanted to, I've seen the type of Unity asset flip games that are on Steam and some of them even seem to sell alright and have decent feedback despite obviously being just assets taken directly from the Asset store and sold on Steam. And that means they were Greenlit in the first place...

    But I'm my own harshest critic and if I ever intend to sell this it won't be before I think it's worth selling, and that's a long way off, and I probably would replace most, or all, of the assets with assets made myself or assets made specifically for the game before doing so. :)

    Like I said in the original post I'll get a proper roadmap sorted out sooner or later, but some of the features I want in the game are: Grid based inventory with items of varying sizes like in Diablo or Path of Exile, proper combat (obviously), it will probably be a lot slower than in most modern ARPG's and more similar to how the combat was in Diablo 1, randomly generated instanced dungeons, and a lot more features and polish to make the world feel like a living, breathing sandbox simulation rather than the static worlds you have in standard ARPG's, it will be more like Skyrim or Minecraft. And if this ever becomes more than a prototype it needs to have online multiplayer.
    PhilippG likes this.
  5. TwiiK


    Oct 23, 2007
    I've updated the roadmap now:

    When I have all these features in the game I feel like I have a fairly solid foundation to play around with.

    My main idea with the game is based on playing a ton of ARPG's over the years and realizing that I've started to tire a bit of the concept and the addictive nature of them. Lately my favorite games have been roguelikes like Spelunky, Binding of Isaac, Risk of Rain, Rogue Legacy etc. because the idea of a short gameplay session comes so natural for games like those. You play 30-60 minutes and then you quit. When I play Diablo 3 or Path of Exile I get swallowed up for an entire day and feel like I've just wasted my time (even though I may have had fun). 1 hour in a game where nothing has a start or an end goes by so much faster than in a game where 1 hour is the entire game, at least in my opinion. And spending thousands of hours in a game "doing nothing" was fine for me years ago, but now I feel like it's just a tiny bit wasteful. :) I know people who are able to play Path of Exile for just 30-60 minutes and quit, but I'm just not able to do that or able to have fun trying to do that so I'm trying to make a game where a short gameplay session comes more natural, just like in a roguelike.

    What inspired me was a newly released feature in Path of Exile which in my opinion almost combines the best of roguelikes and ARPG's. In Path of Exile there's a dungeon where if you die you have to start the entire dungeon over again. So you get the permadeath, one-run, intense gameplay of a roguelike without the extreme time investment loss that playing hardcore in an ARPG and having to start your entire character over again usually involve. All you lose if you die is your current run in the dungeon, just like you would in a roguelike. I loved this dungeon, it's an amazing feature in my opinion and I want my entire game to be like that. I want the town to function like a static hub where you get quests, buy/sell items and perhaps at one point in the future interact with other players and then you have procedural instanced dungeons of varying difficulty that you can venture into and if you die in those you are returned to town and have to start the dungeon all over again.

    PS: Is there anyone here who know any good articles or videos detailing how melee combat works in games like Diablo, Path of Exile or any other similar type of game? Is there a de facto standard way of determining when an enemy is in range, when it takes damage etc.? I have a general idea of how I want to handle it, but it would be nice to find some information on how other games have handled it and so far my Google-fu has been off. I'm guessing games like Dark Souls or any game trying to have a fairly realistic approach to combat actually use colliders on the weapons themselves to determine when a weapon strikes an opponent, but in most ARPG's a melee attack can only hit a single enemy at a time and I guess you handle that buy using a spherical trigger equal to your weapon range, checking if an enemy is within a cone in front of you and making sure to only deal damage to a single enemy at a time (the one closest to the cursor presumably) or something like that.
    Last edited: Nov 26, 2016
  6. TwiiK


    Oct 23, 2007

    I've released a build for version 0.0.2. This version has mainly been about UI polish, but I've made some other changes as well. The game isn't very playable still, but I didn't want the public build to be so far beyond what I was currently working on.

    At the moment I have two milestones for the game. The first one is version 0.1.0 and that's when I consider the core game mechanics more or less properly implemented. That is movement, various interactions and basic melee combat should work pretty much how I want them to. After that I'll work towards 0.2.0 and I consider that done when I have implemented an infinitely playable gameplay loop where you can enter a procedural dungeon, kill and loot everything, return to town to equip/sell, rinse and repeat.

    When that is done I'll take a step back and see where I want to take this. The most fun part of game development for me is proving to myself that I can create functional prototypes of the game genres I love that I myself consider to be as good or better than the games that inspired me in the first place. :)

    I'll at least make a Mac build for 0.1.0 and 0.2.0, I can probably make an untested Linux build as well, but for these smaller builds it's Windows only, I'm afraid. Such is the life after the death of the Web Player. :(

    Changes for this version:
    • Tooltips now always stay within the screen boundaries.
    • Polished up the UI a bit.
    • Added a close-button to the interface panels.
    • Made it possible to drag the interface panels around.
    • Added a settings menu with some quality of life game settings like brightness, audio, performance etc.
    • Moved the equip slots to the inventory panel and made the character panel display character stats.
    • The zombies now have a basic AI and you can kill them. They can't hurt you yet.
    • Added some more animations to the zombies and they're now spawned from spawn zones that activate when you enter them.
    • Implemented player and zombie health.
    • Added life and mana meters, but they're not wired up yet.
    • Added a cat which follows you around and you can pick it up, obviously.
    • Replaced the color highlight on items with an outline. It works perfectly for the cat and the zombies, but it’s wonky for the items. Not sure how to fix it as I’m a shader noob.
  7. TwiiK


    Oct 23, 2007
    I also would like some help with my outline shader

    As you can probably tell from this image it's not working perfectly:

    For the cat, the player or the zombies it actually does work just the way I want it, but for objects made up of many different meshes like the chest it looks wonky and for objects like the shield which have sharp angles it also fails.

    This is the shader:
    Code (csharp):
    1. Shader "Outlined/Silhouette Only"
    2.     {
    3.     Properties
    4.         {
    5.         _OutlineColor("Outline Color", Color) = (0,0,0,1)
    6.         _Outline("Outline width", Range(0.0, 0.1)) = .005
    7.         }
    9.         CGINCLUDE
    10.         #include "UnityCG.cginc"
    12.     struct appdata
    13.         {
    14.         float4 vertex : POSITION;
    15.         float3 normal : NORMAL;
    16.         };
    18.     struct v2f
    19.         {
    20.         float4 pos : POSITION;
    21.         float4 color : COLOR;
    22.         };
    24.     uniform float _Outline;
    25.     uniform float4 _OutlineColor;
    27.     v2f vert(appdata v)
    28.         {
    29.         v2f o;
    30.         o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    31.         float3 norm = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, v.normal));
    32.         float2 offset = TransformViewToProjection(norm.xy);
    34.         o.pos.xy += offset * _Outline;
    35.         // The below line makes the line the same thickness independent of zoom level. Looks weird imo.
    36.         //o.pos.xy += offset * o.pos.z * _Outline;
    37.         o.color = _OutlineColor;
    39.         return o;
    40.         }
    41.     ENDCG
    43.     SubShader
    44.         {
    45.         Tags { "Queue" = "Transparent" }
    47.         Pass
    48.             {
    49.             Name "BASE"
    50.             CULL OFF
    51.             ZTEST ALWAYS
    52.             ZWRITE OFF
    53.             Blend ONE ONE
    55.             Stencil
    56.                 {
    57.                 REF 2
    58.                 COMP ALWAYS
    59.                 PASS REPLACE
    60.                 ZFAIL REPLACE
    61.                 }
    63.             CGPROGRAM
    64.             #pragma vertex vert
    65.             #pragma fragment frag
    67.             half4 frag(v2f i) :COLOR
    68.                 {
    69.                 return half4(0,0,0,0);
    70.                 }
    71.             ENDCG
    72.             }
    74.         Pass
    75.             {
    76.             Name "INNER"
    77.             CULL OFF
    78.             ZTEST ALWAYS
    79.             ZWRITE OFF
    80.             Blend One One
    82.             Stencil
    83.                 {
    84.                 REF 1
    85.                 COMP ALWAYS
    86.                 PASS REPLACE
    87.                 ZFAIL REPLACE
    88.                 }
    90.             CGPROGRAM
    91.             #pragma vertex vert2
    92.             #pragma fragment frag
    93.                 v2f vert2(appdata v)
    94.                 {
    95.                 v2f o;
    96.                 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
    97.                 o.color = _OutlineColor;
    98.                 return o;
    99.                 }
    101.             half4 frag(v2f i) :COLOR
    102.                 {
    103.                 return half4(0,0,0,0);
    104.                 }
    105.             ENDCG
    106.             }
    108.         Pass
    109.             {
    110.             Name "OUTLINE"
    111.             CULL OFF
    112.             ZTEST ALWAYS
    113.             ZWRITE OFF
    114.                     // Not sure what these do. Something about transparency.
    115.                     //BLEND ONE ONEMINUSDSTCOLOR
    116.                     //Blend One One
    118.             Stencil
    119.                 {
    120.                 REF 2
    121.                 COMP EQUAL
    122.                 PASS REPLACE
    123.                 ZFAIL REPLACE
    124.                 }
    126.             CGPROGRAM
    127.             #pragma vertex vert
    128.             #pragma fragment frag
    129.             half4 frag(v2f i) :COLOR
    130.                 {
    131.                 return i.color;
    132.                 }
    133.             ENDCG
    134.             }
    135.         }
    136.     Fallback "Diffuse"
    137. }

    The shader is from here and I'm basically using it without changes.

    I just saw that Unity has added selection outlines in the editor in 5.5. Is that shader available anywhere? Or does anyone know of a any other outline shaders I can "be inspired by"? :p
  8. HolBol


    Feb 9, 2010
    Why not just make it one mesh?
  9. TwiiK


    Oct 23, 2007
    How can I animate it opening/closing etc. then?

    Also, that won't really help me much as it would still be broken for the shield which already is one mesh. So unless I can fix it for the shield I see no reason to start changing the chest mesh.
  10. HolBol


    Feb 9, 2010
    well... with bones, like normal? Put the joint of the bones where the hinge is and animate it like anything else.
  11. TwiiK


    Oct 23, 2007
    Well, yeah, but it was really fast and easy to just animate it inside Unity when it was made up of multiple parts. And like I said it would still be pointless as I have 3 cases I need to solve and that would only potentially solve 1 of them, and later on I may end up with an object that has to consist of multiple meshes and then I'm back at the beginning again. :p

    An example would be an enemy wearing equipment like a sword and a shield. He would consist of multiple meshes and my outline shader needs to handle him properly.

    But I just downloaded Unity 5.5 and the outlines they've implemented work exactly like how I want my outlines to work so I guess that's where I'll focus my attention. :)
    infinitypbr likes this.
  12. infinitypbr


    Nov 28, 2012
    Games made with asset store art can absolutely be viable. My first big game "The Barbarian" was all asset store art, and my next game will use all the assets I've been producing.
    JBR-games and S4G4N like this.
  13. TwiiK


    Oct 23, 2007
    I just found this outline asset and it seems to do exactly what I want:

    It seems to handle the multi-mesh chest and sharp angled shield without breaking a sweat. Here's how it looks:

    But it works completely differently from my original shader. Not sure if that's good or bad or if it's necessary to get what I want. :p It seems a lot more clumsy and bug prone to use so hopefully I'm able to merge the 2 assets together to create something with the ease of use of the first one that works as well as the second one. Guess I should compare the performance of the 2 assets as well. This asset uses multiple cameras and scripts whereas the first one is just 1 shader.
    infinitypbr likes this.
  14. TwiiK


    Oct 23, 2007
    I'm still working on the outline effect for this project and I have nothing new to share in that regard, but I found some more outline effects on Google so I grouped them all on my website if anyone else is interested:

    They are all pretty solid effects in their own regard, but they're fantastic as learning resources for hopefully learning something about shaders and image effects seeing as they're so different from each other.

    The one I'm currently investigating in my own project is the last one, utilizing Command Buffers. I have no idea what they are, but the effect is really smooth and it was effortless to integrate into the project. The only thing I want it to do is not render additively and to render in world space or whatever you call it so the effect scales depending on distance and doesn't remain the same size no matter how far away the object is. All the 3 post processing effects ignore how far away the object is and I'm guessing that's because they are post processing effects whereas the first one isn't.
  15. TwiiK


    Oct 23, 2007
    Attack damage and attack speed is finally affected by your equipped weapon now so I made a video to celebrate:

    I also made a new build available here:

    I spent probably a week fiddling with the selection outline, but I feel that it's really sexy now. Easily on par with what you have in Unity 5.5. It still renders additively because I haven't been able to figure out why and where to change that. It's a bit hard to see in certain situations and too bright when it's dark because of this. And ideally I would want it to take z-depth or world space position or whatever you call it into account, but currently I fake that by just changing the blur size based on the distance between the highlighted object and the camera.

    But with this build finding and swapping out weapons is actually rewarding. I just need to make combat fulfilling now and it's starting to resemble a game, and I need to clean up the code a ton (for my own sake), but version 0.1.0 isn't that far away.

    Changes for version 0.0.3
    • The selection outline/highlight is really sexy now.
    • Implemented different item base types with different affixes.
    • Items now actually affect the character's stats when equipped.
    • The damage you deal and your attack speed is now affected by the weapon you have equipped.
  16. Rin-Dev


    Jun 24, 2014
    I was trying to build my own Arpg while back. However my code ended up spaghetti-ed together with no real end game of how I wanted the game to play. I really like how this looks :) Makes me wanna go back and start from scratch again lol
    TwiiK likes this.
  17. TwiiK


    Oct 23, 2007
    Thanks. :)

    At the moment this is pure spaghetti. The only reason I'm able to work with it is because I have everything fresh in memory. I need to refactor and restructure everything, but I've never had a project in Unity before that needed to be this structured so it should be a fun challenge. Currently reading up on data storage & structures, class inheritance etc. I've already gone through multiple different ways of storing and parsing item data etc.

    And you can copy the look almost exactly by just using the same assets. :D
    Rin-Dev likes this.
  18. Rin-Dev


    Jun 24, 2014
    I took a break and lost my place in all my code. Which is why I now comment on every little thing no matter how little I think the meaning of it is :D
    infinitypbr likes this.
  19. RizeoftheSummonds


    Nov 5, 2016
    Looks promising.
  20. infinitypbr


    Nov 28, 2012
    I wish I had learned that the first time I made a pasta filled game! I can't update it, it's so full of incorrect ways of doing things. It works, so that's good, but man....yeah, commenting is good!
    DScaddan, JBR-games and Rin-Dev like this.
  21. TwiiK


    Oct 23, 2007
    Well yeah, but I don't feel like commenting is that important if your code is logical. The problem with my code currently is that it's at that point in time where the only thing I care about is the end result. I just want all my features in and I don't care about how the code looks. So if I want to be able to drink a healing potion I just throw in an if ( == "healing potion") somewhere in the code and make it work, if I also want a mana potion I do the same thing, and then I suddenly have special clauses everywhere and references to specific items in my inventory code etc.. I will have to rewrite all this stuff so that it's the items themselves that tell the other system how they should be used, what their effects are etc..

    That's what I mean by spaghetti in this case at least. But it's how I like to work. Getting things to work how I want them as fast as possible is really rewarding and then later on refactoring the code to be smooth, maintainable and without special clauses is also really rewarding, and it's so much easier to do when you see concrete examples of the use cases you need to account for. The major downside with this is time usage of course, as it's almost as if you're doing the work twice, but I have unlimited time for my Unity projects so it's not a problem. :) Another big upside is that for a lot of projects I can skip the second step completely because having specific, hard coded systems is perfectly fine for something like a small game you're only going to work on once. Making generic, reusable systems for something like that is wasted time in my opinion.

    As for taking a break from a project and coming back I find the biggest hurdle to be figuring out where I left off. That is why I now use Evernote (you can use anything of course) to maintain roadmaps for all the projects I work on and if I ever know I'm about to stop working on a particular project for any extended period of time I write a short note about what I was last working on for the project. Then the next time I come back I can hopefully read the note, figure out what I was working on and look at my roadmap to figure out where to continue from here.
    Rin-Dev likes this.
  22. TwiiK


    Oct 23, 2007

    I've released what I chose to call version 0.1.0 and it's a fairly massive update, both in terms of visible changes and in terms of refactored code, future-proofing etc.

    I will now take a small break while I reorganize the project and figure out what I want to work on next. I've downloaded a ton of other amazing, completely free assets that I think will fit well in my game and I want to do a content update soon where I add them all, but I think I want to add the procedural dungeon before I do so there's actually something to do in the game for people who play it.

    But the game is actually already a bit fun to play. Trying to find and equip all the best gear and just plough through the zombies is rewarding.

    I also made a Mac build of this version. I tried it on my Macbook Pro and it seems to work identical to the Windows build which is reassuring.

    So much work went into this update, lol. The difference between making something 90% and trying to make it 100% is insane.

    Changes for version 0.1.0
    • Added respawn points.
    • Zombies can now kill you.
    • If killed you respawn on the respawn point you last stepped on.
    • You can now drink health potions to regain health. Right click on them in the inventory or add them to your toolbar and drink them using the corresponding hotkeys (1-4).
    • You can now punch zombies with authority.
    • Added amulets and rings.
    • Your strength now affects the damage you deal. You get 1% extra damage per point of strength.
    • Dexterity now affects your attack speed. You get 1% attack speed per point of dexterity.
    • Vitality now affects your health. You get 2 points of health per point of vitality
    • Intelligence now affects your mana. You get 2 points of mana per point of intelligence. Mana currently serves no purpose, but I'm sure it soon will.
    • Items can now spawn with modifiers that modify your attributes and stats. I'm currently working on defense so it's not working for the time being.
    • Polished the player movement. No more endless spinning and you're now more responsive when moving around.
    • Made an audio manager and passed all the sounds through it to ensure a consistent audio setup.
    • You now start with a white basic shield and sword. I also add 16 random items to your inventory just for early testing.
    • Added weapon range as a stat. The 3 currently implemented weapon types have vastly different range, speed and damage.
    • Made major tweaks to weapon timings, animation speeds etc. A weapon swing is now fast up until the point in the animation where damage is dealt and then slow on the back swing. This makes slower weapons feel more snappy. I've also rewritten and tested the weapon swing code a billion times with a stop watch to ensure 1 attack per second actually is 1 attack per second. There are a lot of wonky delays when working with Coroutines and Mecanim.
    • Zombie movement is tweaked a bit.
    • Added quite a few particle effects and sound effects to polish things up a bit.
    • Added collision geometry to every object in the world.
    • Optimized the temporary terrain by about 100%.
    • The zombie spawners now spawn a chest and when you open the chest and kill all the zombies the spawner resets after 60 seconds allowing you to grind indefinitely if you so choose..
    • Made a lot of progress towards making the combat feel like the best games of the genre (Diablo 2 & 3 / Path of Exile). You can now hold in shift and just swing freely and you will damage anything inside your weapon range and field of view, currently 90 degrees in front of you.
    • You can now also move and attack using both the left and right mouse button and I've polished up the interactions between using the inventory, opening chests, picking up items, fighting and moving.
    Known issues
    • Some of the particle effects look absolutely horrible at night time. I'm not even sure how you make particle effects that look good both in direct light and in darkness, not sure if it's possible without some form of lit particles. But they can for sure look a lot better than what they do at the moment.
    • Defense is not yet implemented.
    • Upgrading to Unity 5.5 broke my outline effect. It now shows through other objects.
  23. Tiny-Tree


    Dec 26, 2012
    it look good, you put enough work so it does not look like asset flip at all
  24. Rin-Dev


    Jun 24, 2014
    I actually meant to ask earlier , but are you handling attacks with raycasts, triggers, collision, or some other unknown entity I've been missing out on.
  25. TwiiK


    Oct 23, 2007
    Thanks, hand drawn art is actually kind of amazing because most of what you find is fairly consistent and the overall quality of what you find is much higher than for more realistic looking art. Like I said I've downloaded almost a dozen more free assets from the asset store and they all share the same type of look in my opinion, and they all look fantastic. The game is starting to look very similar to Torchlight.

    I will see how far I take this, but it would be nice to find a character with more animations and more animation potential because the knight I have at the moment is a bit limited. But I may have to make that character myself and I really have to be passionate about this project before I take that step. :p

    At the moment I'm handling attacks with 2 different methods:
    1. If I click an item, a chest or a zombie (detected by a raycast from the mouse position) I tell the player to walk to this object and interact with it. The interaction depends on the object clicked of course. If it's an enemy I swing at him once, and if I hold the mouse button down I swing continuously. I pass the object clicked to the function in charge of walking to the object and interacting with it so that I can update the position I need to walk to if the enemy is also moving, and also so that I can call the appropriate function to interact with. This entire section of code is hard coded for the moment. I check if it's a chest, an item or a zombie specifically and then call specific functions for those objects. I guess I need to refactor it so that everything derives from an "Interactable" class or interface or some mumbo jumbo, but I haven't gotten around to that yet. I like to just get things working first and then when I realize that I'm duplicating a lot of code or handling the same things in multiple places I try to refactor it.
    2. You can also hold down the left shift key while clicking or holding either mouse button to just swing freely in place. What I do in this "mode" is to call Physics.OverlapSphere() at the moment in the animation when damage would be applied and check if there's any zombies inside the sphere. The sphere has the same radius as my attack range. I then check if any of those zombies are within my "field of view" which I've currently set to 90 degrees. I then try to find the zombies with the smallest angle compared to my forward facing vector and then I apply damage to that zombie. This section of code is a bit rough at the moment, I think, because i just wrote it and I haven't actually verified that it's working the way I want.
    The way I handle attacks is still very much WIP, but my goal is to get it as good or better than the best ARPG's, i.e. Diablo 2 / 3 / Path of Exile.

    But in the end I want combat in my game to feel more like a MOBA like Dota, League of Legends or Heroes of the Storm or an MMO like World of Warcraft than a traditional ARPG. What I mean by that is that I want combat to be slower paced and I want it to really matter how you position, how many enemies you aggro at once and when you use your abilities. I don't want you to just hold a single button and run through the game like you can in most ARPG's. I don't yet know if I the way I handle attacks need to take this into account.
    Rin-Dev likes this.
  26. Rin-Dev


    Jun 24, 2014
    You handle it kinda like how I did. I had it raycast from camera to the ground, used navmesh to move the character, and after a certain amount of distance between the character and object, the player would stop and perform the action. Except it was a complete jumble of code with no way of actually telling what was going on. That second part though I find interesting and might actually help me out with my 3rd person sword combat I'm trying to do.
  27. TwiiK


    Oct 23, 2007
    Version 0.1.1 is out!

    Even though there's not that many big visible changes in the game this is by far the biggest update so far. The project is about 4000 lines of code at the moment and and I rewrote nearly all of them at least 3 times for this update. This is my biggest Unity project so far and it's making me have to learn how to structure the code properly to actually stay motivated when working on it. Usually I fall off when things start to get complex because I like things small, neat and manageable. :p

    Firstly I wanted to add defense as a stat which required me to refactor my item generator so that each item type could have different stats, so now I'm free to add a lot more unique stats to the different item types. Then I wanted to add the vendor allowing me to sell items, but that required me to rewrite the inventory code so that the inventory wasn't something that was unique to the player anymore. And then I wanted to make sure I could handle multiple vendors so I had to refactor that code again. Then I went a bit crazy with singletons trying a different approach to how my game should be structured, but I've decided that I want to make the game multiplayer at some point and the singleton approach was very non-intuitive for me to work with anyway so I refactored again trying to reduce my usage of that. And then last, but not least, the feature I spent by far the most amount of time on was the right clicking. Dragging an item into a slot and handling it correctly is easy, but right clicking an item and making sure the game knows who the item belongs to and what to do with it depending on the current context required a lot of new code.

    But things are starting to feel really solid now. I'm not happy with a feature unless it works just as well as it does in the best implementations out there and I feel my item buying/selling/equipping works really well now.

    One key design principle I aim to stick to with this game, and probably all my games because it's one of the things I value most in nearly everything, and it's consistency, I want things to behave consistently no matter how you interact with them. Spelunky is an excellent example of this. In that game if something can fall on the player and hurt him then that same thing can fall on an enemy and hurt him as well, and it's like that with everything. So far I've applied this to the vendor system. If you sell something it appears in the vendor's inventory and you can buy it back from him. You can even swap items directly with the vendor just like you can in your own inventory, as long as you can afford his item. So you will never sell an item to a vendor and have it just vanish in thin air like in most games.

    I will apply this principle to more things in future updates.

    Need help or suggestion
    There is one thing I'm struggling with and that's how to pass information to Unity Events. Like when I have an OnPointerDown() event how can I tell that event which player the cursor actually belongs to? Currently my game is singleplayer so it's not a huge deal, but I still would like to know how I can tell the OnPointerDown() event that this cursor belongs to this player gameObject. At the moment I'm handling this with just a singleton approach and it's nasty in my opinion.

    The changes for version 0.1.1
    • Added a quit button to the menu.
    • Added a slider for controlling UI scale to the menu.
    • Implemented defense as a stat. Only shields give defense at this moment and currently defense is a straight percentage damage reduction.
    • Added a vendor which you can trade with.
    • You can now buy, sell, equip, unequip and use items by right clicking and it's all context sensitive.
    The current roadmap
    • Add a procedural dungeon.
    • Implement a main gameplay loop which allows the game to be played "infinitely". I.e. you complete the dungeon, equip better items, sell all your loot, reroll the dungeon, complete it again, equip better items, sell all your loot etc.
    Last edited: Jan 30, 2017
  28. TwiiK


    Oct 23, 2007
    Version 0.1.2 is out!

    This version again contains mainly refactoring and polish. I want things to be really solid before I start adding more content.

    Changes for version 0.1.2
    • Changed the outline effect to the one made by cakeslice. I evaluated this effect originally, but it's recently received some great updates. I love it now.
    • The particle effects look a lot more consistent in various lighting conditions now. I changed them to use the vertexlit shader.
    • Added a particle effect to magic items on the ground. This is just a rough start. It will be refined.
    • Added weapon swing trails. Again just a rough start which will be refined.
    • You can now hold ALT to highlight all interactable objects in the game.
    • The ESC-key is now context sensitive and multipurpose doing everything you expect from it.
    • You can now press F1 - F4 to set the time of day. Just for testing purposes.
    • Added descriptions to potions.
    • Made the mana potion restore mana because apparently it wasn't doing that before.
    • Added a health bar for the currently selected enemy in the same style as the big names in the genre.
    • Refactored weapon sounds. The weapon swing and hit sounds are now tied to the weapon types and the 3 currently implemented weapon types have unique sounds.
    I also updated the current roadmap.

    Known issues:
    • Particle effects are lit by sunlight through the terrain and look odd when the sun is rising or setting.
    Currently working on (version 0.2.0-ish):
    • Add a procedural dungeon.
    • Implement a main gameplay loop which allows the game to be played "infinitely". I.e. you complete the dungeon, equip better items, sell all your loot, reroll the dungeon, complete it again, equip better items, sell all your loot etc.
    • What will hopefully be a fun and very unique system for saving and loading characters.
    Upcoming (version 0.3.0-ish):
    • Add archer class.
    • Add magic class.
    • Add warrior class.
    • 3 abilities and 1 ultimate each in the same style as popular MOBA's. I think I enjoy this approach more than the dozens of skills in popular ARPG's. But we'll see when I get this far. I have a rough idea of the game I want to create, but I have no clue whether it'll be fun or not.
    • Add a talent tree similar to Heroes of the Storm. Probably only autogenerated passive talents in the beginning to limit my workload.
    • Add leveling and experience. Each level will net you 5 stat points you can assign freely and a talent point.
    • Multiplayer.
    • More items, more enemies, etc. etc.
    Last edited: Apr 18, 2017
  29. TwiiK


    Oct 23, 2007
    Version 0.2.0 is out!

    If you just want to try it out click the above image. If you want to read my endless, but hopefully potentially interesting, ramble about what went into this update read on.

    I've probably spent close to a hundred hours on this update, but I had a blast. :D I've finally implemented a procedural dungeon that I think works great and is really easy to work with and create content for. The best part is that it's dirt simple. I went through so many iterations on this and every iteration only made it simpler, both code wise and in terms of working with it. I'm pretty sure anyone who sees it will immediately understand how it works, which is something I can't say for most procedural generators I've played with. Another big feature I added in this update is the ability to save and load your character along with his inventory and equipped items. And lastly the ability to load your character and the dungeon required me to figure out how to do games spanning multiple scenes which required some major refactoring to my project and code, but all for the better I think. I'll dedicate a section to each of these things below, but firstly I want to note what I believe to be two very important lessons I learned while working on this update:
    I made both of these up myself, but they make so much sense to me now and I will always keep them in the back of my head when making games in Unity from now on. Before this update I didn't follow either of these, my player was always in my main scene and I relied on things like Find("Player") etc. to locate him and add references to and from him, and my main UI had a billion references to everything and everything had references to it so even though I had prefabbed it the prefab was meaningless because the prefab only worked in this specific scene. When it came time for me to split my game up into multiple scenes I was boned. Refactoring around these things not only made my game a lot more robust in my opinion, but it makes it much, much easier to add multiplayer both local and online to my game at a later date because nothing in my game assumes there is a specific game object named "Player" present at all times anymore.

    This update has made me really consider turning this into a real game just because of how many new things I've had to learn working on it and in term how much more confident it has made me in terms of actually making a production ready game. I've had to learn about serialization, both binary and XML, scene loading, both normal, asynchronous and additive, data persistence and scriptable objects. Even though I've worked with Unity for about 10 years now I've never even looked at these subjects before.

    Saving and loading data was a lot less intimidating that I thought it would be. At the moment I'm using XML serialization for my save system and I'm just saving a single file to the Application.persistentDataPath which seems to work perfectly fine both on Windows and Mac which is where I've tested it. I started out with binary serialization after watching this official tutorial on persistent data:

    But I then realized I wasn't able to serialize vectors, quaternions etc. using that approach so I switched to XML serialization instead which I found a neat tutorial about on the wiki:

    At the moment I'm not actually saving anything requiring vectors or quaternions, but using XML allows me visually inspect my save files which is really cool and helpful at least when I'm learning about this.

    Currently only your character's inventory, equipped items, health/mana and gold values are saved, but I want to make it such that the main town is always persistent and any changes you make there is always saved. And you should have the ability to save multiple characters and decide which character you want to play when you start the game. Settings should also be saved and probably independently of your characters.

    I also have an idea for a potentially unique online save system as well as full-on multiplayer so I'm sure the save system will be rewritten many times before it serves all my needs.

    Scene loading
    Before this update I only had one scene, which is the case for all my projects, but I knew it would be clumsy to try and manage everything I wanted to do in this game in the same scene so I had to split it up into multiple scenes. At the moment I have a start scene which contains all the persistent game managers. This scene also instantiates the player character when the scene loads to serve as a template for either your new character or you loaded character data. In this scene you can either choose to start a new character or continue with your saved character.

    Then the game loads into the town scene, but keeps all the persistent managers etc. from the start scene as well as the instantiated player. Here you can trade with vendors or choose to enter the dungeon. The dungeon is kept in its own scene and is procedurally generated every time it is loaded.

    At the moment after you've chosen a character you can only go between the town and the dungeon. Later I need to make it possible to go back and choose another character or start a new one without restarting the entire game.

    Even though all the scenes are loaded fresh every time you go between them the persistent HUD, player inventory as well as time of day makes it feel connected. You can enter the dungeon during the day and exit when it's night, this will hopefully play a bigger role later on.

    In addition to these 3 main scenes I have 5 more "construction" scenes in which I assemble various prefabs and objects. I have one dedicated to my UI so I can work on the UI as one big prefab and then just duplicate the game object, turn it into a prefab and overwrite the prefab that is actually used in the game. This is a very neat workaround while waiting for nested prefabs in my opinion. And then another scene for all the characters in the game and 3 that came with the Dungeon Level Kit asset which has all the separate elements used to make the dungeon.

    Procedurally generated dungeon

    This is how the dungeon looks inside the editor when I'm creating the various rooms, directly in the scene that goes into the final build. With a lot of procedural generation approaches this would just be an empty scene, just like in my Reap port. This is what makes this approach so intuitive in my opinion.

    I knew from the start that I wanted a more curated approach to procedural generation where I piece together hand crafted rooms rather than create everything procedurally. I think most, or at least a lot of, games these days go with the curated approach probably somewhat because it's easier to develop, but also because it's just a lot more predictable and in my opinion interesting for the player. There are some games where the latter approach works, but they are few and far between. Anyway, the curated approach is really easy to wrap your head around if you just break it down. You create prefabs just like you normally would inside Unity and then you write code that places these prefabs for you, that's all there is to it. If you go with a grid based approach like for example Spelunky where each room has the same width and height then placing the rooms is as easy as just placing them next to each other in the grid. In my case it's almost as easy, but allows for a lot more interesting layouts.

    The way I approached this was highly influenced by the lack of nested prefabs in Unity. If I built a room from mesh components like walls, floors etc. and then wanted to have prefabs in that room like torches complete with particle effects and point lights I thought that I would surely needed nested prefabs to be able to put multiple copies of these rooms into my dungeon scene while at the same time making sure the original rooms were editable, but as it turned out I didn't need that.

    The wrong approach
    My first idea was to use scenes as top level prefabs. I.e. put one room in one scene and then load these scenes like prefabs into my main dungeon scene. This is where I tried additive scene loading. I would have a bunch of scenes named like:
    • Room_3x3_2doors
    • Room_3x3_Entrance
    • Corridor_1x1_2doors
    • Corridor_3x3_4doors
    And then I would load these rooms where I would normally instantiate a prefab. By having everything inside the room scene under a single game object I could make sure to place that game object correctly after I loaded the scene and it would work the same was as instantiating a prefab.

    This approached worked perfectly, but I didn't like it for 3 reasons:

    Firstly it was really clumsy to make changes to my rooms now. The rooms were completely separated from each other so it was hard to copy something I had made in one room over to another room and if I wanted to change the scene lighting in a room scene to see how that would look I would have to update the lighting in every other room scene afterwords and then make sure the main dungeon scene used the same lighting as well. Unity has multi-scene editing now, but I think this is clumsy and worse than just editing one scene at a time.

    The other reason was that it's not possible, to my knowledge, to retrieve data about a scene before you load it. I need to know how big a room is before I load it into the main dungeon scene because I need to know if it will fit in the dungeon where I intend to place it. I didn't want to load the scene, read the data and then discard the scene if the room can't fit, that felt messy to me. So I decided I would use scriptable objects to hold the data about each room. That way the main dungeon scene could know in advance the data about the room before it loaded it because the room and the main dungeon scene had references to the same room data assets. This approach worked, but now I had a separate data objects holding the data I felt belonged to the room class from the start. The room class only kept a reference to the room data now, which I again felt was clumsy.

    The third and most important reason was that with this approach each room was contained within a separate scene. I knew I wanted a "sandbox" scene where I could test to see how my rooms fit together and design rooms based on the design of other rooms. This meant I would have to keep the rooms (that were not prefabs because of the reasons listed above) updated both in the sandbox scene and in their respective room scenes. I had to make sure I only updated the rooms in one scene or the other and then always copied the changes to the other scene. Again, extremely clumsy.

    Trying to work with this approach for a while made me look for alternatives because it was just too clumsy for me and it had too much overhead. What I ended up with was so much simpler and so much better in every way that it makes me laugh when I think about these previous attempts.

    The correct approach
    In the end I deleted all my individual room scenes and my room data scriptable objects as well as my old main dungeon scene. I then renamed my sandbox scene where I had assembled all my rooms to see how they would fit into my new dungeon scene. I then made a hierarchy where I had all my rooms under a "SourceRooms" parent like this:

    Every child of SourceRooms is a complex hiearchy with dozens of prefabs, walls, floors, colliders, monster spawners etc. just like a nested prefab would be.

    In my RoomManager script I removed all the scene loading code and rewrote it such that it at runtime just gathers every room under the SourceRooms parent into an array and then disables the SourceRooms parent. This makes sure the actual scene is empty at runtime even though I can use it as much as I want to try out dungeon designs and room designs at editor time. And another neat implication of this is that if I deactivate a room under SourceRooms it won't be added to the array for available rooms and thus it won't be used for the actual dungeon generation. So I can experiment freely with various rooms and then just deactivate those I don't think are ready yet.

    And where I would normally load a room scene I just instantiated a room from my source rooms array. The revelation that made this possible for me was that an object doesn't have to be a prefab to be instantiated, you can instantiate anything! I honestly have never considered this before. That meant I didn't even need nested prefabs anymore. I can just have my rooms in my main dungeon scene without them being prefabs. I just have to instantiate the top level gameobject and everything follows just like a prefab. At runtime the result is identical, Unity doesn't care. I guess this is my third lesson learned while working on this update:
    This gave me everything I wanted in such a neat little package. No additional scenes, no scriptable objects, no complexity of any kind. Just edit my dungeon, my lighting, my rooms and everything else just the way it would be if I was designing a static, hand crafted dungeon right there in my dungeon scene and when I press play it just works.

    As for the algorithm itself it's also really simple. It starts by placing my entrance room:

    The bounding box, visualized by the largest blue wire cube, is used to check for collisions with other rooms when rooms are placed. The smallest wire cube (next to the stairs) is the pivot for the room and the wire sphere with an arrow specifies the connection point and connection direction for the next room. The yellow wire cube is a doorway which will be replaced by a wall if there are no more rooms to place.

    My entrance room has one connection point, which is just a transform marked as such. Then the the level generator shuffles the array of available rooms and checks if the first room in the list will fit if it's positioned at the position and rotation of this connection point. If it won't then it checks the next room in the array. When it finds a room that fits it just places it at this spot:

    Here you can see that the pivot for this new room is placed at the connection point of the entrance room.

    And then it runs the same procedure for this new room:

    This room has 3 connection points going in all directions, but that doesn't matter one bit, in this case the level generator just performs the same step 3 times instead of 1. The yellow wire sphere is a monster spawn unrelated to this, it's just a prefab that's part of this room.

    The beauty with this approach is that the connection points can be at any position or orientation and it will still work. They could point straight up or down or at any weird decimal angle and it wouldn't matter one bit. I currently have no need for them to be anything other than right angles, but the system supports it if the need arises. It also means my level can have as much or little verticality as I choose. At the moment I've designated the rooms to either be corridors or rooms and the level generator always places these one after each other.

    I think this system is brilliant to be honest. I can't imagine a simpler system, but at the same time it makes it so easy to visually design your dungeon as well. And there's zero overhead. You do everything in the scene that's included with the build and you don't even have to turn your rooms into prefabs, just leave them in the scene and the level generator will sort it out for you when you press play. And there's no limit to how complex your level can look. A room could even include a Unity terrain with canyons and cliffs and it wouldn't care.

    Here's an example of the end result:

    I use a really simple trick for the making sure you can't see the outside walls of the dungeon rooms. This trick requires that my rooms are on a fixed grid, but at the moment they are. I just iterate over a large area in the XZ plane and raycast directly down, if I hit something I do nothing, but if I don't I instantiate a black quad. And I close it off by combining all the black tiles into a single mesh for performance. This was extremely effective and looks great in-game.

    Keep in mind that I only have a very limited selection of very boring rooms at the moment, but as I expand the room selection I expect this algorithm to be able to create some dungeon layouts that are very fun to play again and again.

    Hopefully this helps someone else in a similar situation because it really made me think about object management in Unity very differently. I will use this approach for a lot of things in the future.

    I don't consider all my attempts at this wasted time either because now I have experience with so many subjects I've heard so much about before, but never looked at myself.

    And if you try the game let me know what you think. The roadmap hasn't changed and the next update will contain a lot of things that hopefully will make the game fun to play. So far I've only tried to get a robust framework in place, but the content and gameplay hasn't really been implemented yet. I want to add character classes, abilities, experience, leveling and talents and I want to add a lot more monsters and loot.

    And I want to give a shout-out to the Dungeon Level Kit, the real star of this update:!/content/35681

    I got this asset for free as part of the Level 11 program, but it's insane value for your money. It's extremely optimized, everything shares the same materials and texture atlases so it batches extremely well and it's so well suited for procedural generation because everything snaps together perfectly if you work on a unit grid (hold CTRL while you move stuff in the editor). Clearly, a ton of work has gone into this asset. I just knew I wanted to try it because I had received it for free, it was just luck that it was so well made and worked so well.

    All the changes for version 0.2.0:
    • Implemented a procedurally generated dungeon. It's accessible via a set of stairs right next to the town.
    • You can now save your character and continue later. All character stats and carried items are saved when you exit the game.
    • Added a start menu where you can choose to start a new character or continue with your saved one.
    • The item tooltips are now a lot nicer thanks to TextMesh Pro. Replaced all UI text with it as well.
    • Added atmospheric fog to the town and the dungeon.
    • Added separate footstep sounds when you're in the dungeon. Later I will make these based on the current material/texture you're standing on.
    • Done some work to the camera setup to match popular games like Diablo 3, Path of Exile and Heroes of the Storm, i.e. similar games I have installed at the moment.
    • Added a temporary debug HUD for the camera so you can see the current camera rotation, tilt and distance. Pressing R resets the camera.
    • Holding the ALT-button shows the full item tooltip for world items.
    • Removed the temporary setting for changing day night cycle speed from the settings menu. Currently it's 10 minutes in a full day and time runs even when you're in the dungeon so you can enter during the day and leave at night. Will add a clock of some sort later on. Time of day is going to matter for quests etc.
    • Removed the zombies and chests from the town, for the time being this is a safe zone.
    • Done some major refactoring all over to make the game work with multiple scenes, this also brings me closer to potentially adding multiplayer to the game as well.
    • Changed the outline effect back to what I had before because of performance issues with the new one. Will investigate further at a later date.
    • Done some major optimizations to the game.
    Last edited: Apr 24, 2017
    yaezah and PhilippG like this.
  30. StevenPicard


    Mar 7, 2016
    This is a great example of how to use Unity Store Assets for your game properly. I've seen games that I recognize as having Unity Store Assets where the games looked fun, well done and cohesive (I don't like styles being mixed.) Those are ones I'd pay to own and play.

    Good job!
  31. TwiiK


    Oct 23, 2007
    Thanks. :) Hand drawn fantasy RPG stuff is probably the most consistent style out there so that makes it easier as well. It seems everyone tries to mimic World of Warcraft or that's just how these things end up looking when you hand draw textures and create low poly models.

    If I decide I want to turn this into a real game then I'll do a polish pass on everything and probably create or redo a lot of models and textures myself, but for now what I have works well enough together.

    I have a ton more weapons and monster models that I want to add to the game, but there's a distinct lack of free humanoid characters suitable for my player or people to inhabit my town. I may have to buy a pack to fill that gap. My character doesn't really work for what I have planned, I need a more traditional humanoid. :)
  32. yaezah


    Dec 15, 2016
    That looks amazing ! Sorry for the noob question , but how did you make the items fly out of the enemy on death and drop on ground? I've been looking for a tutorial like that everywhere.
  33. Rin-Dev


    Jun 24, 2014
    The basic gist of it would be to have the item as a prefab with a rigidbody and collider. Then use instantiate to make the item appear on the enemies death. From there, you could do something like addforce to shoot the object up on spawn. In the simplest way

    Code (CSharp):
    1. public int health;
    2.     public GameObject loot;
    4.     public void LoseHealth(int num){
    5.         health -= num;
    6.         if (health <= 0) {
    7.             health = 0;
    8.             Instantiate (loot, transform.position, transform.rotation) as GameObject;
    9.             Destroy (this.gameObject);
    10.         }
    11.     }
    That's the most basic way to handle it.
    yaezah likes this.
  34. TwiiK


    Oct 23, 2007
    Yep, what Shiro_Rin said.

    Below is my exact code.

    On the zombies, called when they die:
    Code (csharp):
    1. void ThrowItems() {
    2.     for (int i = 0; i < numberOfItems; i++) {
    3.         WorldItem worldItem = ItemGenerator.Instance.CreateWorldItem(items[i]);
    4.         worldItem.transform.position = transform.position + new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(0.5f, 1f), Random.Range(-0.5f, 0.5f));
    5.         worldItem.GetComponent<Rigidbody>().velocity = new Vector3(Random.Range(-2f, 2f), Random.Range(4f, 6f), Random.Range(-2f, 2f));
    6.         worldItem.GetComponent<Rigidbody>().angularVelocity = new Vector3(Random.Range(-720f, 720f), Random.Range(-720f, 720f), Random.Range(-720f, 720f));
    7.     }
    8. }
    On my item generator:
    Code (csharp):
    1. public WorldItem CreateWorldItem(Item item) {
    2.     WorldItem worldItem = Instantiate(item.worldItem);
    3.     worldItem.item = item;
    4.     return worldItem;
    5. }
    All the numbers for position and velocities are pretty much chosen at random and depend on the mass of your rigidbodies. Or maybe mass doesn't matter when you set velocities directly, I don't remember. :p

    But most ARPG games, Diablo 3 and Path of Exile at least, play a hand made animation for the items when they drop instead of using physics. I may do this as well if I ever decide to make my game multiplayer. The reason is of course that having to sync physics across the network is less than ideal and if you don't then the items won't be in the same spot for all the clients. Another reason is that sometimes my items may land in undesirable locations, you'd avoid this if you didn't use physics.

    Edit: Also, you need to rethink the way you approach problems if you've been looking for a tutorial to do this exact thing. Nearly every single Unity tutorial shows you how to affect rigidbodies with forces and velocity and there are plenty of examples in the scripting documentation. Your curiosity should be enough to get something like this based on even the most basic example like this one:

    You should ask yourself: "What would happen if the velocity was random? On one axis or all axes?" or "How would it look if there were many rigidbodies?" or "How do I make them spin? Is there a velocity for spin?".

    I'm just saying this because learning how to break problems down into smaller components, how to acquire knowledge, i.e. search for stuff, and how to experiment are the most important things you can learn when it comes to programming or game development or a lot of things in life. :p
    Last edited: Apr 28, 2017
    Rin-Dev and yaezah like this.
  35. Rin-Dev


    Jun 24, 2014
    I've been using AddForce for mine
    Code (CSharp):
    1. Vector3 direction = new Vector3 (Random.Range (-1, 1), 1, Random.Range (-1, 1));
    2. _item.GetComponent<Rigidbody> ().AddForce (direction * 100);
  36. yaezah


    Dec 15, 2016
    Thanks for the help and insight! Still very new to Unity and and definitely agree with you on that. Sometimes I get stuck on a problem because I'm not sure what to search for in the first place (Now I know to search for "manipulating rigidbodies" instead of "How to make loot jump out of chest in Unity" ) lol
    Rin-Dev likes this.
  37. hitmanchoi


    Apr 10, 2015
    I'm very impressed how everything is from the unity asset store and you still maintain decent quality and nothing really seems out of place. if you could somehow run it in mobile it's definitely sellable.
  38. TwiiK


    Oct 23, 2007
    Feels kind of awkward writing this post again, but it was lost in the forum rollback which happened just after I wrote it originally so I don't know if you saw it or not. :p

    Thanks. :)

    Whether or not this becomes an actual game is still very uncertain, but if it does it's never going to mobile though. If I'm ever going to make a mobile game I want to make a game that I think is suited for mobile. I feel like a lot of popular mobile games these days just aren't well suited for mobile at all, and I would consider a game like this completely unplayable on mobile. Perhaps most mobile gamers don't have access to other gaming devices, I don't know, but I know I would never touch most of the games they play.

    But for the time being I'm only working on things that are suited for games of all types in a variety of genres. The only thing defining this game at the moment is the art and thanks to the beauty of free assets I've barely spent any time on that at all.

    Update: I've updated the original post with all the assets that I'm currently using. Had to do this again as well. :p
    S4G4N likes this.
  39. TwiiK


    Oct 23, 2007
    Version 0.2.1 is out!

    I've decided to split the big 0.3 update up into smaller bite sized chunks and this update introduces leveling to the game, at least in a very basic sense.

    Currently I'm working on abilities. I will implement 4 basic abilities for the current character before I tackle classes. I make everything up as I go so nothing is set in stone. Here's a teaser:

    Ability description copy/pasted directly from Diablo 3 for the time being.

    The reason I decided on 13 levels (ref. the list of changes) for the moment is because I want you to be able to put 3 levels into each skill, and you start the game without a skill point. My first attempt at this will be very similar to how it's in most MOBA's like League of Legends or DOTA. I don't want you to just spam an ability like in popular ARPG's like Diablo 3 and Path of Exile. Your normal attack should be your main source of damage and you need to use your abilities at the correct times to get the most value out of them, at least that's my initial idea.

    Changes for version 0.2.1:
    • Added experience and leveling. Killing zombies now give experience. There are currently 13 levels and each level rewards you with 10 health and 10 mana and 5 attribute points that you can spend freely on upgrading your attributes.
    • When you level up you explode pushing enemies away and damaging them.
    • Fixed a bug with saving/loading of health and mana, and saving now saves your experience, level, base attribute values and available attribute points as well.
    • Added a damage overlay effect.
    • Reworked the HUD quite a bit. Added an experience slider and 4 buttons to access the character sheet, inventory, settings menu and reset the camera.
    • Moved the audio listener from the camera to the player. This ensures more consistent audio levels. Most ARPG's seem to have it this way, but most ARPG's don't allow free camera movement so I'm not decided how I want it yet. I may just restrict camera movement myself.
    • Fixed small bug with the highlighting.
    • Fixed bug with tooltips.
  40. TwiiK


    Oct 23, 2007
    I've uploaded two more videos of the game to Youtube and I've created a playlist for the game.

    The first new video showcases the changes in version 0.2.1:

    And the second showcases a full day night cycle in the town which I think looks really nice now with the new atmospheric fog:
    igorhideki95, yaezah and PhilippG like this.
  41. igorhideki95


    Oct 31, 2017
    any update ?
  42. Baiano22


    Nov 14, 2017
    How the project is going?