Code Monkey home page Code Monkey logo

markovjuniorweb's Introduction

Typescript version of MarkovJunior, runs in browser (also in node.js).

  • Everything have been implemented including isometric rendering, exporting the output as a .vox file, and node tree visualization.
  • Every model from the original repository can be loaded with this project, but the output would be different due to different random seed implementation (dotnet builtin vs seededrandom).

demo RTX=on

Development

  • Install dependensies: npm i
  • Start development server on localhost: npm start
  • Build static site: npm build
  • Run in node (writes result to /output): npm run cli

Random Notes

  • I want to implement markovjunior in UE 5.2 as a plugin to the PCG component. MarkovJunior can be integrated as a special typed subgraph. UE 5.2 PCG is very data oriented - everything in a table where row is element and column is attributes. MarkovJunior output 2D/3D grid can be flattened to this table where row is pixel/voxel and column is the value. The result can be quite powerful, static mesh actors can be placed correspond to the output, graphs can be nested so the final output can be very detailed and hierarchical, and grid patterns can be broken as well by varying transforms to the gragh or generated actors. The only downside is this would take a lot of time and UE 5.2 is still in preview.

  • This port is around 2x slower than the original repo (JS vs C#), but it doesn't affect the page much; even with 200 steps per frame there's hardly any FPS drop on most models. However, the slowdown is quite noticable on computation expensive calculations, e.g. uni/bi-direction inference.

  • SokobanLevel1 takes ~10 seconds for the original C# code on my pc to reach the desired state, while it takes 20+ seconds on the web. I've tried JIT/unroll the rules into webassembly with generated AssemblyScript and it actually works: it gains a x2 speedup and the performance almost match the native C# version. The only problem is the load & compile time is terrilbe and it's incredibly hard to debug WebAssembly. I rolled back the commits on main and put the experimental stuff in the optimization branch, but I'm still pretty proud of this MarkovJunior rules -> AssemblyScript -> Wasm "JIT" compiler I wrote.

  • Update: I wrote a precompiled wasm version and it works fine, and the runtime is reduced from 20+ seconds on SokobanLevel1 to ~13 seconds (not too bad I guess ¯\_(ツ)_/¯ ).

markovjuniorweb's People

Contributors

yuu6883 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

markovjuniorweb's Issues

install error

run npm install
run npm start
i get a error
ERROR in ./src/web/index.tsx
Module build failed (from ./node_modules/_swc-loader@0.2.3@swc-loader/src/index.js):
Error: Cannot find module '@swc/core'

I made a compatible "Random" of the C# in TypeCrsipt

Hi Yuu,
I wonder if we can generate an identical result with MarkovJunior C#.
So I translated the C# (or dotnet) random function into TypeScript.
After a week stabilizing, I got the perfect result.

That was a good news, right? I think so.
THe bad news is, I did it in very old commit of your MarkovJuniorWeb: while it has no webassembly at all.
So here I send you only file that declare the random function.
(if you want to try, here is my working branch)

Okay, here is the file: https://github.com/x2nie/MarkovJuniorWeb/blob/x2nie-nowasm2/src/random.ts

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.