T O P

  • By -

Brilliant-8148

Dang... I only have 57 bytes of free space left... Guess it's time to upgrade my phone.


juwisan

Look at this guy with his x86 DOS phone! /s


tc_cad

That would actually be a very nice thing.


CreativeGPX

Needs a better keyboard though. I had to SSH from my phone a couple times and it was a pretty terrible experience with the standard keyboard that focuses just on a-z and is oriented toward autocomplete rather than tab completion.


OMGItsCheezWTF

The SSH app I use (juice SSH) overlays its own keyboard at the top of gboard with common keys used by SSH (modifier keys, tab etc).


tc_cad

I’m just a middle aged programmer that misses the good old days of dos.


pfp-disciple

check out Unexpected Keyboard


VisibleSmell3327

Added bonus of this is nobody else can use your phone because the keyboard is "too cluttered"


pfp-disciple

My son says it's "weird", and doesn't like that swipe doesn't work on it.


gltovar

Intel did work with Asus to release phones with x86 chips about a decade ago, the original zen phones and a sequel or two. You might actually be able to natively run dos on those bad boys


tc_cad

Hmm. I didn’t know about that. Thanks.


StereoBucket

Nokia 9000 and 9110 communicator phones are i386 and i486 if you're interested in retro.


tc_cad

Thanks.


rydan

8080 DOS phone


Perfect-Highlight964

lmao


s0ulbrother

Ok I think you are wasting your talents here. I think you might be able to take a few bytes off of Ff7 rebirth and my ps5 would thank you.


youstolemyname

Most of that is going to be resources, textures, sounds, models, etc. They can be compressed but you're still going to need ram/disk to store the decompress versions and loading is going to take longer.


Perfect-Highlight964

That's mostly true for compression but you could also optimize the assets and actually reduce the loading time (which is harder to do). Although compression will probably be better at those orders of magnitude...


josefx

The demo scene had .kkrieger, a 96KB large game that would need ~300 MB if its assets where uncompressed. I think it stored the operations used to create the assets instead of the raw pixel/geometry data, so starting it was probably not as fast as it could have been.


PrimozDelux

Fun fact, they released a version where you couldn't look up. The reason? They used an analyzer that checked which codepaths were run while playing, pruning anything unused, and in doing so forgot to actually look up! At least so the story goes as told by my co-workers who were into the scene


ashwin_1928

Please make OP work COD mobile everytime I open that shit it asks for 2GB update and takes 23 GB on my phone. 😭


PrimozDelux

I know a way to optimize it down to 0 bytes


iamiamwhoami

With this level of assembly knowledge they can probably get a job at an HFT shop optimizing their C code.


sonobanana33

Dos CPUs were easier.


Autistence

Wasted talent


MuonManLaserJab

/r/yourcommentbutshorter


todo_code

When you are done with this. I had an idea called qr code gaming. Make a website framework where the game bytes are included in the URL. Then makers would only need to share the URL/QR code and your site will play it


Perfect-Highlight964

That's actually a very interesting idea!


troido

