Giter VIP home page Giter VIP logo

edgecase's People

Contributors

fridayitsfridayfriday avatar quasistellar avatar zazamrykh avatar

Watchers

 avatar

edgecase's Issues

Remake map mesh for proper lighting

image
We need 3 times as many vertices to illuminate mesh surfaces correctly. Each face should have its own set of vertices with normals pointing in the same direction, so the lighting can know how to handle it. As you can see on the picture above, Unity cube has 24 vertices instead of usual 8 because each face needs its own 4 vertices with normals pointing perpendicular to the face.

Hexes can utilize shaders instead of 2D textures

Hexes currently use uv-maps with texture-based materials, which leads to blurry edges:
image
Furthermore, textures are heavy and overload the scene for no good reason.
We can avoid this problem by utilizing a shader:

  • Color points which are less than N meters away from any edge with COLOR
  • Color all other points black
  • Set different N for the upper face and the sides

"Barycentric coordinates" and "wire-mesh techniques" may help.

Perlin noise rounding breaks maps with max height variation

More often than not generating large maps (100x100) produces this error:

System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Hex.UpdateColor () (at Assets/Scripts/Hex.cs:131)
MapGenerator.Start () (at Assets/Scripts/MapGenerator.cs:31)

Seems like it can't find a color in the Hex.ColorMap dictionary. Probably because of some broken perlin noise rounding that produces a value higher than the maximum height, since switching HeightVariation from 7 to 6 fixes the issue.

May want to switch to simplex noise.

Add keys to rotate the camera

Make camera rotatable by 60 degrees in both directions. Make sure the map doesn't clip through the camera planes and is displayed correctly.

Small tweaks

Issue for minor refactoring / typo fixing PRs.

Change materials of hexes and their sides

Map-mesh consists of 2 submeshes, one of them represents tops of the hexes and the other one - their sides. This way we can assign to them 2 different materials. Here we need to change those materials so the map looks pretty and readable.

Generate the entire map as one mesh

To avoid extra geometry it's better to have all map vertices contained in one mesh.
Hexes should be split apart from each other and connected like so:
image
Check how much it affects the performance.
Make sure to avoid vertices-per-mesh limit.

Generalize the HexMap class

We may need different shapes of the playing field.
So there must be a generic interface for hexmaps, or a more generic class for hexmaps.

The current HexMap class can easily be modified to support arbitrary shapes.
And then the specific shape is the responsibility of the object's creator.

Check how global hex shifts affect performance

Global hex shift: elevate all hexes based on one of their coordinates (so a plain map turns into a slope).
Check how this transformation affects performance.

50 hexes side:

Hex = mesh Map = mesh
Idle
Start
Running

Result: Map = mesh is much better

Add lighting

Now after #21 is done, we can add lighting with respect to our normal map. Add a directional light source and set it up so the map looks pretty and readable.

Get rid of HeightMaps

HeightMap can be replaced with HexMap<Height>.

PerlinHeightMap and FlatHeightMap can be replaced with PerlinHeightMapGenerator and FlatHeightMapGenerator.
They should just create and return a heightmap, instead of trying to be a heightmap.

Turn skipping player vs bot prototype

  1. player clicks on "end turn" button
  2. end turn event happens (TurnEndEvent, context: player="player1")
  3. display provider gets notified via subscription
  4. display provider forms a request and sends it to kernel provider (request: {"player": "player1", "action": "end turn"})
  5. kernel provider validates the request and produces an event (if the server is remote check if this player name and this IP are associated)
  6. kernel gets notified via subscription (context: player="player1", action="end turn")
  7. kernel handles the request, updating the state in its game model (current_player = player2)
  8. kernel creates an event, notifying kernel provider about the result (TurnEndEvent, context: current_player="player2")
  9. kernel provider gets notified via subscription
  10. kernel provider sends appropriate requests to all the connected display providers
  11. display providers produce an event (TurnEndEvent, context: current_player="player2")
  12. display gets notified via subscription
  13. display reacts to the event
    image

Add another LOD for hex meshes

Far away hexes can be rendered as their upper hexagons since sides are black anyway and edge lines are too narrow at these distances. This is also an extremely good optimization for the top-down view since all hexes are counted as far away and sides are completely invisible from this PoV.
This article may help.
Should be done after #1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.