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

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

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

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

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

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

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

    8.3%
  1. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Side note (for nerds like me, if you are not a nerd then do not read this post :p):

    I have calculated probability of single chunk to get exactly the same result. And I count as the same result if none of the hex is rotated more than 12 degree (1/30 of 360) between two compared chunks. Is the same type (and we have only 5 terrain types) and I assume that hexes layout is by default identical on both chunks (so no lowering probability by this)

    you will get two identical chunks every:
    37217369341926110700000 chunks :D

    If you produce 10 chunks a second it would take you 118 * 10^12 years. Our universe exists for 14 * 10^12 years so as you can see it is a problem to get two identical chunks as a common place:p
     
    tim_unity922 likes this.
  2. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    hehe, yeah thats a lot of chunks :)

    As you say streaming is a solution, and I have been playing with sparse virtual texture and forcing openGL ( im on windows 7 ) - but that's pretty much a dead end unless unity allows opengl as default on windows ( it always picks DX unless started with --force ).
    Then there is the amplify virtual texture component - but that one likes to have the mesh inside the editor... and its coslty.

    So what im working on right now , is to figure out if i can "save" the chunks as they are after creating the world into the scene / or even better allowing the world to be created in the editor with the click of a button.( either way: no baking time when loading level )
    Not sure if get more time to work on it this week, as this week is pretty swamped.

    For me the detail of the mesh and texture are more than enough - i would never try to do first person with it anyway :D
    So the LOD idea with lower detail mesh ( if more than one level then maybe baking trees in the texture?) over several chunks would be a REALLY nice addition as i see it. ( especially since you only stream textures that are in the view to the GFX card - keeping performance intact, while just occupying OS Ram)
    Thats all in all the absolute simplest solution for now - keeps hardware demand low.
     
  3. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Also nice to see a progress report of whats happening on your end - thanks for that.
     
  4. MuHaGames_Avee

    MuHaGames_Avee

    Joined:
    Feb 25, 2013
    Posts:
    25
    Hi all,
    We mentioned earlier that Honey is a base for our game. Today we started Kickstarter campaign for Thea: The Awakening - link: https://www.kickstarter.com/projects/muhagames/thea-the-awakening

    Please consider backing us, if you pledge at least £50, as an addition to other bonuses, you'll get Honey for free.
    But - if we reach £25k in pledges Honey will be free for everyone :D

    Even if you decide it's not your thing, consider spreading the word, we need your support guys!
     
    Sammual likes this.
  5. MuHaGames_Avee

    MuHaGames_Avee

    Joined:
    Feb 25, 2013
    Posts:
    25
    Hi again,
    We have submitted 1.2 update to the Asset Store and it is pending approval.
    This update adds load/save map functionalities as well as map markers (thanks Lennartos!). Also added is the ability to re-generate world or its parts in runtime + a couple fixes.
     
  6. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    hi i just bought ur asset and its really looking nice. can u guys give me some tutorial on like how to chance tiles in coordinates i like. example i would to chance mountain in coordinates [1,2,1] to plains how could i do this kind of editing?
    thank you in advance
     
  7. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    If this is map generation stage then look for GenerateBasicWorld function in World class. You will need to supply terrain type you like at those coordinates.
    If this is at runtime you could do it or wait few days. There is coming update (1.2) which have an example of how to rebake single hexes. What more it have many memory improvements and fixes around world rebaking so its really nice.
    I'm not sure how many days it would take Unity to process submission in which case I cant give you exact number of days when it will show up on Asset Store but we have send it so it would be "any minute" ;)

    Note! position you have written above (1, 2, 1) does not exists in hexagonal space! (consult pdf documents in project root if you want to understand why)
    Sum of all components of hexagonal position are always equal to 0 so eg:
    (1, -2, 1) is valid, (sum == 0)
    (3, 4, -7) is valid, (sum == 0)
    etc
    but (1, 1, -3) is not valid , (sum == -1)

    in which case you can always get third component of vector by calculation eg: z = -x -y;
    This redundant position data is very useful for many other complex calculations and can be easily abstracted from user.

    If you need to have some kind of clasic positions just use 2 elemets of hex position (eg x, y) and they will always stay unique so there is no 2 hexes which are at x = -7, y = 3. Because there is only one Z which can work with those two (z=4)

    Look as well in Hex class, as it have some code comments and "code images" explaining position system.

    If you struggle to get some transformation to Hex world or from hex world then its your lucky day because there are classes which do it for you (and many other calculations as well)
    Look for:
    HexCoordinates (all different form of transforms between 3d world an hex space either exact hex or floating point within hex space. Used eg by trees or charactersnot alawys moving between hex centers)
    HexNeighbours (finding radius of hexes, nerby hexes etc...)

    Hope this gives you a bit of head start! :D

    Cheers.
    Ps Vote on asset store please! Better score means more sales; more sales gives me more push to put even more time on this project! ;)
     
  8. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    ok thx for the info :D i try to play with it and see if i can get something done :) i will surely vote after trying it for few days :) i think i wait for next release to start learning :)
     
  9. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    1.2 is up.
    Nice changes on the map, i see that you cleaned up up my idea a bit. :)
    255 icons *4 layers is a good limit to have - although i will still make them grey and then supply a color for each layer.

    Some notes:
    • There seems to be some bleeding with the hex borders when using map markers between hexes around it ( not the one you painted ).. most notable is the green color from the dot if you zoom in and move map around a bit around some hexes you painted)
    • Coloring trees is nice, but would have been nice to store the original color in the foreground data - OR add a separate alpha value. ( reason: unit enters hex - make trees 50% transparent )
    • Feel free to copy paste my code for mouse wheel zoom into your solution as well - it feels weird that nothing is happening when using mouse to zoom out / in
    • Ability to change chunks during run time is really nice, good work... but the chunk pop up is annoying.
      I tried to exclude it from view, with small improvement - but it seems it would be a better idea to keep a small chunk pool alive as on demand baking instances ( or create it on demand when baking is requested ) and do it behind the scenes ( layer = baking ), and then switching the chunks out when its done baking... this approach could be refined to slowly merge the differences so its ready as a spell effect for your new game ;)
    • Virtual Texture Managers like amplify are definitely out, as long as the textures and meshes are not available in editor ( they dont have options to add textures at runtime as far as i have seen )
    Question:
    Is there a reason why water isn't just one separate entity hat fills the entire view / map?
     
  10. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    I think color multipliers can be done easily by simply assigning 2x2 pixels for each hex instead of 1x1 which means texture 256x256 will be suitable for map up to 128 high which is very huge anyway, and by simply using a bit bigger texture you can get insane huge map limits for this feature.

    I think the bleeding could be an calculation artifacts which most are killed by this advanced rounding we have, but it seems It still need some improvement for margin values. Thanks

    Color thing for trees is an example for how to update trees, I though about switching texture but endup modifying color. I think it may have dozens of other uses like making plants grow from turn to turn, removing foreground when road pass through, removing trees from village or other custom object area. Burning certain area of trees..... Its up to gameplay what type of changes to do and What I wanted to give you guys is working backbone which shows how to do this update.

    Yes I planned to add mouse zoom in/out but forget it completely

    And yes, rebaking chunks could use some store/blend during baking time. But hey. It finally works and opens many many new possibilities!

    Can you say something more about this:
    • Virtual Texture Managers like amplify are definitely out, as long as the textures and meshes are not available in editor ( they dont have options to add textures at runtime as far as i have seen )
    I'm not sure what the problem is.

    As for question
    no, actually that may be a good solution (less instances, and it will work exactly the same :D ). Th efirst idea behind this was to remove water from chunks which doesnt have water level high enough, but it cost almost nothing to have and making it one big water will make it nicer :D
     
  11. wudi1988

    wudi1988

    Joined:
    Apr 25, 2013
    Posts:
    2
    I bought this Asset 。 It is very Good。 but can you make a tool to define custom Map ,not only generate. thank you !:):):) I want to use this to make a map of china. thank you very much.
     
  12. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Honey is a fantastic map generation utility, and I'm thoroughly satisfied with it.

    I'm looking to extend the Hex/TerrainEditor to include a few missing features that I'll need for my game.

    First thing I want to do is provide specific tiles that I want to appear on a map, such as a Mine or Village, which is easy enough to create a definition for them but I only want a certain amount of these to appear on any given map, and I don't want them to appear within N number of tiles from another feature when it's being generated.

    Next, I'd like it if I could remove the Hex outline for non-gameboard tiles (such as in the water) to avoid confusion as to what is clickable.

    I'd also like to tag Hexes with an owner (I admit I haven't looked into this yet, it may already be a feature). I'd like to be able to draw an outline around groups of owned hexes. So say 1 players owns 3 hexes in a group, an outline will be drawn around the group, but not through the middle of it. I know this can be accomplished by testing the borders of owned tiles and drawing a procedural line if the owner tags don't match, but I'll need to query who owns the tile before that can happen. I'm leaning toward extending the Hex class for this.

    If you have any tips on any of these features I'm all ears. Thanks!
     
  13. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Hi guys! thanks for kind words :)

    Wudi: we consider editor for framework of course but there are other low level features which are important for many customers much harder to write which we want to cover before going into full size editor.

    Shane:
    You may specify your terrain generator instead of the random one and use perlin noise or other aproach to place your special locations on map. You may use HexNeighbours or HexCoordinates.HexDistance(HexA, HexB) to find locations which are valid for your placements.

    To remove your hex outline you may modify WorldOven.Baking .
    There is moment when hex ourlines are placed in their poistions :
    foreach (MeshRenderer mr in hexOutlineCollection)
    {
    Vector3 pos = mr.transform.localPosition;
    pos.z = 5;
    mr.transform.localPosition = pos;
    }

    you simply need to get hex at this coordinate and if this hex is water, then place this outline behind camera instead of in front of it! :)

    There is nothing to draw border of multiple hexes, we have markes system which allows you to draw over hexes but you will need to play well with it make it draw outlines.
    If you feel like hard player then I can tell you that you can, instead of sampling single hex to identify which texture to use, you may sample 7 hexes (this and 6 around) and this way have different drawing behaviours. You can as well store much more data in market texture (eg use more than single pixel per hex etc). This is something I want to do at some point anyway but its not there yet. Its doable but its not out of the box. If you will encounter problems then give me a shout I will help you overcome problems ;)

    Hex class is very simpel at the moment. extend it to store ownership or other data you want :)

    cheers
     
  14. Prymor

    Prymor

    Joined:
    Nov 21, 2012
    Posts:
    2
    Hi Klash, I bought this asset too and its really good.

    I saw you anwser regarding disabling hex outline from some hexes, like water.
    However this happens at baking stage.. what if I want to enable or disable the hex outline from all hexes in game by pressing some key, what will be the best approach to achive that?

    cheers
     
  15. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    I think to disable hexes from baking my second solution send directly to Shane was to modify it in place where it is positioned in the first place, as you have hex data there as well so its super easy and simply better :)

    For your case I would use markers, as this would be most efficient way of drawing hundreds of them on our terrain. Markers system is new addition to Honey 1.2 which is few days now on the store
     
  16. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
    Essentially its all about whe the data is availible.
    Amplify & Co needs the mesh & textures to exist at design time to bake and compress the texture into a big super texture. ( it also detects if texture is assigned to mesh or not - no reason to add unused texture to files - which means both have to exist before hitting "run" )
    Since here the mesh & textures are generated at run time, and don't exist at design time ( save function only stores bare minimum data, not the mesh & texture themselves ) the textures cant be added into the virtual texture.
    I hope that is clear enough - else just ask again and i will try to divide it up further.
     
  17. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    thanks for your answers. im not so good at coding but i try to learn :D so could you give me some example how i add like villages etc or chance just one tile to diffrent. sorry for being amateur and thank you :) really love this asset and i think it will be really strong as i start to learn using it :)

    i tryed to look that part of code u told me to but i have no idea how to edit it to make my own map.
    Code (CSharp):
    1. public void GenerateBasicWorld(int radius, GeneratorMode mode)
    2.         {
    3.             hexes = new Dictionary<Vector3i, Hex>();          
    4.  
    5.             List<Vector3i> rangeHexes = HexNeighbors.GetRange(new Vector3i(), radius);
    6.             int terrainCount = TerrainDefinition.definitions.Count;
    7.             if (terrainCount < 1)
    8.             {
    9.                 Debug.LogError("no terrain definitions to use!");
    10.                 return;
    11.             }
    12.  
    13.             List<TerrainDefinition> tdList = TerrainDefinition.definitions.FindAll(o => o.source.mode == MHTerrain.Mode.normal);
    14.  
    15.             foreach (Vector3i v in rangeHexes)
    16.             {
    17.                 hexes.Add(v, GetHexDefinition(mode, v, tdList));
    18.             }
    19.         }
     
  18. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Lennartos:
    I'm still not sure what "Amplify & Co " is
    But to the point. You can bake terrain and save texture produced this way to file. Then next time you start game with loading system you can load those textures instead of baking them again. Its far from perfect but can provide you with textures at design stage.

    So what you want to do is use texture exporter in area where its set for the chunk from world oven (and compressed)
    Get JPG texture data for Diffuse and PNG for height. And you should be fine :) You will need to run game once to produce them and then you can reuse those data for further runs.
    (Two ready to use commented out exporters are in World oven - for testing purposes but can speedup reaserch:
    // SaveImage.SaveJPG(texture, currentChunk.position.ToString() + "h", randomIndex.ToString());
    and
    // SaveImage.SaveJPG(texture, currentChunk.position.ToString() + "d", randomIndex.ToString());)

    I think its most efficient to produce mesh at start anyway as its not long and can use height texture for it but go for it if you want.

    Does it helps or you need to explain me problem in more details?

    kilju:
    to add 3d models to map just follow Actor class, look how CharacterActor works.
    how to change single hex is in 1.2 changes, look for examples in CameraControler class :)

    hexes.Add(v, GetHexDefinition(mode, v, tdList)); defines terrain type for each single hex. you need to go to GetHexDefinition to find how it do it at the moment
     
  19. Lennartos

    Lennartos

    Joined:
    Feb 13, 2013
    Posts:
    34
  20. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    yay :D i got something working :) thank you khas :) keep up great work
     
  21. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Thanks guys!

    Lennartos, it seems great, but I'm not fully sure how it works on gpus older than those supporting DX 11.2. I will look into it when some free time miraculously shows up ;) and who knows, maybesupport for it would let us have nice streaming system for potentially "infinite" size worlds ;)
     
  22. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I wanted to share a modification I made, it might help others out as well. I made a new GeneratorMode for RandomWeighted. This way I can still randomly generate maps, but the chosen tiles are weighted in a way that I can control the frequency they will appear. For instance if I wanted to generate maps with fewer mountains and more plains, I would set all the weights to 0.5, but set plains to 0.75 and mountains to 0.25.

    In World.cs : 28 : Make a new mode called RandomWeighted
    Code (CSharp):
    1. public enum GeneratorMode
    2. {
    3.     Random,
    4.     RandomWeighted,
    5.     Perlin,
    6. }
    In World.cs : 188 : Add a new case statement to the switch
    Code (CSharp):
    1. case GeneratorMode.RandomWeighted:
    2. {
    3.     var w = tdList.Sum(in_d => in_d.source.frequency);
    4.     var fIndex = UnityEngine.Random.Range(0.0f, w);
    5.     var c = 0.0f;
    6.     index = 0;
    7.     foreach (var in_d in tdList)
    8.     {
    9.         c += in_d.source.frequency;
    10.         if (c > fIndex)
    11.             break;
    12.         index++;
    13.     }
    14.     def = tdList[index];
    15. }
    16. break;
    17.  
    In MHTerrain.cs : 57 : Add a new public variable named frequency
    Code (CSharp):
    1. public float frequency = 1.0f;
    In TerrainEditor.cs : 154 : After the GUILayout.BeginVertical("Box", GUILayout.Width(150)); add
    Code (CSharp):
    1. var oldFrequency = t.source.frequency;
    2. t.source.frequency = EditorGUILayout.FloatField("Frequency", oldFrequency);
    3. t.source.frequency = Mathf.Clamp(t.source.frequency, 0.0f, 1.0f);
    4. if(t.source.frequency - oldFrequency > float.Epsilon)
    5.     MHDatabase.SaveDB<MHTerrain>();
    You will need to set the default randomizer to RandomWeighted, I did this at
    World.cs : 105
    Code (CSharp):
    1. GenerateBasicWorld(hexRadius, GeneratorMode.RandomWeighted);
    Now, Reload your terrain definitions. Assign tiles weights (between 0.0 and 1.0), The higher the weight, the better chance the randomizer will choose that tile.

    EDIT: Code formatting.. oh forget it.. this forum hates well formatted code
     
    Last edited: Oct 28, 2014
  23. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Thanks Shane!

    Its great to see community exchanging ideas. I hope it will result in even greater games around :D
     
  24. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    nice work Shane. i got one question. can i make diffrent shape of mountains? do i have to edit height files or how is this done? and how can i add my models in map like city? i got models ready but just dont know how to add them to my map?

    sorry for alot of questions :D hope u guys get time to explain these :)
     
    Last edited: Oct 30, 2014
  25. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I am not the author of the tool, so take my answer with a grain of salt as I don't have complete knowledge of the product yet. Since the tiles are "Baked" into a chunk and turned into terrain, you would indeed simply make different heightmaps for different shaped mountains. When the different mountain tiles are chosen, the WorldOven will bake them into the chunk for you. Keep in mind when making height maps that you are working with a hexagonal terrain, so some of the map is guaranteed to overlap with other tiles (thus the reason you have the variation in mountains already). The Mix Map is the bridge between tiles, and when they are placed next to each other, determine how much of your tile shows through. The way I have been making tiles is by using this little reference that I came up with:


    In a square image, like you would use for the Diffuse map
    The Blue is your tile where other tiles are guaranteed to overlap (and vice versa). The blend factor of the Mix Map determines how much of your tile shows through here.
    The Red, while it's still possible for other Mix Maps to influence, is for the most part your tile.
    The Green will not be influenced by other Mix Maps in this area. Your tile is pretty much guaranteed to show through here.

    As long as the tile's most important feature is within the green circle, it will show up on the final map. Or at least, for the most part.

    Note: It's still possible for underlying terrain to show through if your Mix Map plus the adjacent tiles Mix Map doesn't have enough strength to cover it.

    Also Heightmaps start out at grey (RGB 128,128,128). Darker areas actually recede into the terrain, allowing water to show through.

    As for placing geometry on top of the terrain.. I'm still working on that bit. I've been heavily modifying the Terrain Editor to do my bidding, but a lot of my mods are specific to my own project. If I come up with a generic solution, I'll post here.
     
  26. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    oh thank you really much! :D this really explains a lot how terrain is made in this asset. what program are u using to easily modify heightmap files?

    thanks for your help man. and nice to hear you are doing great with your project. im so bad at this coding cos im just learning and messing with this asset is really improving my knowledge how code works :) nice to hear that u will share if u get something like that done. i would love to learn from ur work :)
     
  27. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    To be honest, I haven't found a decent, inexpensive external program for generating heightmaps. I'd like to find something like Mudbox that I could not only use for heightmaps but also paint terrain. Alas, I haven't turned anything up yet. Perhaps I should code something myself.. Hmmm.. :)
     
  28. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    hehe :D i keep my eyes open if i find something good i let u know :)
     
  29. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Note: Overall Shane comment is great, but you should be aware that terrain textures are randomly rotated (rotation is stored in Hex) this rotation makes influence between hexes much less regular than red area shown on Shane's image.
     
  30. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Yes, I forgot to mention the Rotation. Also, to note, while the field is laid out in a Hexagonal pattern, the tiles are still in a square. So depending on how your mix is set up, the random rotation makes the target area bigger/smaller. I've personally been setting mine up so that the area beyond the red is almost entirely black. This keeps my tiles looking very hexagonal. The samples provided extend well beyond that area, so the red is nonexistent for the most part.
     
  31. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Note that you can simply shrink hexTextureScale (look in Hex class)
    so that you can use as much of the texture size as you can while keeping overlap to your demand :)
     
  32. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    This.. changes.. EVERYTHING! :D
     
  33. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    I'd like to try to bake only the colors into the terrain data, and use a directional light to light the scene externally (Simulating a day/night cycle) How would I accomplish such a task? I'd imagine I'll be rewriting shaders?
     
  34. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    colors only? to get live shadows works you want to have as well height I think.
    Simplest way to get shadows off the world is removing baking them in stage 4:
    4DiffuseShader.shader

    And try to comment this shader part:

    /**
    BURN SHADOWS AND LIGHT ON TEXTURE
    **/
    float lightAndShadow = ((( shadowsAndHeight.r - 0.5) * 1.3) + 1.1);
    col.rgb *= lightAndShadow;
     
  35. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Ok this worked pretty decently, the only problem I have now is the normals.

     
  36. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    I think you are using dx9 mode (you are building mesh instead of using tesselated one. So I would expect that you would need to process new nerby pixels when considering height.

    eg you take 9 points of height, then consider distance from center point TO all 8 nerby points as lenght 1.
    If neigbour is shorter than center (terrain is lower) then ADD this value to this direction,
    if neihbour ir lonter than center(terrain is higher) then SUBTRACT this value from this direction.

    This way on flat terrain all those 8 directions will nullify each other (every of 8 directions have opposite one)
    but if terrian is irregular then lower terrain will PULL normal, while high terrain will PUSH normal away.
    This way you get a normal value in required point and can add it during mesh construction.
     
  37. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    Yes, Khash, I am in dx9 mode. I am targeting mobile devices so I have to distance myself from dx11 stuff for the time being. But to follow up, the problem is how your terrain Mesh generation algorithm works. You are doing the math 1 quad at a time, and adding it to the list of vertices/uv's, etc. What this is doing is duplicating verts in the final mesh. While this is not a terrible thing, the normals that are calculated are per quad, instead of averaged between all of the tris that share the vert. If you were to process all of the verts at once and reuse the indices that share a vertex, the normal generation would result in a smooth shaded mesh.

    I tried for a few hours to fix this, but I couldn't quite get it. I came very close but the chunks were mismatched and I couldn't reconcile it. Eventually I just set all the normals to point straight up. It's not right, but it's not blocky. I'll swing back around to this again when I have more time.. unless you want to give it a shot.
     
  38. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Yes it would be resonably easy to improve dx9 mode to get whole chunk as single strip. But you are wrong, the only difference is a bit more memory used by mesh in a format we have it at the moment. As long as you get the same result for vertex each time (same normal) you will get smooth shade because it always process it any way this way on GPU. It takes single triangle and process it independently. As long as data in vertex either duplicated or not is the same result will be identical.

    Using quad is simply approach which would allow you to manage small regional changes easier, allows you to produce non contineus effects (most commonly used when you want to store extra information about mesh in color etc.

    Size of the waste is in worst case (depend on the way gpu compresses data)
    3*4 bytes (vertex) +
    6*4 bytes (index) +
    4*2*4 bytes (UV) = 12+ 24 + 32 = 64 bytes (cost of the single vertex)

    if mesh density is 70*70 you get 314 kb memory per chunk if you use single strip OR ~1250kb using quads

    Its hard to get it really noticable against curent memory available for gpus/CPUs

    But anyway you are right it would here it would be better aproach :D
     
  39. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Lets say you have line of mountains. If you use cheaper strip your normals on top of the hill will point UP, this way if you have light (eg sun) shine from left, right side of the top of the mountain will still be bright until number of pixels furhter awaya where they interpolate far enough to make it dark.

    What this example shows is that you will not be able to get nice crispy difference between surfaces which looks into the light direction and dark when they are awaya from it if they are one next to the ther because you have just one vertex and you cant make data split in those areas.

    On the other hand if you use Quad approach which is used at the moment you may use algorithm which averages normals to make smooth groups, but if the angle difference is great you may decide to break averaging and leave it sharp.

    (3d tools like 3d max uses this approach when building smooth groups)

    There are other advantages as well for having data independent for each quad but its very unlikely most of Honey users would use them so I consider writing cheaper version of mesh generator for chunks dx9
     
  40. Shane-C

    Shane-C

    Joined:
    Nov 9, 2012
    Posts:
    211
    No disputing that! You can do some very neat things when you are using multiple normals per vertex. I however can't think of a good way to do something like that procedurally. Perhaps you should give us a switch to do it one way or another. The memory usage difference is negligible between the two methods, so that isn't even really a factor. Anybody worried about that little memory difference has problems elsewhere they should deal with.

    Thanks again for looking into this Khash :D
     
  41. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    No worries. Its always great fun ;)
     
  42. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Hi,

    sorry if this has been covered before.

    How do I add separate 3d objects to the map (e.g. houses, castle, farm) and make sure they look as smooth as the trees and hills on the generated map?

    I tried to do anti aliasing, and it did make the buildings smoother. However, the trees and hills become very blurry.

    Is it possible to make use of the effects / shader applied to the trees and hills and apply them to the buildings?
     
  43. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    there is no blur effect applied to the terrain or trees.

    I'm not sure what aliasing do you get with your models because models(3d mesh) are rendered with resolution of your camera, so you shouldnt have any artefacts above this level. Can you share some screenshots?
     
  44. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    ps if you want to have antialiasing on models only then you should render it separately (eg using another camera) which reuses depth of previous one and then add your anti aliasing and then merge ti together. its a complex proces though
     
  45. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Actually, I was comparing the screen I had (sorry I didn't save it) with the one you had on the awakening game.

    On the awakening game page (http://muhagames.com/projects/the-awakening/#8871prettyPhoto[gallery]/8/),
    there is one image of a map with a village and two individuals outside of the village. It's picture 9 of 10.

    The village and the two individuals look sharp and blend nicely with the map environment.

    I was wondering how I can achieve this effect, assuming of course that the game was created using the honey hex framework. In particular, I am really interested to understand how the characters look so sharp. Are they rendered using a separate camera like you said or do you use another method?
     
  46. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    We do not use separated camera because we do not add any postprocess to them. This is simple model placed on the world used Formation class included in Honey Hex Framework with only one representative (formation may or may not have more than one character)
     
  47. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    Okay. I see.

    So if I understand correctly, the formation class itself is sufficient to ensure that the characters blend nicely with the terrain.
    I will try to play around with that class and see what I can come up with.

    For the village itself, did you use sprite and then include it as one possible tile?
     
  48. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    No, Village is an extension in our game to Actor class which places its own objects on different heights based on terrain shape.
     
  49. kilju

    kilju

    Joined:
    Nov 4, 2013
    Posts:
    127
    hello guys. anybody know where i can find some more trees? or is there easy way of doing them?
     
  50. Khash-Firestorm

    Khash-Firestorm

    Joined:
    Jun 30, 2013
    Posts:
    87
    Simplest way is to take a 3d model and make a screenshot and then photoshop it to what you need. You can draw them or look for 2d tree sprites on the internet. Note that to use coloring system in Honey you will most likely need to change tree to gray scale and then adjust its brightens to the level where they look nice :)