Live data from Hacker News

Porting my JavaScript game engine to C for no reason

phoboslab.org

81–90 of 139 posts

Re: Porting my JavaScript game engine to C for no reason

#81
post #69

> high_impact is not a “library”, but rather a framework. It's an empty scaffold, that you can fill. You write your business logic inside the framework. I normally phrase this in a much more negative way: a "framework" is simply a "library" that does not place nice with others. It's good to hear a sensible positive phrasing for once.

I studied Software Engineering, but never quite grasped the difference between a Library and a Framework until I started my first job developing with Web Objects.

It is a joy to use such a rich and well thought out Framework that really does do 99% of everything you need. Adding in your own stuff is about the easiest development I've ever done, and it just works. It was magic, and I miss using it.

Re: Porting my JavaScript game engine to C for no reason

#82
post #39

Earlier quoted context omitted.

The engine already compiles to WASM, see TLDR.

Direct link to playable wasm version: https://phoboslab.org/high_impact/biolab/

the number of layers it takes to get it to work on my phone is so high, but it's amazing.

Re: Porting my JavaScript game engine to C for no reason

#83
> My decision to sell it was met with a lot of backlash but was successful enough to launch me into a self-sustained career.

As someone who is interested in eventually freeing myself from the corporate job and diving head-first into my side projects, I would love to hear more about this aspect.

For some reason the idea of trying to charge folks for the work I would normally do for the fun of it on the side is daunting to me, even though I know it could enable me to focus on doing the stuff I love full-time.

Re: Porting my JavaScript game engine to C for no reason

#84

Earlier quoted context omitted.

One of the final nails was the infamous Chrome 45 aka the Chromepocalypse in the video ad world. Chrome 45, in the name of performance, defaulted to only loading flash from 3rd party domains after a "click to load". This was bad for ads for obvious reasons, but it was much much worse due to an implementation detail. In order to get the page laid out properly, Chrome loaded the flash component and then suspended it af…

> to trigger the impression pixel I've always wondered how ad companies verify the ad is actually being displayed. Can you explain this in more detail? I imagine it has to be somewhat "bulletproof" since money is involved.

I've been out of the space for about a decade, so I can't say how things have continued to evolve, but the only consistent antidote to fraud has been a trusted third party.

I spent a lot of my time back then pulling in metrics from third parties like Nielsen (who do traditional TV viewership numbers) as well as companies who specialized in "viewability". We could include that data in our real-time auction and bidders would adjust what they were willing to pay based on the reputation of the ad opportunity. At least that's the theory. In practice there was so much indirection and reselling that it was hard to say what was true.

As far as the technical answer: it's a game of cat-and-mouse but we found some interesting metrics we could dig in on. One was that fps of a video hidden behind another element on the page would have a drastically different rendered fps than one in the foreground. That would be different between browsers (and browser versions) but the viewability vendors would find all those quirks, measure, and analyze to give us a normalized score. For a hefty fee, of course.

Re: Porting my JavaScript game engine to C for no reason

#85

Earlier quoted context omitted.

One of the final nails was the infamous Chrome 45 aka the Chromepocalypse in the video ad world. Chrome 45, in the name of performance, defaulted to only loading flash from 3rd party domains after a "click to load". This was bad for ads for obvious reasons, but it was much much worse due to an implementation detail. In order to get the page laid out properly, Chrome loaded the flash component and then suspended it af…

> to trigger the impression pixel I've always wondered how ad companies verify the ad is actually being displayed. Can you explain this in more detail? I imagine it has to be somewhat "bulletproof" since money is involved.

I worked at a company that did this.

Here is the formula for viewability:

Percent In View = Area of the Intersection of the Ad and the Viewport / Area of the Ad

You would get the area of the ad using getBoundingClientRect, and the area of the viewport using window.innerWidth and window.innerHeight.

It was not possible to do this if the ad was within a hostile iframe (cross origin iframe) so you needed to use a third party source for this information like SafeFrame.

All of this was greatly simplified when Intersection Observer was officially supported by modern browsers.

Re: Porting my JavaScript game engine to C for no reason

#86

Looks like it’s a great game engine. Why does the article state its near end of life? Are there new engines that are far better?

The original JavaScript engine “Impact” from 2010 is at the end of its life; the C rewrite “high_impact” is new and will (potentially) be around for as long as we have C compilers and some graphics API. The JavaScript engine had a lot of workarounds for things that are not necessary anymore and some things that just don't work that well with modern browsers. From the top of my head: - nearest neighbor scaling for pix…

