HackerTrans
TopNewTrendsCommentsPastAskShowJobs

t0mek

no profile record

Submissions

Building a multiplayer Gameboy emulator with rollback netplay

blog.rekawek.eu
1 points·by t0mek·11 เดือนที่ผ่านมา·0 comments

Show HN: Rollback netplay for Game Boy emulator

blog.rekawek.eu
2 points·by t0mek·12 เดือนที่ผ่านมา·0 comments

comments

t0mek
·2 เดือนที่ผ่านมา·discuss
I like the "challenges" part at the end, especially the varying difficulty levels:

* A quadratic formula program, which outputs the number of roots and the x-intercepts upon the user inputting the values of A, B, and C.

* A fighting game, with health, a store, different enemies, weapons, armor, etc, with graphics and animation.
t0mek
·4 เดือนที่ผ่านมา·discuss
Only tangentially related (but hey, it's HN) - I'm so happy about the support/requirements for trailing commas in the modern language syntax:

    x = [
      123,
      456,
      789,
    ];
It makes editing such a list so much easier. Also, the commit diffs are cleaner (you don't need to add comma to the last element when appending a new one).
t0mek
·ปีที่แล้ว·discuss
Not a tutorial per-se, but here are 2 slides describing how I've done it:

https://www.slideshare.net/slideshow/emulating-game-boy-in-j...

Essentially, there are 4 channels, each providing a number 0-15 on every tick. Emulator should mix them together (arithmetic average), scale up to 0-255 and feed to the sound buffer, adjusting the tick rate (4.19MHz) to the sound output rate (e.g.: 22 kHz) - taking every ~190 value (4.19MHz / 22 kHz) is a good start.

Now the 0..15 value that should be produced by each channel depends on its characteristics, but it's well documented:

https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware

Channels 1 and 2 produce square waves, so a bunch of low (0) and high (15) values, with optional volume envelope (gradually going down from 15 to 0 on the "high" part of the square) and frequency sweep (alternating 0s and 15s slower or faster).

Channel 3 allows an arbitrary waveform, read from the memory.

Channel 4 is a random noise, generated by the LSFR.

See SoundModeX.java for the reference:

https://github.com/trekawek/coffee-gb/tree/master/src/main/j...
t0mek
·ปีที่แล้ว·discuss
Famous example from the pop-culture is Burr vs Hamilton:

> If you stand for nothing, Burr, what'll you fall for?
t0mek
·ปีที่แล้ว·discuss
The article doesn't mention the recent development in Amiga extension cards - PiStorm is an easy (and affordable) way to max out the specs of any Amiga, A600 included.
t0mek
·ปีที่แล้ว·discuss
I've always seen A600 more like a budget version of A1200 rather than a new variant of A500: better graphics chip, IDE port, PCMCIA and new look-and-feel of the Workbench 2.04 (at the first sight hardly distinguishable from the Workbench 3.0) gave a taste of something new.
t0mek
·ปีที่แล้ว·discuss
12 years ago, when we already had Arduino but no ESP32 yet, I built this thing:

https://newton-net-pl.translate.goog/2012/01/robot/?_x_tr_sl...

It was made of an old HTC Magic phone, acting as camera+wifi transmitter, connected to Arduino via its serial port and level shifter, to control the servo and a RGB LED. I had a lot of fan with that, even if the connection wasn't really to stable.

Thanks for sharing, maybe it's time to revive the project with the next generation of the microcontroller.
t0mek
·2 ปีที่แล้ว·discuss
Yes, the liar have some hats. There are two ways how to conclude this:

1. If they don't have any hats, then any sentence about them would be truth.

2. The negation of the sentence, which must be truth, is "not all my hats are green". For this to be true, there must be some hats that are not green, so there must be some hats in general.
t0mek
·2 ปีที่แล้ว·discuss
Programming a chess program was an important challenge for the "first generation of hackers" working on the mainframe machines like TX-0 and PDP-1 in '50 and '60, as described in "Hackers: Heroes of the Computer Revolution" by Steven Levy. I highly recommend this book, I think a lot of people here can recognize their own passion and interests in the stories described there.

Also, there's interesting implementation for the ZX-81, created over 20 years later and fitting in just 1024 bytes: https://users.ox.ac.uk/~uzdm0006/scans/1kchess/
t0mek
·2 ปีที่แล้ว·discuss
I love the slow pace of the video, including a few minutes presentation of all available programs. And indeed, there are programs to test dice and coin bias:

* https://youtu.be/bJiOia5PoGE?si=IEhbNJk0C0-7_2Nj&t=229

* https://youtu.be/bJiOia5PoGE?si=3Se3lYFVAAkElx0w&t=245
t0mek
·2 ปีที่แล้ว·discuss
We can also assume that the p/q=√2 is already the simplest form of the fraction, since every fraction must have one, as in the first section of the article.

Then if we figure out that both p and q are even, it means that p/q can be simplified (by dividing p and q by 2), which contradicts the assumption about the simplest form - and we don't need to use the infinite descent.
t0mek
·2 ปีที่แล้ว·discuss
Similar, but in Haskell: https://github.com/DataKinds/sixty-five-oh-two

It's a DSL for writing 6502 assembly.
t0mek
·2 ปีที่แล้ว·discuss
A few years ago, I spent a fair share of time trying to copy files from and to a Macintosh Plus. I decided to use a 100 MB ZIP drive (actually two of them, SCSI for the Mac Plus and USB for a modern computer) and later a serial port connection with terminal software [1].

Now there's a much better and cheaper option: BlueSCSI [2]. It's a SCSI HDD emulator that allows to mount .img files stored on a SD card as HDD disks. It also supports CD and network card emulation.

Once the files are copied on a such a virtual drive, they can be extracted on a modern machine using via some kind of HFS explorer or an emulator.

[1] https://blog.rekawek.eu/2016/12/08/mac-plus#hard-drive

[2] https://bluescsi.com/
t0mek
·2 ปีที่แล้ว·discuss
And if you have even older Mac (128/512/Plus) and want to use an almost modern PS/2 keyboard with it, please check my https://github.com/trekawek/mac-plus-ps2
t0mek
·2 ปีที่แล้ว·discuss
Same with Dell P3223QE.
t0mek
·3 ปีที่แล้ว·discuss
I remember having similar effects after long sessions of Lemmings. I saw the damn rodents when I was closing my eyes in bed, but it didn’t disturb my sleep (I guess they acted as sheeps to count).
t0mek
·3 ปีที่แล้ว·discuss
Trivia: this one was created by Adrian Zandberg, currently a Polish MP.
t0mek
·3 ปีที่แล้ว·discuss
This is similar to Kotlin single-expression functions, which are actually pretty useful:

    fun double(x: Int) = x * 2
https://kotlinlang.org/docs/functions.html#single-expression...

However, in Kotlin there's no single-line constraint, so it's possible to define an expression function e.g. with a long chain of collection methods: `filter().map().findFirst()...`