Search Unity

Voxel based sandbox survival: Forgotten Lands

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

  1. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I switched -from- iGUI to NGUI. iGUI had a neat approach, but I found dev support to be dropping, and you only had access to the compiled dll...no source. Sort of a dead end there, imo.
     
  2. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Oh I see, misread that :p

    Well, I will take a look into NGUI some later, currently my drag drop solution is fully functional (fixed the last bug yesterday evening). So I'm more than happy with that :D

    Now I can focus on the crafting again, was thinking about dragging the ingredients onto the gameobjects in the scene. For example: if you drag some nails onto a plank on the ground you get the option to make a barrel. The problem is this will probably end up making a seperate script for almost every gameObject. Or does someone have a better idea?
     
  3. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Well...a couple of thoughts...if you are focusing on single player, you may have a real, real hard time switching to multiplayer in the future. Especially if you want to support more than a handful of players. The mechanics are just different, because you have a server basically ok'ing and coordinating everything.

    Anyway, as far as crafting...that's an interesting approach. You'd get a dropdown list, showing the items you can craft with a board and nails. Hmmm. It would have to filter the list by what tool you have equipped.

    So, let's say your small barrel takes 10 nails and 6 boards. You drag the nail(s) to the board, get a dropdown list and you pick the small barrel. Like wurm, you create an "unfinished" small barrel container that contains 1 board and 1 nail, but requires 9 more nails and 5 more boards...but the player doesn't see that. They just see the unfinished barrel.
    Every time they craft a nail or a board on the unfinished barrel, it checks to see if that is what it needs and adds it to its contents. When it gets enough, the unfinished is remove and replaced with a finished, with no contents.

    I don't think you would need a script for every item. You just need to define the recipe for each item. Having scripts handle each crafting situation would -work- but it's a dark road to go down. You may want to consider a more OOish approach.

    Consider having an Entity class or something, defining a new one for each item in your game. It would store things like the item type, weight, damage, ownership.

    Create an EntityType class. It defines information about TYPES of items. Boards are type 03, they have a default weight of 20. Small Barrels are type 12, they have a default wieght of whatever. They are containers.
    Create a recipe class. Recipe #1 is for item type 12 (small barrels). It requires a hammer as a tool (type 47), and two components: 10 of type 3(boards), and 6 of type 7 (small nails). Until it is finished, it shows an item of type 22 (Small unfinished barrel). You have have a skill of 3 in carpentry to make one.

    Have a CraftingManager or something, where you pass in the recipe and the starting items. It just follows a generic recipe to create something, instead of coding EACH situation. So when you pick a recipe from your dropdown (small barrel, large barrel, filtered by the tool and components), you call this function and it looks at the recipe requirements and just creates the small unfinished barrel, putting the crafting components inside. Every time you craft, you call a function giving it the target item (Small unfinished barrel) and what you just added. It checks the recipe requirements for the small barrel, and when they are fulfulled, it puts a small barrel there instead.

    This way...you aren't writing new code EVERY TIME you want to add a new type of item to craft, to the game. You are defining the recipes, and you only write the code ONCE That handles all recipes.

    Personally...I get out excel, or some spreadsheet app, or whatever, and I just write out the recipes for a few, different types of items, and work through it. Is it free flowing and intuitive to the player? Do the rules, the logic of it make sense?
    You have at least two different crafting scenarios: Crafting simple items, like a hammer, and crafting multistage items, like a barrel or a cart. The unfinished multistage items are actually containers, that contain the components as you work, they are just hidden from the player. That's how wurm does it, and I'm somewhat following the same approach :)
     
    Last edited: Jul 14, 2012
  4. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks for the advice! Your comments always make things clear ;)

    I was also thinking about an excel approach, but I've no idea how to let unity interact with it's contents. I could make some kind of "unfinished item" class which keeps track of the needed materials and gets attached to the gameObject as a component. Probably also want to store ToolTypes like hammer, shovel, saw etc. This way I can have more than 1 kind of tool for the same purpose (for example, an upgraded version of the regular axe).

    I'll play around with this for a while ^^
     
  5. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    You could use a database also, there are some solutions in the asset store. I use MS Sql express right now...but that's only on the server side, which is .Net and not Unity.
     
  6. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Well, I'll look into that later. What is kind of bothering me right now is the item icon you're dragging is being overlapped by the GUI.Windows. But I don't think I can change that due to the way OnGUI does things...
     
  7. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I uploaded a new video of my progress so far. Here it is:

    I recommend watching in 720p and make the screen bigger


    Some features are not shown in the video, but I wanted to show you the best improvements :D
     
  8. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I'll be going on holiday tomorrow, so I won't be able to post any updates for the next 2 weeks (and possibly working on the project neither) So yeah, see you in 2 weeks!
     
  9. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I'm back from my holiday! Haven't done much to the game since, only support for backpack inventories. But I hope to get some things going on soon :D
     
  10. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Good job on this one so far : )
     
  11. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thanks, I'm currently reworking the GUI a bit. Will put a screenshot here in a minute ;)
     
  12. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Well here it is:



    Not completely happy with it yet. Still have to fix some things. I also had an idea about different GUI styles:

    Assume there are different tiers of technology in crafting. So for example, you would start off with the gui showed above. When you "discovered" iron (smelted it and crafted something out of it) you would enter a new tier, unlocking a new GUI (automaticly switched, but you're able to choose your unlocked gui's) So your iron age gui might have a complete different look. This is something for the future though, but please tell me what you think about this idea :D
     
  13. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Looks very nice! Now you just have to get rid of the numbers and add some icons ; )
    I think its a cool idea, you should try it. But i agree its nothing you should put high on the todo list atm : p
     
  14. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Oh silly me, those numbers represent the slot number when they are empty. Here is a screenshot with items in the inventory:

     
  15. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Ok I finally got a crafting prototype working yeah! :D It is very basic though and doesn't support alot of features in the game yet. I do have a simple recipe editor, which is pretty neat. Still have to find a way to save the recipes and load them up on the start ( probably XML? it won't need to change at runtime )

    Also, trying combinations there is no recipe for will cause a bunch of errors, so still need to do alot of null checking and bug fixing ;)

    Hope to be able to show some action soon :D
     
  16. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Yes, show me when it works ; )
     
  17. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    After a bit of strugling I finally got saving and loading Recipes working. Only loading will be used in runtime, saving only in the editor. Also trying combinations which dont exist won't throw errors anymore :D Have to test non-editor builds yet..
     
  18. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Here is a video of some live action, as promised :D

     
  19. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just to notify you, here's a quick update :D

    I'm currently trying to make a deer as the first animal (note the use of "trying" here :p)

    So, here is a screenshot of the current progress


    I'm still having some problems with the anatomy, but I guess I'll figure it out eventually. If you see something weird about it, please tell me :D
     
  20. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Another quick update:

    I've started on a basic physic-based combat system. Here is a screenshot from the editor:



    Basicly, when the attacking animation is played, the weaponMount will send raycasts in forward direction, length based on the weapon length. When it hits a GameObject it checks if the gameObject is an enemy, and if so, a message will be send with data as the position of the hit, the velocity, the weapon that was used and things like that. Then, the GameObject reveiving the message ( actually the bodypart with the collider ) then calculates the damage taken based on the given factors, and sends a message to the root GameObject of the enemy to tell it was hit.

    Some thoughts on how I want it to work:
    different "damage types", such as slash, bludgeon, pierce, will create different types of wounds on the hit Bodypart. When the bodypart gets a certain amount of that type of damage, it will have consequences for that bodypart. So for example, alot of bludgeon damage on the leg will cause a broken leg. Alot of pierce damage will cut a hole in the hit bodypart.

    Now I have a question for you guys:
    What do you think about how the overall "health" of the player and enemies should be managed? Should I just sum up all the total damage of the bodyparts, or should the legs count less for the actual health, but slow you down alot with walking and such, and let the chest and the head deal with most of the health?

    I would like to hear your inputs :D
     
  21. blacknirvana

    blacknirvana

    Joined:
    Aug 16, 2012
    Posts:
    60
    Fun little game, look similar to what I'm working on (using the same tutorials :) )

    The name should me something like "Wonder of the Middle Ages", that way people could call it WotMA, always cool when people talk about games like that, "...have you tried WotMA it's awesome!"

    Great work, keep it up and look forward to seeing your deer in action.
     
  22. LargerEagle

    LargerEagle

    Joined:
    Aug 15, 2012
    Posts:
    59
    Do you need any help with the game? I'm a 3d modeler and UV-unwrapping. If so
    Email: legofan4444@gmail.com
    Name: Joel McKay
    Age: 16
    Skype: minecrafter44
     
  23. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I apologize for the lack of updates past weeks. School has started and is asking alot of time from me atm. For the little bit of time I can work on this, I'm trying to figure out the voxel terrain ( mainly the marching cubes mesh generation ). I also cleaned up the code a bit, removed things I'll never use etc.


    Good point. I will take this advide into consideration :) and thanks for the kind words!

    Well I'm interested in your help, but I'm not going to hire anyone. I'll contact you via pm ;)

    So yeah, I don't have alot to say anymore.. Oh wait! We do have a chicken now, but it's not textured yet...
     
  24. Vanamerax

    Vanamerax

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

    I've finally tracked the unity crashes I got from my horse movement script and it's fully functional now, hurray! :D

    I don't have a horse model yet or anything like that, so nothing to show unfortunately..
     
  25. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Phew,

    Finally got some Voxel terrain working :D Started with the Minepackage ( thanks jc! ), but noticed the Y and Z coordinates were reversed, so after alot of refractoring and adjusting it's finally working again. So what's next? Probably some helper methods to communicate with terrain more easily and then connect everything up with the rest ( digging will add stone/dirt or whatever you're digging to your inventory and stuff like that )

    It's still a minecraft-like cubic world though. Have tried implementing Marching Cubes, but no succes as of yet..
     
  26. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just wanted to say I'm still working on the project :D

    Spend some time optimising the voxel terrain, bought a new faster computer ( I can now generate a new world within 11 seconds with my new 8 cores processor :D )

    I'm hoping to add some more interesting gameplay soon. Already implemented a block hardness system: Stone will be harder to mine than dirt, it takes more time and higher mining skill will speed up your mining ( and give you higher quality ores/stone in the future ).

    This world needs some animals fast :)
     
  27. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Have spend some days rewriting some of the GUI code. I scratched the "wurm online-stylish" way of being able to have different menu's and windows open at the same time, dragging from one to another. Now I'm going with an inventory window, with additional "tabs" where you can see your skills, equipment and items. Container windows will also feature an inventory window which you can drag to and from.

    I also plan to rely as less as possible onto an inventory. For example, you would actually have to drag logs around, drag them onto your cart, instead of picking it up and putting it down elsewhere. The idea of having a stockpile full of items in your pocket isn't that realistic in the first place. :D

    Still nothing to show atm, unfortunately.. The GUI is still in progress and not yet completely functioning. Just wondering what do you guys think of the new aproach and ideas? :D
     
  28. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    What GUI are you using? I'm using NGUI, it's nice but I wish it were a little more WYSIWYG. But UI is probably my least favorite area.

    I don't mind the inventory windows as much. Though, I think your idea of dragging items is a lot more interactive, but it might get tedious if you have a lot of items to move. I guess you could always stack stuff eh?
     
  29. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I'm using the plain unity GUI system. I know it's not the best option, but I don't have the money for NGUI and the standard GUI is working fine for me as of yet.

    I didn't mean I dropped the whole dragging idea. I dont want multiple, independant screens opened at the same time, as this can confuse the player. I will probably have some container objects, if I want to continue the actual moving of objects.

    For example:
    You can drag items onto a cart, which you can attach horses to, to drag the cart around and so move alot of items at a decent speed.
    You can attach ( small to medium sized ) bags to your horses, this way you can travel faster than with a cart, but you can obviously drag alot less items around.

    Heavy or big objects may not fit in certain containers. You can put seeds in your bag, but not a log. Also fluids will need a watertight container, like a barrel. ( may also apply to things like sand )

    That's some of the ideas I have in mind :D
     
  30. Tharkys

    Tharkys

    Joined:
    Feb 13, 2013
    Posts:
    1
    You know, I just wanted to say this is pretty awesome considering you started with nothing but an idea and the will to design a game. I've really been wanting to try and do something similar. I'm going to keep an eye on this. I hope it turns into something viable or playable!
     
  31. Vanamerax

    Vanamerax

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

    Really the determination to learn this stuff has motivated me to actually try it. Especially programming is something I like (if I don't keep getting stuck with 1 single problem and keep seeing progress in my game) although it is something I know a lot of poeple don't like doing.

    Currentlystill rewriting my GUI. It is coming along nicely now. The inventory is more user friendly while playing than before and also programming-wise. Will upload a new video soon when I think it's polished enough to show (have to track down some bugs)
     
  32. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    The new GUI system is pretty much in place (finally).

    Hunting down the last bugs and trying to solve some resolution related problems (I have been designing the GUI for a specific resolution in my editor, so the resolutions are some kind of a problem )

    When those things are solved and fixed I'll post a new video showing the new GUI features :D
     
  33. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Update!

    Added update #4 video in the first post :D

    Please tell me if you like the new way the GUI works. Also, what should I add/work on next? Voxel terrain? Improve crafting? Cooking? Hunting? Combat?

    Let me know :D
     
  34. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I think you have a nice flow going with your UI. Looks like you've put a lot of work into the drag/drop, selection, etc. Very nice.

    Is the world mostly static, and stored on the client, or is it all streamed from the server?
     
  35. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Correct, a lot of time has gone into the GUI dragging. To the end user it may seem very obvious that such features are present in a game using inventories, but is still quite hard to achieve in the unity GUI system. But I'm glad I did this rework. Not only visually have things improved for a player, it also has coding-wise.

    Instead of tons of if-else statements considering every kind of object storing items and being able to open a GUI of, I tried something new. With the help of interfaces I now just let the GameObject implement from IContainer, implement it's basic features and let the rest of the Monobehaviour do whatever you want with the item list. This is alot easier since the GUI script only has to take one IContainer into consideration and an inventory. Each of these will also only be drawn once each frame, so I can enable/disable displaying them and change the position of every frame whenever I like. So I learned something new there! :D

    The real pain though is when dealing with different resolutions and aspect ratio's, which is still not perfect in my rewrite. In the resolution shown in de the demo video (1024x768) it's fine, but 1920x1080 for example still needs some work. But I've decided that I want to take a step back from the GUI and start working on something else. It fits it's needs for now, testing things with the GUI is alot easier. Still have to decide on the next thing to add/improve.

    Which brings me to your next question. The terrain you're seeing in the video is just standard Unity terrain, nothing special. No server yet. I've done some test runs with Photon Networking. Someone was willing to help me test the connection over the internet, since I don't have acces to port forwarding my own. It worked perfectly and I can connect to myself via LAN just fine. I'm not sure yet if I want to implement multiplayer already. I think it is still beyond my abilities as a programmer, but I would like to learn how to do networking. The earlier I convert my game to multiplayer, the more fun the testing will be and I won't have to rewrite everything in order to suite multiplayer. Although I could keep multiplayer on my mind when coding, and implement it later. Not sure...
     
  36. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Still trying to think of a fun way to do smithing. Currently I have some kind of "runescape setup", but I'm not happy with that. Any ideas?
     
  37. iWoundPwn

    iWoundPwn

    Joined:
    Feb 16, 2013
    Posts:
    212
    Looks good! Following now :D
     
  38. Lexe2014

    Lexe2014

    Joined:
    Mar 26, 2013
    Posts:
    11
    logQuality = 1 to 100
    skill is a big factor, so logQ * Skill, skill also has a maximum ofcourse
    Then factor in luck on the ToolQuality, wich together, will have less weight in the equation.


    Plank = LogQ *skill + (ToolQ*Luck)/2 ----> (devide it by something so it has less effect than the skill)
     
  39. Scrach

    Scrach

    Joined:
    Mar 18, 2013
    Posts:
    46
    I actually like the look of the game, im just wondering if you followed a tutorial for the basis of the GUI or if you we're self taught, if you followed a tutorial please can you direct me to it? (i am making an RPG you see :D)

    As for names, uhm.... Call it something like 'the setting of your game' 'divinity'
    so if it was medieval, Medieval Divinty I don't know, great work. ill pin this thread to my homescreen so i can check up every so often :)
     
  40. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Wow, thanks for the interest guys! Much appreciated! :D

    That sound like a good idea. I'll have a go with that, thanks! :D




    I did follow the burgzergarcade tutorials for a basic system (Inventory displaying the items)
    http://www.youtube.com/user/BurgZergArcade

    The drag drop mechanism I made for the GUI, is completely self taught. A lot of time and trial error programming has gone into it, but I'm very happy with the results :)

    divinity, haha, that might sound a bit selfish :p
     
  41. Lexe2014

    Lexe2014

    Joined:
    Mar 26, 2013
    Posts:
    11
    Maybe the lowest possible value is too low.
    It gives a possible plankQuality between 15 and 2500


    View attachment 48235
     
  42. Scrach

    Scrach

    Joined:
    Mar 18, 2013
    Posts:
    46
    Haha, yeah it would.
    anyway thanks for replying :) Ill keep following this and good luck :D
     
  43. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    After a busy week finally I've got some time again to work on the game, seems like we've got some connections going on (hint hint) :D
     
  44. tomislav

    tomislav

    Joined:
    Dec 7, 2012
    Posts:
    5
    do you need help ? i got license for unity pro if you know what whit have it but must teach me! it i know and have autodesk maya so can make something :)
    i give you models and pro license if you teach me something
    sory for bad english
     
    Last edited: Mar 30, 2013
  45. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I've send you a PM, though I don't need your pro license or models ;)
     
  46. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    We are rolling! Got some basic multiplayer going :D I also made adjustments to the main menu to suit the new multiplayer functionality. You can make rooms, join other people's rooms, set your room visible/joinable/ set max allowed players. I've chosen to use Photon Unity Networking (PUN) because it has a simple API and if I need serverside functionality, I can code that in C#. Also the cloud service is a big plus while developing, with a max of 20 users. I don't have acces to my router settings so this is a huge timesaver for me :)

    Now I need to go about keeping track of scene-owned objects. This isn't handled the way I like in PUN, so I will have to make some adjustments to that I guess. Hope to get something showable soon :D
     
  47. prefix

    prefix

    Joined:
    Sep 26, 2011
    Posts:
    88
    Good job on the inventory. Are you saving the information to a server or locally? Just curious. I know its tough and takes some time, but its coming along well! Good luck to ya!
     
  48. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Thank you! Currently there isn't really any saving going on yet. Only the inventory and player stats are somewhat "saved" to the disk in singleplayer via PlayerPrefs, but I will change that to normal binary file writing when I've completed byte serialization of several things (like Items), which can also be used to send over the network. I haven't decided yet on server saving. I was thinking about letting the master client handle all that, but as I think about it, when the master client leaves the room, all the saving is handed to another client? I'll probably need to have a master client "host" the room. So a player wanting to host a game room, should have 2 instances: 1 dedicated to server things like saving the game, and gamelogic itself, and the other client, just like other connected clients, play the game for the user. Much like how terraria does it. Will have to take that into account
     
  49. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Just wanted to let you guys know I'm still working on this project. School work is almost over so I'm getting more time I can use for Unity. In the mean time, I have been adding some minor features such as headbobbing and sprinting, revisiting the Item system, improving multiplayer functionality (serialization of Item inheritance, rerouting Photon RPC's when offline mode is enabled etc.) and adding a very early concept of cooking food in the 3D world

    more info coming soon :D
     
  50. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Looking forward to that : )