I loved Impact and paid for it back in the day, though I never ended up finishing the project I was working on. Did you ever throw the source for "Impact2" up anywhere? What's missing from it being releaseable?

Re: Porting my JavaScript game engine to C for no reason

#87
I owe a lot of the most informative programming work I’ve done to Impact.

Impact was so ahead of its time. Proud to say I was one of the 3000 license owners. One of the best purchases I’ve ever made. The only game I’ve ever really properly finished was made in Impact.

I loved that the source code was part of the license, and even modified the engine and the editor to suit my needs.

I was so inspired that I worked on my own JS game engine (instead of finishing games - ha!) for years after. I never released it, but I learned a ton in the process and made a lot of fun gamejam games with it.

I was also inspired by Impact’s native iOS support (Ejecta), but frustrated that it didn’t run on Android (at the time at least), so I fumbled my way through writing JVM bindings for V8 and implemented a subset of WebGL to run my game engine on Android without web views.[0] I made the repo for V8 bindings public and to my surprise it ended up being used in commercial software.

I won’t bore you with the startup I tried to bootstrap for selling access to private GitHub repos, which was inspired by Impact’s business model…

Anyway, it warms my heart and makes me laugh with glee to see Impact getting an update for the “modern” web with a C port!

I’d say these are strange times for the web, but I can’t remember a time when things were anything but strange. Cheers!

[0]: https://github.com/namuol/jv8

Re: Porting my JavaScript game engine to C for no reason

#88
post #69

> high_impact is not a “library”, but rather a framework. It's an empty scaffold, that you can fill. You write your business logic inside the framework. I normally phrase this in a much more negative way: a "framework" is simply a "library" that does not place nice with others. It's good to hear a sensible positive phrasing for once.

The way I heard it described is that you call the library while the framework calls you.

Re: Porting my JavaScript game engine to C for no reason

#89
post #48

Earlier quoted context omitted.

Flash had numerous issues. The processing power available (especially on a PSP) is more than enough to be “good”, the problem with flash _performance_ is the power usage while achieving that perf. Even on laptops flash was a significant battery life drain whenever it was running, having it on all websites would kill battery life while browsing on a phone.

Yeah it did. I'm just sad that it took down ActionScript with it. IMO this is the language Javascript should have been.

ActionScript was a big influence on ECMAScript 4 until it was abandoned and scaled back for ECMAScript 5 “Harmony”:

https://en.m.wikipedia.org/wiki/ECMAScript_version_history#4...

Re: Porting my JavaScript game engine to C for no reason

#90
Honestly I would never ever execute any code from this guy. He is the inventor/founder behind the coinhive crypto mining network. [1]

This guy made billions illegally [2], and maintained the biggest ransomware crypto coin network for years, by offering the tools and SDKs to fund dozens of cyber war involved agencies across the planet. [3]

I have no idea how he got away with it, because his name keeps appearing in lots of crypto trading companies and trade registries. (Not gonna post them, but you can google his name to find this evidence)

He even organized a doxxing campaign against brian krebs at the time called "krebsistscheisse" via his pr0gramm platform [4] [5] [6], to somehow defend the idea that abusing user's computers for personal enrichment is a legit way of making money if you donate some low percentage to cancer research with it?!?

Sorry, but I would never trust this guy's code again. You should be careful, and audit any code he writes before you execute it.

[1] https://krebsonsecurity.com/2018/03/who-and-what-is-coinhive...

[2] 30% fee of monero/XMR went to coinhive: https://coinmarketcap.com/currencies/monero/

[2b] Schuerfstatistik on pr0gramm, where it all started: https://web.archive.org/web/20231005033135/https://pr0gramm....

[2c] Troyhunt analysis after he snatched away the coinhive TLD: https://web.archive.org/web/20240804081830/https://www.troyh...

[3] https://www.trendmicro.com/vinfo/us/security/news/cybercrime...

[3] https://krebsonsecurity.com/tag/dominic-szablewski/

[4] https://krebsonsecurity.com/2019/03/annual-protest-raises-25...

[5] (German) https://www.t-online.de/digital/aktuelles/id_83466874/tausen...

[6] https://www.heise.de/news/krebsistscheisse-Spendenwelle-an-K...

(Lots of other articles about it, and that dominic szlablewski was the guy behind coinhive, and the original owner of pr0gramm, while still doing development work for the company that owns the imageboard officially nowadays)

Post reply on HN