Search Unity

Voxel based sandbox survival: Forgotten Lands

Discussion in 'Works In Progress - Archive' started by Vanamerax, May 22, 2012.

  1. Tesla-Coil

    Tesla-Coil

    Joined:
    Oct 30, 2012
    Posts:
    171
    This sounds interesting. Good luck on the project advances!
     
  2. NikoBusiness

    NikoBusiness

    Joined:
    May 6, 2013
    Posts:
    289
    Very Nice man keep it up! good work , i really like the combat system!
     
  3. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks for the nice comments guys, keeps me motivated :)

    I'm finished with school for this schoolyear, so I can focus more on game development. I hope to show some images of current progress later this week, then I'll also sum up the changes
     
  4. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Well, that took waaaaaay longer than I had expected, but finally it is here:

    Update # 5

    I uploaded a video showing the main features and added a (long) read for people who are interested in how it all works :D




    Item system
    The item system has got a major internal overhaul. The biggest part has been rewritten from scratch to make it more code-friendly, consistent, modular and extendable. First of all, there is now a central Item Database which holds all the items and attributes that can exist in-game. Items now require an Item ID, based on that ID the right classes are instanced by the ItemGenerator. Instead all the class initialization (finding the right subclass etc) the code is now as easy as

    Code (csharp):
    1.  Item item = ItemGenerator.Create(itemID);
    which makes everything a hell of a lot simpler and shorter too! Not only does the code simplicity increase, sending Items around over a network, serializing and deserializing has gained a much better structure. Since the items now have an item ID, this can be simply looked up locally and again the correct values can be assigned.

    Other than using Item ID's and a database now, the inheritance of classes has also been changed significantly. Before the change, items where evaluated at their classes (for example Weapon, which derrives from Item, would get it's damage values). Now, each class implements one or several interfaces. Like the new Food class, implements IHeatable which means that it can be heated up in a heatsource (more about that in a later paragraph). Each interface has it's own set of variables and each subclass only handles these variables differently. This way, we only have to check for the interfaces (not the actual variables) and don't have to worry about the classes themselves.

    Player movement
    Player movement has been improved to add more realism. The camera will now make a headbobbing movement while walking (this can however been turned off in the options menu). Players can now run when they hold shift while walking. This will result in more headbob movement (and also slightly faster) which makes it more noticable. Footsteps have also been added (the sound is a cheap placeholder for now)

    Cooking
    Cooking is an important part of this update. In order to get this to work properly, I had to rewrite the item system as described above. With the interfaces taking care of extra variables it is now much easier to change the behaviour of certain objects. Not only raw food can get cooked with heatsources, cooked food could also get burned when it has been exposed to heat for too long. Talking about heatsources, these are another thing that have been added. It is basicly a trigger area which sends heat messages to objects inside it's range. It is easy to add different kind of objects that react to heat. Wooden objects for example, can burn when they are hold or thrown into a fire and adding to the source's fuel value.

    Grabbing objects
    Pickup objects can now also be "grabbed" by players. This works very similar to for example in amnesia, where players can move the objects in a simple way. While an object is grabbed, they can also be rotated with the mouse while holding the right mouse button (which will also disable the other player controls to prevent looking around while rotating).

    GUI
    As far as GUI is concerned, I have made a few changes to better fit the new Item system. Chests and other item containing object now share the same properties so the GUI can handle them in the same way. The classes that steer a certain object inherit from the IContainerInventory interface (I may rename this) where the GUI can acces the list of items, add items to it etc. Now the class that inherits the interface can do whatever it wants with their items. A chest will only store them, but a forge will also heat the items when it's lit. The benefit of this is that the GUI is now modular and easily extendable (just implement the interface and you're ready to go)

    Not only the inventory interfaces have been improved, now there are also icons that indicate certain interactions. When you're looking at a chest for example, it will show a "open chest" icon mid-screen. Anvils will display a crafting icon, pickup items display a grab icon and then there is the general interact icon (seen with the crankwheel for example)

    Furthermore, some bugs have been fixed like the tooltip displaying it's correct background size when there is a lot of information on the tooltip.

    Wooden cranks
    Wooden cranks are a special interaction item which will later on serve a large variarity of purposes in the game. As of now, it will control the pitch of the ballista. I plan on using the cranks for a lot of features like gates, ropes, you name it. It will be part of some "standard interaction tools" together with probably some levers, buttons, pressure plates, tripwires and such. They can be easily operated with the mouse or player's body. The crankwheel will need a rotational movement, levers vertical movement etc. Interaction can be started and ended with the player's interaction key (default E, will probably change because of other features). Buttons will probably only need a press on the E key, while pressure plates and tripwires will be triggered when the player walks on them.


    Changelist
    And finally, the actual changelist:

    - Changed the item system: it now uses an Item ID and a database. Item's values related to
    the particular item will be automaticly assigned. This increases the code flexibility and reduces
    the amount of code

    - Because of the new Item ID's, the multiplayer serialization was much easier to do: objects that hold items
    are now correctly synchronized over the network, when a player joins it will send it's state to the new player.

    - You can now grab objects, drag them around and rotate them with RMB

    - Added a new mechanism regarding heat sources, this will aid in the ability of cooking and smelting etc.

    - Fixed tooltips background showing at a wrong size when there's a lot of content in the tooltip

    - Fixed the lighting processor for the voxel terrain, still contains some bugs though

    - Added running ability, you can run by holding the run button (default LeftShift) while walking forward

    - Added a head-bobbing movement to the camera, while running your camera will move more and faster

    - Added footstep sounds

    - Added mid-screen icons to indicate interaction

    - Chest interface and implementation has been generalised (no more seperate cases, forge and chest work the same)

    - Added a wooden crank, with rotating you can change different aspects (like the ballista pitch), more applications coming up
     
  5. primus88

    primus88

    Joined:
    May 14, 2013
    Posts:
    611
    Here is my feedback.
    - Please change or remove the footstep sound. It is a heavy sound which becomes annoying fast. Instead you can use a simple broken leaves sound. You can find lots of samples for free.
    - The idea with grabbing and holding items is great and somewhat unique in video games (it is a feature rarely used). I see it working great for crafting, but how will you use it for fighting, mining or cutting trees ?
    - I understand that the systems are now in development stage, but I'm thinking that you should use tools for your crafting (frying pan for the food, hammer for blacksmith / forge etc). I don't know who can keep food over an fire with their bare hands :p

    I can see this going very far because the base systems are very interesting (I love systems based on physics). It only depends what you decide to implement next. Making a game too realistic can take away from it's fun fact, so you must be careful how much realism you throw in there :)

    Good luck
     
  6. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks for your constructive feedback and I agree on your points. Let me clearify some of my plans:
    - The footstepping sound is indeed far from perfect and will be undoubtly changed (as stated before, it is just a placeholder to just "show" the concept)

    - The grabbing feature won't be used in fighting, mining or cutting trees. When you grab an item, you will "put your equiped item away" and take the object with your hands. I want to implement this a bit similar to skyrim and mount blade, where you put some items in your quickly accesible, let's call them, toolbar slots. By scrolling the mousewheel you can switch between them (maybe you get 2 to 4 different slots, have not decided this exactly yet) plus switching to your bare hands which happens automaticly when grabbing objects. I find the grabbing a bit too slow and unreliable for anything like mining and woodcutting, so I will stick with equiped hatchets and pickaxes for that. The grabbing feature is moreoverly meant for a simple way of moving and rotating objects into place. I may use this approach for something like building in the future though.

    - I see your point and I also had thought about that. I think I will implement some penalty on cooking with your hands (taking damage and more chance of burning the food). Pans will decrease the burning chance, but I would like the player to require at least a stick or something to put to food on before they start cooking it, similar to a marshmallow.

    For smithing, I think I will probably require the player to equip a hammer in their hands, have several craft-helping objects in the neightbourhood (anvil, barrel with water for tempering, forge etc) and maybe even a toolbelt with different kinds of finetuning blacksmithing tools. Still, I want to prevent a dead-lock for new starting out players early in the game by only giving them 1 way of accomplishing things (you should be able to take several paths really)

    And yes, I try to be careful getting "too realistic". Though I have to say sometimes decisions can be pretty tough ;)

    Thanks again for your input!
     
  7. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just wanted to leave a note here that I'll be on holidays for the next two weeks, so you guys probably won't hear much of me during that time. :p
     
  8. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I'm back from my holiday so I can (hopefully) continue with this project again :D
     
  9. Tesla-Coil

    Tesla-Coil

    Joined:
    Oct 30, 2012
    Posts:
    171
    Welcome back and hope you had a good time!
    Eager to see how the project develops, last update where some great adds again!
     
  10. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thank you! I'm currently working on the terrain engine (which has been going on for some time now in the background) and finally starting to get results. I have to add material-based submeshes and rewrite the chunk updating system though before I can really show anything. But when it is all finished, it will turn into an interesting update :D
     
  11. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just wanted to drop this in quickly,

    At moment I am implementing a way to initialize items and crafting recipes through XML. Since I basicly broke the crafting with last update (change to item ID's etc) I had to redo it anyway. I can load crafting recipes from XML now, which has a few advantages:
    - easier intigration with the unity editor (it just edits the xml files, which get loaded on runtime)
    - Great modding support. Mods can just add their own files to the directory and let the game serialize new recipes from there

    Next step is to create and store item data in XML. Currently everything is just hardcoded and I want to get away from that. I'm thinking of using "ItemSets", each itemset has it's own XML file with ItemData elements, dependencies, etc. Then at runtime, you can enable and disable every installed itemset (probably define this on creation of a new world). It's a boring bit of programming really, but when it all works it could be pretty awesome :D
     
  12. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    Hi, nice project you have, i like it.
    Are you planning to put temperature?
     
  13. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thank you :D

    Yes I am actually, the actual temperature will be based on current biome, weather conditions (and maybe depth in the world you are in for caves, not sure yet). Body temperature will be affected by environment temperature, plus the protection from your clothing, maybe your physical activity wether you are near some kind of heat source or not. Fireplaces, torches etc are examples of heatsources
     
  14. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Sounds very similar to my game : D
    Nice to see that you are still working, to many potentially good games gets abandoned these days : p
     
  15. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    That's very cool, it's like my system then ^^
     
  16. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
  17. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Of course I'm still working on it :p, currently the progress is just painfully slow and boring..

    Well, thanks, but I already had tree cutting implemented (it is shown in some video's) :p
     
  18. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    I know that feeling all to well : )
     
  19. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    guess we're in the same boat then ;)
     
  20. PixelHeadHD

    PixelHeadHD

    Joined:
    Jun 4, 2013
    Posts:
    93
    Very interested to see more on this, looks like it will be a very enjoyable game :p
     
  21. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    What voxel engine do you use?
     
  22. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thank you! :D I'm trying my best. Hope to show some new stuff soon when I get it to work

    Well, I'm trying to roll my own. I started with the free MinePackage that can be found here in the forum to start from, but I have modified it a lot so I can pretty much call it my own. It isn't fully functional yet though, so I there isn't much to show you guys. I'm currently reworking my item system to load and save from xml files and creating a nice editor for it (spend a week trying to figure out Unity's PropertyDrawer logic, eventually ditched that and making my own drawer classes)
     
  23. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just a quick update that my item database editor is coming along nicely. Xml saving and loading is working now. Only have to integrate it into the game and tidy things up a bit. Currently I decided to still load icons and gameObjects from the Resources folder. I may change it later to support external modding (so you can just place modpacks in a folder), but that would require me to either make a complete model importer or develop my own file format, which I don't feel like being important right now. Hell, I don't even know if I'll ever release this to public, so why bother the modding support for it? I can always change it easily later on :)
     
  24. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    I love the cooking system you did, you can do a shader for make the food a little bit dark when it's cooked.

    Keep it up, also good luck with the name, i think is the most difficult thing in a game xD
     
  25. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks, the shader is a good suggestion. I've done some shaderwork, but I'm still very beginner in shader code. I will definitely try that out at some point. Was already thinking about a "glow" or emissive shader for smithing metals :)

    I guess the names are the difficult ones, as I still have no clue on that :D
     
  26. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Maybe you can just change the material color instead?
    Should be easier : )
     
  27. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I could do that too, but meh, the cooked version of the meat is another item id in it's whole. I'll probably just extend the framework later on to include custom shaders and change it's parameters based on item attributes, such as heat, damage etc.
     
  28. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Quick update:

    Finally got the dynamic loading of Xml files working in the editor as well as at runtime. Now on to type specific variables and crafting recipes :D

    $5q4YE.png
    $5q5qi.jpg
     
    Last edited: Nov 22, 2013
  29. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Saving and loading of crafting recipes are working. Have to revamp the original crafting mechanisms to account for multiple inputs and outputs and check for item IDs instead of names, as the internal runtime cache uses the ID's and a name lookup table. This makes searching through recipes a lot faster. Furthermore, I have to extend the database functionality to include "item categories" and the ability to use those as input. Sigh.., a lot to do for something that seems that simple..
     
  30. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Man, I feel your pain. Back when I started my project, I had all these...IDEAS. And it was gonna do this, and it was gonna do that. But ideas are so...insubstantial. Turning ideas into reality means creating them, one.character.at.a.time. And it's even harder than that. Those characters have to actually make things happen correctly. And then you realize...argh that crafting approach isn't as awesome as the voices in my head made it sound!

    But I think you are really taking the right approach, by using IDs. May I suggest using uints for individual items ids, and ushort values for the type ids. Not sure about your project, but in mine I decided I probably wouldn't have more than 65k individual -types- of items. But I could have millions of items of those types. The Dictionary class has become my all time favorite data structure.

    I absolutely love your approach to cooking, to me that is an example of an elegant and direct approach, that involves the player in a great way.
     
  31. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks Jc! I still owe you some :D

    Yes, using item ID's for the individual items saved me so much trouble and will save me a lot of trouble later on for multiplayer networking. Instead of sending a whole string with variable length, I can just send an int plus any different attribute (QL, weight, damage). I have thought about using uint instead of int, but I came to the conclusion that I probably won't ever have 2^32 items in my game, and neither 65k. So I decided to just go with regular ints, which saves me a lot of casting and converting from int to uint and vice versa. I think the performance savings is a better compromise than all those extra item spots, which you won't even reach. The consumer's computers are probably more bound to the data that comes with each indivdual item, such as 3d model, texture, icon, attribute data etc. Hell, those attributes should be kept in memory during gameplay while also running a voxel world!

    I like my cooking system as it is now, but there are a few problems with it I see getting worse in the future:

    - Right now, it isn't really multiplayer friendly as you would have to sync those rigidbodies in some way throughout the different clients. When having only about 10 items laying around, no problem. But having hundreds of items can get a real pain. What's more, is that I also want a fully functional voxel world running, maybe including wat simulation and whatnot.

    - You are basicly cooking with your bare hands, as stated before. I want to make sure that pans, pots, plates and other cooking tools actually have a useful purpose. There should be a reason to make them, other than decorating your home.

    So, for now the current approach works fine. But I want to change it a little bit later on. The inventory will also get another overhaul, to make better use of bags, belts and a (small) hotbar for switching weapons quickly. Like, having a few slots (max 4) for weapons when you've got a belt and be able to scroll through those. Maybe a sword and pike on your back, or quiver and bow, you name it. A toolbelt wouldn't hurt either, as nobody likes equiping a lot of tools in a repeating sequence. I like the way wurm handles this, but belts are way to hard to get there. Anyway, more on this to come. First gotta finish up those editors :)
     
  32. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    Sounds good all of these, i want to see how the voxel engine will be, i'm not very expert on code so i can't do it haha.
     
  33. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    It currently looks like a pile of unorganized code crap, I have a lot of refractoring to do, removing old stuff that I don't need anymore, some things still need to actually work. So yeah, lots to do :D

    I will finish up the item database first though
     
  34. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    Small steps make a big step, if you need something maybe i can help you :)
     
  35. Divinux

    Divinux

    Joined:
    Jul 5, 2011
    Posts:
    205
    Apart from the fact that I love survival/sandbox/minecraft, it's pretty motivating to see you at it for so long, great work!
     
  36. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    That's right, one of the most important things to keep in mind while programmer, if you ask me :)

    Sure, maybe I'll contact you just to show off some behind the scenes things and just to have a little chat :D

    Thank you! For me the things I've shown in my videos are just the top of the iceberg. There is a lot going on under the hood. I'm making sure that I won't be making code design choices that will put me on halt later on. A solid framework is important in my opinion :)
     
  37. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Update on the editor

    Finally done with merging the crafting and item database editor. They now work together nicely. Only improvements I can think of now are:
    - auto handling of item ID's. Currently you have to set them manually, but this also gives you better control and let you stay consistent. Not sure if I will implement this at all.
    - Drop down menu for recipe ingredients/products instead of entering the item id. This makes it a bit more user friendly and you won't have to jump back and forth between the item and recipe list. I will implement this later, but want to focus on more important things first as this "works fine". This feature is just for convenience
    - File backups when updating. The editor should revert the files when an error happens. Also not of high priority right now, as I can do this manually too.
    - Support for multiple item sets and add dependencies. Currently I can only work with 1 item set. This if fine for now, but for absolute modding support this has to be implemented. Not of really high priority as I don't need it yet..

    $5FbW0.png
    $5FbYp.png
     
    Last edited: Dec 8, 2013
  38. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    945
    Nice : D Keep it up
     
  39. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Update 6 - Voxel terrain

    It has been some time, but finally got a new update out! This time about the new voxel terrain engine and the XML serialisation of the item system. There have been lots of rewrites under the hood, which unfortunately don't have to show much new things for the end users, but ensures that I won't hit a wall later on in development. The new system is very extensible and flexible :)

     
  40. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I hope to get a new video update out soon, as I decided that I want to make a video update every month or so
     
  41. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    Hey man looks great! How did you do the picture selector in the editor? I can't find it in the classes to save my life, as it doesn't seem to be in the EditorGUILayout or GUILayout.
     
  42. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks :) The new video will show a visually much improved terrain engine. I hope to get that one uploaded this week.

    For the editor, it was a bit tricky to find out, but this is what I use:
    Code (csharp):
    1.  
    2. template.Icon = (Texture2D)EditorGUI.ObjectField(textureRect, template.Icon, typeof(Texture2D),false );
    3.  
     
  43. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Update!

    In this update, I'll be covering the improvements made in the voxel terrain engine. It has quite noticably changed since last update :)



    To moderators: Can you please change the thread title to 'Sandbox survival: Forgotten Lands' ?
     
    Last edited: Apr 20, 2014
  44. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I'll be on holiday soon so progress will be a bit slower upcoming weeks
     
  45. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Im back from holiday and going full steam ahead with development again :)

    Thanks moderators for changing the thread title!

    So, the working title currently is 'Forgotten Lands' which I think fits decently for a survival game, and also sounds a bit medieval-fantasy alike.

    In the meantime I have implemented some object placement by the terrain generator. It currently plants palm trees. When you remove the ground underneath the trees, they will get notified and start to fall. I hope to get a video update out by the end of may, which will show this in action

    $8GICe.jpg
     
    Last edited: May 10, 2014
  46. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I want to make a video update soon, but I have to finish and fix some thing first, before I can show you anything. Stay tuned!
     
  47. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    So I figured I could update your guys with some news. Currently I am reworking my item system (yes, again) to use a component based model instead of using inheritance. What this essentially means gameplay-wise, is that each item can have multiple functionalities. A good example for this is a knife.

    A knife can be used as a weapon obviously, but can also be used in crafting as a tool (think carving knife for example). Besides that, you could also throw it to your enemy, in a sense that a 'throwing knife' would. Now with the previous system, I could only specify an item as either a weapon, or a tool, or a throwable, but not both or all of them.

    With the new system I can. To get this working I basicly had to rewrite the whole serialization process and a good part of the editor. It has taken me some time but I'm happy with the results so far. I will try to also implement some features to show that the system actually works. (may try to add the feature to throw stuff around, work some on the combat and crafting etc). This will take some time, so a video will probably have to wait.

    Stay tuned!
     
  48. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Nice. It's very satisfying to end up yanking out a system to replace with something even more beautiful, isn't it?
    Nice looking scene!
     
  49. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    haha yes indeed. I always come up with a better implementation right after I just finished the previous one. :)

    Thanks!
     
  50. iceicetonne

    iceicetonne

    Joined:
    Aug 5, 2014
    Posts:
    9
    good work!
    i will keep a eye on this too ;)