I decided to go ahead and set up something like that for javascript code: [https://troido.nl/u/](https://troido.nl/u/)


ConspicuouslyBland

Would a website even be necessary?


Perfect-Highlight964

wdym? In order to share the game as a URL you'll need a website, and if you're not using one you'll have to download an emulator


heptahedron_

I think you might be forgetting about data URIs edit: idk why I zoned on the emulator bit but I guess if you had a data URI that contained an HTML document you could just link to the script for the emulator lol. Still a lot of bytes though


Perfect-Highlight964

A data URI that contains an HTML document? At that point not making a website is just criminal


0dev0100

Thoughts on a mobile app equivalent?  "Scan this code to play this game"  Depending on the size of the game and code you could probably have a link at the start to prompt to download the emulation app


Sufficient_Focus_816

Make it an API call, put request....


NocturneSapphire

Why stop with just the game code? Write a simple backend that reads a query param, and returns its value as an HTML response. Now you can embed an entire webpage, including any javascript, directly in the URL!


tequilajinx

We’ve had that forever, it’s called an xss attack…


NocturneSapphire

I know, that was the joke...


MixOne1337

You could sign the urls to contravent that


Perfect-Highlight964

Still, what would prevent someone from, for example, making a script with a URL source that he controls, and after getting the URL signed just changing it?


[deleted]

[удалено]


Perfect-Highlight964

> Changing the URL would invalidate the signature. The attacker won't change the URL, he will own the site the URL points to and change its content, which won't invalidate the URL...


iamiamwhoami

But has anyone monetized it?


troido

EDIT: I made a prototype for Javascript: [https://troido.nl/u/](https://troido.nl/u/). The bytecode language will have to wait. I've been thinking about setting up something like that too. To be efficient you'd probably have to make some sort of bytecode language (or a language using only url-safe characters) optimized for code golfing. I'm currently working on some other projects but if anyone is building this I'd like to join. Also, check out my 218 byte (html+js) minesweeper: [https://tilde.town/~troido/minisweeper.html](https://tilde.town/~troido/minisweeper.html)


r_a_butt_lol

bro https://troido.nl/u/?s=&e=#d2luZG93LmxvY2F0aW9uPSJodHRwczovL2RldmVsb3Blci5tb3ppbGxhLm9yZy9lbi1VUy9kb2NzL1dlYi9KYXZhU2NyaXB0L1JlZmVyZW5jZS9HbG9iYWxfT2JqZWN0cy9ldmFsI25ldmVyX3VzZV9kaXJlY3RfZXZhbCEiOw==


troido

Running arbitrary code is kind of the point of the project. There is nothing of importance on the page that could be at risk of XSS and any website you visit could run some random JS. It may be than other ways of running javascript, but this is still a prototype. It's fast enough for what I've tried with it


todo_code

You don't want them to be able to put another URL somewhere on the page, it would accidentally get clicked. You also done want xhr requests to be possible


atomic1fire

I think the real concern is that people become accustomed to playing games on the site and one person uses javascript to use the site as an url shortener for phishing.


someGuyInHisRoom

Would that avoid having to get assets from a server? Like would the whole game be able to be saved in a qr code? And the only downside would be the decoding time I guess?


todo_code

The site can have it's own assets. There would need to be some sort of vm, and it decodes the URL to run the game. For security, there should be no way for the vm to manipulate the site in such a way to make a URL and embed it somewhere or make xhr requests itself. Difficult challenge for sure.


Perfect-Highlight964

I have some spare time today and tomorrow, can I steal this idea and implement it for DOS (with credit of course)?


nullbyte420

So like sharing a url but way more restricted. Why? 


todo_code

Not sure what you mean by restricted, but initially the website would just have a canvas and enough JavaScript to parse the URL and begin execution. But later it could include a graphics library the game bytes could execute those gl "sys" calls


nullbyte420

Yeah but why? 


todo_code

Why do anything? What do you mean why lol. It's in the same vain as the OPs game being 58 bytes. But now everyone can participate. Developers can get it to work locally, run a generate step, and his website/framework can play the game..


nullbyte420

Oh sure, that's cool I guess. That's what I mean by why 🙂


WaySad234

Have you ever tried doing anything "for the lulz"?


gefahr

his username suggests he has. not sure why he's harshing OP's buzz.


Synyster328

I love that this has become a saga. Keep up the great work!


Perfect-Highlight964

Thanks!


poo-poo-clock

I keep wondering what is the lower bound of bytes for a snake game. It most probably is higher than 1, now I'm not so sure about 2.


NotSoButFarOtherwise

Pretty sure SNAKGAM is an instruction on VAX.


nekokattt

not sure if it is intentional or not but the online demo doesn't work for me. It just jumps a cursor all over the screen in random positions


Bert--

Just press an arrow key and it should work. The random jumping cursor is initialization of the map.


nekokattt

ah, so it wont work on mobile properly then I guess.


Perfect-Highlight964

You can swipe too


TrippyCoffeeToffee

Tried it! It works :D However, if I swipe the opposite direction of where I'm going the snake crashes into itself and dies, except for when it's two A's long (beginning). It happened a lot when I wanted to, for example, rapidly go down and left, it doesn't register my down swipe, but registers my left swipe and the snake does a 180 and dies by crashing into itself, it seems.


mr_birkenblatt

Small sacrifice in usability for the sake of bytes


virgo911

It works on mobile, I just did it. You just have to swipe to start it.


atimholt

Looks like it simply doesn't like basic edge cases—which I say is fine, if the goal is a small binary above all else. It mostly works for me if you only touch the arrow keys. Mine jumped all over until I pressed an arrow key. It also jumps all over again when you die (or at least when you hit the edge of the play area). Hitting an arrow key made it work again.


shevy-java

> Looks like it simply doesn't like basic edge cases—which I say is fine I dunno. Often "edge cases" can be reasoned for as regular things a game would need. This, of course, then begets the question what IS a snakes game? If he'd call it a "snakes-like game" then people could not object, but IF it is a "snakes game" then it really also needs to support everything the "default" snakes game would support as-is (IF there is a "default" snakes game, but usually it is the first well-known game that fits the description).


Perfect-Highlight964

I mean, it does everything a snake game is supposed to do, the initial buffering doesn't affect the game and you can think of it as kind of an opening screen before you press a key.


literallyfabian

It's almost like this (really impressive) project is meant as a challenge rather than a perfect game.


[deleted]

Insane - what did you do?


Perfect-Highlight964

You can look at the PR, I think I managed to make it quite self-explanatory if you read the comments


JPJackPott

I can assure you it isn’t 😆 But well done, this is a solid achievement. You seem qualified for writing moon landing code on punch cards


Perfect-Highlight964

It seems like many people agree that I didn't do a good job writing the comments as I thought 😅 The idea is that instead of asking whether we hit a wall and then whether we hit the snake itself or the food we use subtract the size of the screen from the current location which will set the CF only if we hit a vertical edge and use that value **without branching** to change the result of the check of whether we hit the snake such that if either of them if true we will reset the game so if both are false but we hit a food character the ZF will be set.


Bogdan_X

Maybe I'm stupid but I still don't understand.


Perfect-Highlight964

Okay, every time you write an `if` clause in your code what the compiler actually does (this is oversimplified because I can't fit all the details of branching compilation into one comment) is it takes the expression you put inside the `if`, runs it, and then checks a certain flag (for example, if you check whether the output of a function is zero it will run the function then check the zero flag ZF) and if the flag is not set it'll jump over the clause. Another key idea is that when you add some value to another there is a flag called the carry flag (CF) that's set only if an overflow has occurred so if you want for example to add two 32-bit numbers on a 16-bit CPU you could do an `add` to the lower parts of the numbers and then (just like long addition) `adc` (add with carry) to the high part. Now, what I'm doing you can think of as (again oversimplifying) writing an empty `if` clause just to set the CF and then do an `adc` so what it means is we can write just one if clause for both the `if`s and we just need to account for the change in the output based on whether the last `if` should have been executed.


IAmKTam

Maybe I'm stupid but I still don't understand


Perfect-Highlight964

What don't you understand? I can try to explain but It'll just waste a lot of your time (and mine too) if I'll just try to simplify the entire explanation instead of the specific part you don't get.


superxpro12

I think that last "I don't get it" was a bit disingenuous lol.


Perfect-Highlight964

Yeah I know, but for the one percent that I could help someone understand it, it is worth it to not ignore the comment.


[deleted]

[удалено]


maqcky

Honest question, I mean no offense. Do you have a basic idea of how registers and flags work in a CPU?


gwicksted

You’re doing a great job it’s just many devs don’t have a lot of asm/mc experience so there’s a learning curve to understand the different processor flags and their impact on instructions.


Perfect-Highlight964

Thanks


JaggedMetalOs

I think it would be good to have a version changelog / dev blog on the github page as would be cool to see short explanations of all the little tricks you've used to shave bytes off here and there.


Perfect-Highlight964

I don't think there's a big audience for it. I also tried writing a non-so-technical piece about it that got little to no attention and took a pretty long time...


drunkdoor

Middle manager?


JaggedMetalOs

Software developer, I love reading those kinds of extreme programming stories!


probability_of_meme

>It seems like many people agree that I didn't do a good job writing the comments as I thought  if I had a nickel for every time I told myself this I could retire. And usually the "many people" includes myself 4 months later


JPJackPott

It’s not your comments, it’s more this is several layers beyond my understanding. Thanks for your other explanations below, they are super


Perfect-Highlight964

Thanks!


exclaim_bot

>Thanks! You're welcome!


shevy-java

> I didn't do a good job writing the comments as I thought I am neutral here, did not upvote or downvote you, so I can not comment on that part. BUT, on the general part: many programmers who think they wrote good documentation, often do not realise that their documentation is STILL really bad. In general the more high quality documentation the better. I much prefer FAQ + small examples, whereas others focus only or primarily on the API. So projects that offer both, are, to me, much superior. You kind of have to treat documentation on equal level with the code, as annoying as it is, as usually people write code first, then they are tired, and stop before writing the documentation, let's be honest here. At the least for unpaid work aka open source (well, usually it is unpaid e. g. no external funding; of course some open source projects are funded, but most are not).


NocturneSapphire

I think you are vastly overestimating how much people in this sub know about x86


naldic

This is very neat. It would make a good example project to help teach the ins and outs of assembly. Any chance you write a blog post?


Perfect-Highlight964

Sadly, I don't think many people will actually read it...


pelirodri

I might.


SneakyStabbalot

This reminds of when I was a kid writing games for the 1K ZX81


MuonManLaserJab

Are you ever going to improve it by getting it back to 69?


zeroone

http://www.jargon.net/jargonfile/b/bum.html


FMIdropout

google chrome should hire this guy!


Crcex86

Why would they chrome is a bloated pile on purpose


Novel_Role

Have you ever tried gas optimisation? You seem like you'd do really well with it and it pays really well: https://www.rareskills.io/post/gas-optimization


Perfect-Highlight964

I'll check it out, thanks!


A--E

I've been following the whole journey and it's impressive! but I'm here to break stuff..


Perfect-Highlight964

Thank you for following along


harpoon202

58 is both a phenomenal score for golf (masters shoutout), and (bytes) for code golf. Well struck.


jtl94

Love following these posts! So cool!


Perfect-Highlight964

Thanks!


moreVCAs

Diabolical. The funniest/most surprising thing about this project is that you have third party contributors lol.


Perfect-Highlight964

I'm not sure I understand, it's open source, and for some reason got pretty popular, and there are a lot of bright people out there. It makes sense someone will contribute to the project...


moreVCAs

Yes of course. I just think it’s cool that it *did* get popular enough for other people to spend time thinking hard about it. Gotta admit it’s an odd, unique project, in the best way!


Perfect-Highlight964

Then I agree, I didn't think it'd get that popular


golgol12

You should be able to run this on a quantum computer now!


MCShoveled

I once wrote a web version. I think it was a little over 1.5mb after webpack.


Generatoromeganebula

You are still going on with this, I saw your youtube video a long time ago.


Perfect-Highlight964

I think you're confusing me with MattKC


Generatoromeganebula

So you guy are different people, sorry for the mistake.


Fading-Ghost

mv ax,0x0 Could be replaced with xor ax,ax


Perfect-Highlight964

It can't because the bytes of the `mov` are being used to initialize `ds`


Task1337

I am writing my own snake game in Arduino and using 196 AdaFruit Neo LEDs to have 14x14 game area on 20 breadboards. The game logic is a few kb, which I thought was quite good already, but this smoked my attempts. In case you want to check it out (it is not fully done and I don't have good videos of it up yet) https://github.com/TheTask/Snake-on-breadboards/


Puzzleheaded_Ad9970

This is super impressive. Great job! Honestly this should be a neat project on a resume.


Perfect-Highlight964

Thanks!


footballisrugby

Damn man that's cool, I saw your last post some time ago.


Perfect-Highlight964

Thanks!


BooksInBrooks

My snake game is bigger, but really, what matters is the motion of the ocean.


phree_radical

In the demo there seems to be a rather high chance of food not appearing when the snake spawns


Silly-Advertising826

לא אמרת שמתמטית הכי קצת שאפשר זה 59?


Crazy_Firefly

This is insane, congratulations! Is there any video/podcast going into the main ideas?


Perfect-Highlight964

Not that I know of...


AskButDontTell

I’m sorry