GithubHelp home page GithubHelp logo

theprimeagen / vim-with-me Goto Github PK

View Code? Open in Web Editor NEW
244.0 6.0 32.0 6.39 MB

License: Other

Lua 17.83% Makefile 0.16% Go 42.28% Vim Script 0.02% Dockerfile 0.09% HTML 0.77% Shell 0.05% JavaScript 4.46% TypeScript 0.12% Zig 34.05% Python 0.17%

vim-with-me's Introduction

The Realtime Ascii Game Engine

Right now this is an experiment. I have already completed real time doom and we did have 1000+ people SEE doom at the same time +thousands playing doom at the same time via twitch chat.

That was awesome. Video

What is next

Right now i am just going through building a game or two trying to figure out how to be a better game dev. So for now there is tower defense that i am building on stream.

Sponsors

To make this project possible for the next year I have tried to acquire sponsors. Here is the list of them and please visit them!

Graphite

This project was built using Graphite: The code change stack Graphite is the integrated developer platform that helps teams on GitHub stack. Teams that use stacked pull requests deliver higher quality software, faster โ€“ Get started with Graphite for free today, and ship as fast as I do: Graphite

vim-with-me's People

Contributors

duailibe avatar stut avatar theprimeagen avatar tukantje 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

vim-with-me's Issues

FrameReader Read method doesn't work properly

func TestFrameReader(t *testing.T) {
	data := []byte("hello world")
	cmd := TCPCommand{Command: byte(1), Data: data}
	ioReader := bytes.NewReader(cmd.MarshalBinary())

	r := NewFrameReader(ioReader)
	b := make([]byte, 1024) // mimic current scratch buffer size
	n, err := r.Read(b)
	if err != nil {
		t.Fatal("error reading")
	}

	recievedCmd := TCPCommand{}
	recievedCmd.UnmarshalBinary(b[:n])
	//success
	assert.Equal(t, cmd.Data, recievedCmd.Data)
	assert.Equal(t, n, HEADER_SIZE+len(data))

	ioReader = bytes.NewReader(cmd.MarshalBinary())
	r = NewFrameReader(ioReader)
	b = make([]byte, 5) // provided buffer is less than incoming message
	n, err = r.Read(b)
	if err != nil {
		t.Fatal("error reading")
	}

	recievedCmd = TCPCommand{}
	// Panic: n > b len out of range error
	recievedCmd.UnmarshalBinary(b[:n])

}

Smaller encoding of the huffman tree

Hey Prime! Your Huffman encoding video got me inspired.

From what I understand the tree is currently encoded via a table. Each node being 6 bytes:Value, LeftIndex, RightIndex you could reduce this quite dramatically by always building in the traditional left -> right depth first manner

Encoding

Each node is encoded with a leading bit which indicates if it's a leaf or a branch:

Leaf Bit 0
Branch Bit 1

Then each leaf has whatever data it needs encoded afterwards (in your case 16 bits)
Each branch will then encode it's left and right branch.

Decoding

Read the next bit
If it's 0 read the next 16 bits and construct the leaf
If it's 1 (recurse to build left, recurse to build right)

Some maths

For a huffman tree of N nodes this representation would need ceil((N + N*ValueBitLength) / 8)bytes to represent the tree in this format.

So the example from your unit tests would drop from 42 bytes down to 15.

Tree

   ()
  /  \
 A   ()
     / \
    B  ()
       / \
      C   D

Is encoded as 10A10B10C0D (mixing binary and character values)

You could even do variable length encoding with this approach by having a header which dictates how many bytes each node has

Example of it working

Example in scala (because I haven't learned go yet) https://scastie.scala-lang.org/B3MontqASvuSNT3wNN4qxQ assuming a single byte for the values.

Hope this is helpful or at least interesting.

Peace out!

crowdstrike

when crowdstrike happened i had to restart a bunch of computers manually, so just be careful

Need a description of the project

I've heard Prime mention this project a few times but have no idea what it does. I'd do a PR to add a README but that's a bit of a Catch 22.

Anything helps!

im starving

i left the mayo out yesterday and had to throw it out and the only thing in the fridge to eat right now is deli roast beef and i have the bread too but i dont want to make a sandwich without mayo that sounds disgusting

TIA

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.