GithubHelp home page GithubHelp logo

letvezi's People

Contributors

exio4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

joshua1337

letvezi's Issues

Architecture changes (improvements?)

The idea is a major change to the core data structures

The concept is basically:

  • The rendering function would read the current state (which should be "quite fast", because it'd be copying a reference), and then render it (making it easy to keep up with the FPS)
  • The functional loop would become two loops
    • The "critical" loop, which is supposed to take care of acceleration, and it should be at most O(n) over entities (this meaning, it should be fast, as this is supposed to keep the "core game" alive)
      (maybe, collision checking Player <-> EverythingElse could be done here)
      • The "ideal" loop, which is supposed to do computationally expensive tasks (like collision checking, even though a proper algorithm would be MUCH nicer actually, but whatever, that's not fun), this loop is supposed to have "high delays" compared to everything else (doing collision checking every 1/20s sounds about right)
  • The whole "game state" would need to become an immutable record, and every loop would need to create -diffs- over the game state
  • A new thread is added to the architecture, it'll be the one receiving game state differences, and applying them (iow, actually moving things / etc), this one would be one the few places that'd actually modify the "main reference" (it'll be just changing a pointer, though)
  • The differences have some kind of (partial?) order based on the timestamps, plus priorities (certain differences (like switching to a different scene) should be prioritized over anything else, because those come from either game-changing actions or user input)

The idealistic basic architecture could be reduced to:

  • Concurrent loops which generate "Diff"s over their current state
    • Input loop (handling of user input)
    • Rendering loop (reads whatever the current state is, and puts it on screen)
    • Priority-based loops: They are organized by their "asymptotic complexity" (certain things are moved to higher-priority loops if they matter quite a lot about the sense of "fluidness" of the game, like collision checking of the player).
      • "High priority" loops: accounting for things like user's acceleration, high scores O(1)
      • "Normal priority" loops: acceleration of every other entity, collision checking player vs everything else O(n)
      • "Low priority" loops: collision checking of other entites in the plane O(n^2) (ideally optimized to O(nlogn) later)
  • A single loop which applies diffs to the state

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.