Giter VIP home page Giter VIP logo

minecraft_clone_1's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @MarcellPerger1
  • ๐Ÿ‘€ Iโ€™m interested in programming, maths and chess โ™Ÿ
  • ๐ŸŒฑ Iโ€™m currently learning C++
  • ๐Ÿ’ž๏ธ Iโ€™m looking to collaborate on ...
  • ๐Ÿ“ซ How to reach me: [email protected]
  • StackOverflow: MarcellPerger

minecraft_clone_1's People

Contributors

dependabot[bot] avatar marcellperger1 avatar

Stargazers

 avatar

Watchers

 avatar

minecraft_clone_1's Issues

WebAssembly

Use WebAssembly for better performance
because the vertex bundler is very bad performance in JavaScript so rewrite it in C++:
the renderer.renderFrame -> renderer.addWorldData ( -> addBlock -> addBlockTextures -> ...) takes up 95% of the performance!!

However this requires a LOT of work (learning emscripten, etc.)

Texture atlas

Put all textures into one big texture atlas because then:

  • don't need to switch out uniforms
  • don't need batch drawing
  • can do all the drawing in one call
  • no switching uniforms required
  • better performance

World format

World class to keep track of blocks & support for different types of blocks - perhaps also serialization?

Diagonal movement too fast

Movement vector (horizontal) needs to be normalized to length 1, then multiplied by speed.
This means that all movements in a frame need to be added up and controller.moveCamera needs to be called once with the normalized values.

Separate buffer manager

The World class has a lot of closely related buffer methods.
These could be extracted (together with the data) into a separate class with

  • those methods
  • the buffers (name of buffer = attribute name)

The aforementioned methods could then be used by doing (where this is renderer):

  • this.buffers.make or
  • this.buffers.setData etc.

Global config object

Config very messy right now, some global consts, some config classes.
Fix this by making one global config object

Tests for `config_loader`

Tests for config_loader, including:

  • Basic json loading
  • Comments in json
  • Config Class handling
  • Inheritance handling
    • Comments in inheritance
    • Recursive inheritance ?!! (at least throw an error early!)
    • Everything inheriting from default
    • Correct merging
  • Handles Symbol keys ( /values? )
  • +/- Infinity as values

Deepcopy all Config attributes

Deepcopy all Config attributes when merging Configs.
Also deepcopy:

  • arrays
    • Objects within arrays: update or override
  • what to do about wrapped primitives?? (probably just use unwrapped value)
  • Functions? (or just assign) - wont be much of these in configs as they can't be in json

X axis is flipped

X axis is currently:

            ^
            |
           +Z
            |
            |
<-- +X ---- 0 --- -X -->
            |
            |
           -Z
            |
            v

But it would make more sense if it was:

            ^
            |
           +Z
            |
            |
<-- -X ---- 0 --- +X -->
            |
            |
           -Z
            |
            v

This is merely a visual bug

Config loading from JSON

Default & current Config loading from JSON

Necessary

  • Config loading
    • Determine correct class
    • File for current and default config (TODO current)
    • Use the loaded Configs instead of defaults in config.js

Useful

  • Config storing perhaps
  • Json with comments?

Chunks

Split world into separate chunks to enable

  • Only re-rendering chunks that have changed
  • Remaking the mesh of all chunks in different frames (so no huge lag-spikes)
  • Chunk loading (infinite worlds)
  • Biomes?

More tests for `deepMerge`

More tests for deepMerge, specifically:

  • Returns correct class/prototype
    • Copying & merging
    • Weak prototype/constructor handling
  • #96

better directory structure

No .js files should be on root directory except main.js - even that shouldn't contain 10+lines
Possible new dirctory structure:

main.js
index.html
style.css
src/
    utils/
        ...
    input/
        ...
    renderer/
        renderer.js
        vertex_bundle.js
        [vertex_culling.js]
    game/
        ... (eg. world gen, level format)

Trees

Add randomly placed trees.

How to get positions randomly

  • Could use a PRNG to generate coordinates / index
    • How to do it forwards-compatibly / to make backwards-compatibility easier??

Documentation

I should write some documentation eventually.
Especially for:

  • Config stuff
  • (Later) Where all the code is and project 'architecture' (low-ish prio)

Add config for canvas size

Add a config for canvas size. There could be problems here:

  • How to interact with styles from js?
  • Should it really change canvas size at some point during loading

More configs

More configs for:

  • world generation
  • world size??

Use a 1D list in `World` class

Use 1D list instead of a 3 deep nested list to store blocks in World class.
This is better because:

  • Easier and simpler to create empty world (only no nested loop)
  • More performant indexing
  • Iterating over all blocks may be a little different but not much.

Async shader loading

Load shaders asynchronously - sync is deprecated and results in slow website loading.

Config inheritance

Some sort of 'inheritance' for configs (extends: ...)

  • Handle extends attribute
  • Values for extends attribute: default, others??
  • (Perhaps?) multiple inheritance

Nested Config structure

Nested Config structure would allow for a much more clearly structured Config object.
This would guarantee no clashes between different config entries with same name.

Octave noise

Use octave noise for terrain generation

  • Implement octave noise
  • New Configs for octave noise (persistence/lancunarity?)
  • One seed to generate all octaves
    • If seed is number
    • If seed is string

Use workflows

Make .github/workflows/
Make action on pull request / push to main

Block data

Each block should be able to store some data:

Now

  • Wood logs: direction

Later

  • Container contents
  • sign text
  • etc.

Progress bar

Progress bar for shader and texture loading (only start game once textures loaded)

Rethink merging arrays

Reasoning

Perhaps array items should be merged because if you have

{ objs: [ { v: 1, other: 9 } ] }

and

{ objs: [ { v: 2 } ] }

the output should surely be

{ objs: [ {v: 2, other: 9 } ] }

not

{ objs: [ { v: 2 } ] }

Implementation detail

Current value is array:

  • If previous values was object, override it fully
  • If previous value was array merge with it (use largest length)
    If previous value was array:
  • If current value is object, override it fully

Movement too fast on first frame

On the first frame of the game, r.deltaT is HUGE because r.now is set to 0 and not current time.
Solution:

  • Initalise both r.now and r.then to null.
  • On first frame, r.deltaT should be overridden to 0 and r.then should be set to current time.
  • From next frame, everything can continue as normal.

World generation

Randomness

Using seedrandom (@davidbau/seedrandom)
What pseudo-random number generator to use?

World generation

Which noise to use?

  • Perlin noise
  • simplex noise
  • other?

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.