Search Unity

Honey Hex framework

Discussion in 'Assets and Asset Store' started by MuHaGames_Avee, Aug 28, 2014.

?

If the hex framework was available on the Asset Store...

  1. I would not be interested in buying it - it's not good enough

    2.0%
  2. I would not be interested in buying it - I wouldn't use it

    2.0%
  3. It's interesting but needs more features (please write details below)

    9.8%
  4. I'd pay for it no more than $20

    25.5%
  5. I'd pay for it no more than $50

    35.3%
  6. I'd pay for it no more than $100

    17.6%
  7. I'd pay more than $100

    7.8%
  1. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    Okay. Thanks for the reply.

    I'll get back to you after I try that.
     
  2. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    By the way, would it be possible for you to provide a guide on how to get those characters and the village shown on the map, like in the thea the awakening game?

    I roughly understand the methods you mentioned, but just a simple tutorial (e.g. which script to use, to change, add, the steps needed) can be really helpful to get me started on the right direction. :)
     
  3. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    AndyMul: There is no simple way to do this. You can't just modify a couple lines of code to spawn buildings. However you can do this:
    1. Choose which Hex you want to place something on top of by using Hex Coordinates. It's a Vector3i where the 3 components are in Hex Coordinate Space. 0,0,0 is the dead center tile in your map.
    2. Get the world position of this hex. Use HexCoordinates.HexToWorld3D and pass in your Vector3i. This will return a Vector3 in world space. The Y component is zero, so you'll need to get the actual Y value by doing a raycast.
    3. Make a raycast from the vector you recieved, aimed straight down. The result will be the Y value you need to plug into your world space Vector3.
    4. Instantiate a prefab that contains your model at the resulting world space. Make sure the prefab is in the Actor layer, or the default world camera will not render it. Alternatively you can create a new layer, and set the camera to render that layer as well.

    This is exactly how I accomplished placing buildings in the game I am making.
     
  4. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    Hi Shane C,

    thanks for the help.

    I have managed to put a house on the map (image below)

    Unity_HoneyHex_PlaceBuildingOnMap.png

    However, as you can see, compared to the terrain, trees, and the hills, the house is not as smoothly rendered (there are some jagged lines).

    So my initial question was how I can make this building, any other structures, or character objects to blend nicely with the environment..
     
  5. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Trees are smoother because they are sprites which get bilinear interpolation advantage by default (shader drawing them sample 4 pixels at a time)

    Your house border isnt more jagged than any other mesh on the world but you should provide some ambient occlusion to merge it better with the world.

    It could be done by either painting color on the ground/building where they are in connection or by camera posprocess. There are other more complex approaches as well but those two are most commonly used.
     
  6. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    Hi Khash,

    I tried the post processing method, using unity image effects, but it ended up affecting the house and the whole environment as well. I used anti aliasing and the house looked better. However, the environment became really blurry.

    I am not sure how to isolate the image effects post processing to the house itself.

    The other method that you suggested, painting color on the connection between the ground and the building, how do I do that?
     
  7. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    I guess this option may require advanced programming skills writing your own shaders and modyfying those on the world. You can get some easier effects by allowing shadow casting by your objects with almost zero work, but this is consuming sizable amount of resources (shadow casting is a heavy process)

    You may as well increase resolution to get better quality image and /or render to twice size of your screen and then shrink(eg you target screen 1024x768 then you render by 2048x1536 and then ). It would make natural antialiasing with no blure side effect but would require a lot more resources.

    The best cheap effects you can get are usually ways which allows you to color your model and surrounding with ambient oclusion and burn light/shadow to it and stop processing it further more with the light.

    But its all about the way you plan to make you project
     
  8. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    Okay.

    Thanks for the more detailed info, Kash.

    I'll try to go from what you suggested and research more into it. Hopefully I can get the house and buildings to look good.
     
  9. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Btw: What makes those black areas on your map?
     
    Johnny-Casual likes this.
  10. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    "Btw: What makes those black areas on your map?"

    From the looks of it, i would think its a black / missing terrain texture blended into the map?
     
  11. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
  12. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    Hi, are there anyone who tested the map made by this Honey framework also can be run on iOS device?
     
    Last edited: Nov 15, 2014
  13. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    39
    Yeah, like what Lennartos said, it is mostly because of a missing texture on one of the tiles.
     
  14. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Depending on the device, it will work. I've tested on multiple Android devices, and while some work, some don't support the texture size needed to generate the map at runtime. The Galaxy S3 for instance straight up crashes unless I force dx9 mode, force opengl 2.0 es, and reduce the texture size to 512 (This produces a very unacceptable result). The Note3 and Galaxy s5 are fine with the default settings. I don't have any experience with iOS devices yet, but I'd imagine it's the same story.
     
  15. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    Thx for reply.

    I Have questions.

    1. What you mean force dx9 mode? At unity's build setting? or Actual phone's setting?

    2. So, relatively old phone doesn't support Honey map? unless lower texture quality to 512?

    3. Can developer devide texture setting as user's phone?
     
  16. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    And I just test on Mac-mini and iPod5, I have no unity ios pro license, so using unity free ios,

    at mac-mini, within unity editor, when [World Generate] button clicked, map generation works well like udner unity pc pro , although actual land seems just black texture.

    But build and run at iPod5 (which is similar spec as iPhone 5S as far as I know), whileas generating world, after make 5 or 6 pieces of land(normally it should make 9 pieces of land), it crashes and just go out to background window.

    I changed texture size to 512, but result is same.

    So, I suspect this because iPod5's spec? ram or cpu?

    And also I tested at Galaxy Note 1, also crashes while generating map.
    But works well at Sony Xperia Z2 (recent phone).
     
    Last edited: Nov 21, 2014
  17. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Yeah, the pro license is required to enable the texture baking. He is doing a render to texture, which is a pro-only feature, and why you are getting no texture on the world. The good news is, if it didn't crash, then once you have the pro license it should work just fine on that hardware.
     
  18. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    Then why crash?
     
  19. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Perhaps you ran out of memory? I suspect it's the same reason the Galaxy s3 crashes.. but if I knew exactly what the problem was, I would probably fix it, as I really want this to work on the S3 ;-)
     
  20. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    2 things:
    - What do you guys get on logs when crash occurs ?
    - how does it behave when you use smaller world (try single chunk and do yo still have problem with crash?)

    Knowing memory budget is top important priority for mobile development, you can track memory usage in Unity Profiler
     
  21. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    ps: android logs, not unity one
     
  22. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Hi Kash
    How is it going with the curent development?
    Also is there a plan for roads in the queue?
     
  23. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Hi!

    I plan to release next month an update, although it would aim mostly for improvements on non DX11 mode because those seem to be of interest of many Honey developers even if Honey is aimed for DX11 devices :)

    I plan number of editor/tool improvements as well but if you guys would like to make "most important" wish list I would of course consider switching some of those (or adding if necessary).

    I were investigating possibility to build Honey for Unity Free (I bet many of you does not have Pro for all devices and would love to see it coming) but it is very big challenge to do so, it works much much slower etc... So don't expect it in this update, sorry ;/
     
  24. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    @Khash Firestorm
    I don't know how to make just single chunk instead of default 9 chunks.

    And I reduced meshdensity variable from 75(default) to 15 or 1, then Galaxy Note 1 didn't crashed when generating map, but there was black map (ratio is approximately 60(normal) : 40(black))

    I didn't turned on eclipse when run on android, so didn't checked android logs. (are there other way to check log when crash?)
     
  25. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    you can use logcat console to connected android device
    adb logcat -d > log.txt

    this would save whole log to text file, and let you investigate issues from the beginning of the current logging history. File would endup in the adb directory (wherever you have it to execute unles you provide more advanced path than the one i gave in the sample)

    It contains everything thought so search may be hard
     
  26. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    To change world size select world in editor and change chunk radius to 0.
     
  27. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    I think Galaxy Note1's black texture is because of lack of Galaxy Note1's Memory. It is 1G DDR2. iPhone6, 6+ also uses 1G ram.
     
  28. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    1Gb of ram seems like enough for small maps. It usually uses about 300 Mb ram for a map of about 9 chunks.

    It might be more problematic if it shares memory with GPU and during rendering it is not able to build/operates on textures.
    One of the targets of this upcoming update is to prepare light weight Oven so that it not only works faster but as well skips some operations (configurable) this way you can easily cut down resource requirements and possibly make it work on low end devices.

    This as well should benefit top end device developers as it would let them easier modify which parts of the system they want to use and which are not required for their project.

    I cannot promise it would work on your devices though, we would have to see
     
  29. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Note 300MB is including all other resources, and calculation is done by unity profiler, the same map scaled to 25 chunk used about 600MB so you should have a lot of space on 1G device for map and game content unless something else artificially limits available memory
     
  30. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    Yes I can abandon Galaxy Note1 users, cuz their proportion is small, but about Galaxy S3, it become hard decision cuz their proportion is big. For iPod5, nearly impossible.
     
  31. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Note: I do not have those devices anyway :) so I will not work on compatibility with those. I'm focused on extending features for non dx11 developers.
     
  32. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Hi Khash, about those phone users:
    Since Directx9 needs a custom shader for the map markers and directx11 needs it anyway - maybe it would be better to focus on a tiny bit <simpler> index based renderer than does the mixing of texture in a shader operation from a few variables stored in a seperate texture. ( 1 pixel / hex - similar to how we did map markers )
    That way the IOS/Phone users wont have such restricted usage, unity pro requirement is gone ( for that shader solution that produces a bit less variation) , and those with need for larger worlds can jump on that wagon as well until we have more complex solutions availible ( virtual texturing etc ) ?
     
  33. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    That is actually one of the things I'm working on as well. I still have to workout performance of it but potentially it would produce interesting alternative to current baking system. But I do not want to promise things which are in theory possible :) but I have to say I'm very excited myself about this approach :). Live baking is something very strange I have to say and many custom cases which we have at the moment in oven would require simplification and possibly discard... anyway wish me good luck :p
     
  34. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    I used 1 pixel / tile with large texture atlas with detail map merging a few times before - looks quite nice, but of course its not truly unique - and i didn't have height to take into consideration.
    Looking forward to your solution
     
    Last edited: Nov 30, 2014
  35. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Hmm It seems I overworked by 4 hours or so ;/ but finnaly tracked down issue with the artefacts on the borders of the hexes (used by markers) it is artefact produced by mipmaps on the graphic texture for markers. Turn off mipmaps and it should be fine :)
     
  36. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Hi!

    It seems I managed to make most of the shader which makes terrain with no baking stage, no texture storage. Which for this matter may work freely on Unity Free. Problem is that it does not support as of yet rivers nor it will do any good deals for for tree system which would stay as it was.

    I have very limited time (I try to keep my work below 12h/day 7days/week and as in my previous post I sometimes fail... and most of the time goes to my real - income work) So question to you is... do you want to have beta of this new system (it would be for now as an additional package to import not the main asset overriding Honey, but would be delivered with honey files)
    Or you want me to spend rest of the time I have for the honey this week with other small changes/improvements for previous system and keep this new system in backlog?

    I have to go back and keep rolling our game we build on honey from next week and will have some time for honey around end of January unless something amazing pops in my head.
     
  37. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Of course I don't speak for everyone, but my suggestion is to finish what you started, give us a beta with what is essentially less resource constraints,larger possible map and unity free support.
    That would be a great boon for all those working on non-windows/multiple platforms ( unity isn't cheap when it comes to that ) or those with a bit bigger vision than only tactical games :)

    I don't see any other bigger issues ATM that need fixing ASAP.
     
    Last edited: Dec 3, 2014
  38. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    First tests show that I can produce world of 14000+ hexes within about 2 seconds (on my pc) and they use about 400 MB. There is little-to-none extra memory cost for increasing world size. But lack of rivers makes it barely acceptable for my own project.

    Good thing is that shadows are updated live. (without light source) so that you can change direction from which shadow is cast (you can simulate day ->.night effect easier)

    Because I didnt get any other voices from others. I will give this system as much love as I can whithin those days. It is a risky development but if suceeds it may bring great results :)
     
  39. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    mhm didnt think of rivers... one could fake it ( flat ), but it wouldnt look as good as now.

    Checking for rivers is of course possible in the shader, adjusting height for them, and then rendering them as seperate pass in the material... but the shader would become quite a bit larger ( not knowing how large it is now ).. and it would take time. :)
     
  40. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    the problem is that rivers would need different mesh to get processed. and in this case it will not work as separated pass for the other mesh

    Note that it is the case for the oven. It could potentialy work with rivers fixed to hex borders but they would lose their taste and natural blend which is achieved by freedom oven gives.

    Oven always can provide same or better quality if compared to real life shader. Simply because it have more time and can do stuff in many stages if wishes. but result is stored in memory which seems "problematic" for some devices with small amount of memory... In the end Honey is targeted to dx11 devices which by default have enough to play at least medium maps
     
    Last edited: Dec 4, 2014
  41. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Of course with unlimited time and resources you can get better results than what can be done in real-time, and with limited resource devices.
    The trick is to cook the knowledge gained from the "best case scenario"(AOT Baking) to the real world ( Realtime ), and make a good compromise that will still create beautiful worlds.
    That is a process that likely takes several ilterations and time, and as with most in our world, there are as many paths to it as there are people in the world.

    No one expects you to find the holy grail in the first try, take your time - do what you can, release often.. and let the community contribute with ideas you didn't think off.
     
  42. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    I have made two modes for new shader. Blending and not blending. Not blending one is very light in case mobile devices does not like heavines of the new complex shader. I still could shrink the main shader but I would need to know how mnay instructions we are too far in it to have an idea if its possible.

    Those new shaders uses exactly the same resources (so you can simply replaces shaders on divices which cannot support enourmus number of variables required for blending) and can display the same world you had with normal Honey (so if you have hex data produced you can use old baking honey or use those new shaders.
    Not blenging shader is limited to work within single hexes but faster (it is simply an LT mode) both shaders manage to go down as far as to about 50MB of memory for world assets but I'm not sure how unity profile is reliable for it
     
  43. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Khash - it sounds good.
    But how about sending a few screenshots of the results / differences?
    Im really looking forward to seeing how it looks.

    I will need rivers for my project, and following hex edge is just fine by me for a first revision... ( a bit smoothness / randomization is welcome - but first and foremost i just need a framework i can start building the map on ) and of course have the ability to check in code if there is river between hex a and b - A* pathfinding will also need access to that.
     
  44. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    New shader have two versions. One with blending and one without. There is not "part blending for free" option.

    But during development I have done some simulations and I think the best way to get rivers is to use both systems (old and new) in a mix.
    - Using only 256x256 height produced by the old system one can identify rivers simply by detecting height, and it may save whole vertex precalculation for height.(making it cheaper)
    - Simplified baking should be enough to produce it using "grab frame" style which does not require RTT (Unity pro)
    - Diffuse comes from new shader, either blended or not which depend on resources available.

    I think this approach may let you achieve all you want with one go, but if you want it before I prepare whole codebase for it you will need to code it yourself ( I will help you if you stuck with something)

    Result should be both fast and very light and Unity Free... but its a lot of work.

    If you need info about hexes which when you cross the river you may grab river data before it get postprocessed. You want to go through this list. Each point have 3 neighbors. When two following points have two common neighbors (which is always true except last point which endup in middle of the ocean) traveling between those two hexes is crossing the river.

    I'm dropping you a screenshot form this under development system. Note that water shader, trees or scrolling have not been adjusted to this system yet. It does not require a lot of work each, but there was little point in it for incomplete system.
    I expect only experienced developers would benefit from this system before it is finished and those should not have problem with use of what this new system offer (but I can offer some assistance if required as well ofc :)
     

    Attached Files:

  45. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    The blended version looks pretty decent, you have to imagine the hex map markers on top, but once i "see" them on there i do have the feeling that its a acceptable compromise to remove the resource usage.
    Shader wise im assuming its still quite fast compared to advanced shaders ( ie: you are just using some basic rotation & some randomization and then texture lookup neigbors for blensing ), so if anything we can still add more graphic fidelity to it later.
    The non blending version... well... might be good for mobile use - but pretty, it is not. :)
    I dont have any rush - i can stick with the current system and test my code in small scale for quite a while yet.
    As it stands now i have several high priority projects in the queue before i can continue on this, so i can only offer a few hours now and then to see if i can help with this.
    It seems i broke my system here by updating honey, getting stalls during terrain generation and weird terrain chunks - got to figure that out first ( new scene works fine)
     
  46. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    Blending shader is many times more complex than the "LT" version.

    Performance:
    GPU----------------------FullShader--------LT Shader
    GeForce GTX 760-----0.5 ms-------------0ms (too fast to get any spike)
    Radeon 5950-----------1 ms----------------0.3ms

    It is expected that weak gpus may not be able to handle complex shader at least before I find way to optimize it to use shorter list of variables and switches (old GPUs hate conditional switches much more than current one) Also shader heavines is drawn mostly from vertex shader texture sampling which I will not need in further iteration which would most likely follow design of blended Honey1 and Honey2 systems.

    Note that rotation etc uses exactly same data which were provided before in Honey1 but instead of rotating textures I do rotation on texture sampling using trigonometry. and do blend using data available in special additional texture. There is many math tricks to give it a kick to work and I tried to not waste to much registers but result is reasonably complex to get this quality, which is to be expected. You could simplify them if for example you will not need some of the features which are part of this system, but its usually per game basis, and some may be happy with one while other developers may require full list. It is easier to strip shader from unwanted parts than writing them when required. That is why I decided to provide you with all possible features instead of just those which I like more than other :p
     
  47. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    1ms with radeon 5950 means we should see around ~3ms with intel integrated graphics (Intel HD Graphics 3000)., around the same as with last gen high phones ( snapdragon 800, phone 5s ).
    Doesnt sound too bad.

    I will take a look at the shader once you made them availible.
    The design as i see it should be very similar to our map markers, having a texture "lookup table" that defines terrain on neigboring hexes, which thus is easy to index +-1, and then lookup pixels in the texture atlas to blend.
     
  48. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    I would not say "easy" it took me few hours to find algorithm which returns positions for all three hexes which blends in defined area, but yes it works on the same basis as the markers. It just goes one step forward. and have special variation which is workign as well on vertex shader.

    Ah and btw. Its on the store by now :) so "get latest"
    Note that all the new stuff is in special package in "under development" directory or something.
    This package contains whole framework from development branch which I suggest to unpack to new project to have a go. You should not mix under development code with your current project guys!
     
    Last edited: Dec 10, 2014
  49. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    1,825
    Hi.
    So you recently updated honey.
    So I re-tested with Honey2WIP scene at Galaxy Note1, but at loading stage, it does not end. Infinite loading screen. Why?

    -> after 5~10 minutes loading, scene loaded, but after press (generate) button, just flat square plane appear. (No landscape things)

    But overall, memory usage seems more optimized, very optimistic, good job.
     
    Last edited: Dec 11, 2014
  50. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    86
    How big world did you generate? You should keep size of the world in scale you want to use, as it will produce a lot of hex data. It would be great if you could profile what was the reason for long world generation, it may be something worth looking at with next iteration