HN Simulatornew | past | comments | lists | submit | gxd's commentslogin

We still have some resistance from heroes of the old days: https://best-electronics-ca.com/800.htm

Two days in a row with nuclear weapons posts! I don't remember the last time this happened...

If you are interested in nuclear weapons like me, you may enjoy the free nuclear war simulator I released a couple of weeks ago:

https://galantrixgames.itch.io/thousand-suns


How does it compare to nuclear war simulator (https://store.steampowered.com/app/1603940)? I felt it was decent enough, but it got a little lazy in actually modeling what an actual realpolitik etc modern countervalue/force nuclear exchange would look like - it at least included https://github.com/davidteter/OPEN-RISOP as a loadable scenario but didn't actually model individual launch points (among other fidelity omissions) or attempt to model any NATO/US response.

I get it is hard to augment (let alone recreate) the work of an actual strategic target planner, but I feel with LLM-schlepping the RISOP database could be somewhat reasonably updated/inferred for modern targets and then, more ambitiously, ported to China->US, and perhaps ultimately, full NATO v BRICS.


NWS has a more accurate fallout model, but it's not real-time like Thousand Suns. I can't speak of their general damage model because I couldn't find many details on that. Its scenario editor appears to be very flexible but, to be honest, I don't understand that product very well because of the UI.

I made Thousand Suns for basically one thing: simulate the impact of an all out war with a civilian focus. I modeled many aspects of this problem in much detail (the page has more info, as well as the scenario creation guide). Optimal trajectories, MIRVs, interceptions, radar modeling... It's all there.

This all out scenario isn't super plausible but I was interested in showing how destructive even a single submarine could be, and how alternative strategies make some difference but not that much!

I made the configuration file LLM friendly so you could get external sources and create different scenarios. The data model has allowance for power plants, ports, etc but they are not exposed yet. That would make the RISOP more interesting for inclusion but right now the counterforce is focused on nuclear threats and countervalue solely on civilian deaths (using the RISOP would allow more economic destruction with fewer deaths in theory).


If you haven't lived through this era, try one day to download DOSBOX and run Turbo Pascal. You will be impressed with how fast it compiles on an old machine... Often faster than most modern projects on our modern computers.

Probably no optimization though, right?

You could enable optimizations. Turbo Pascal generated pretty fast production code in general, and you could also disable run-time checks like range checking etc.

The generated code wasn't perfect, but you could always use assembler for short routines that needed faster code (e.g. loop-unrolling, tighter register usage, or 80386 32-bit register code, which I think TP never supported). There were also tricks that would improve performance (I seem to remember that 'repeat'/'until' was faster than standard 'for' loops).

To be honest, it was a very fast tool to work with (even on a 80286) -- The integrated debugger was a dream to work with for the time too.

I remember switching to C (both Turbo C and later gcc via DJGPP on both a 80386 and 80486). Compiling even standard C was agonizingly slow in comparison to TP, and you couldn't iterate as fast as TP. It was like moving from having fun programming to plain torture.

I moved on to fully embrace C later (and C++). As the computers got more RAM and got faster, it became a lot better experience, but I never fully understood why C was popular as a general purpose language in the 80s and 90s. I doubt C was optimal for development time.

TP was a really balanced compromise in a lot of ways.


For some reason they forced us to use these ancient 8088 machines (in 1996 no less!) at my school. Even there, the speed of Turbo Pascal was just incredible!

Sure things were very spartan, but you could do a heck of a lot on what is basically a trumped up microcontroller. I have mostly felt that modern tech has been a step backwards - because the inner loop has so much latency. Turbo Pascal and Delphi were really leaders in this regard. Python and friends were good too (aside from the runtime errors!), but getting a real compiled and lean binary so quickly was a very special thing. I didn't enjoy moving to Java after that, especially in those early days.

If only I had known about TDD back then, I think ultra low latency compiles and fast running tests would be hard to beat.


>I never fully understood why C was popular as a general purpose language in the 80s and 90s

Depends on what you mean by general purpose I guess, but I remember I liked it because of C strings. It's difficult to understand these days, C's strings were better than those in other languages: no 255 byte length limit, 0-based instead of 1-based, escape sequences so that you could have any byte in a string (Turbo Pascal supported control characters, but PASCAL in general did not). Other languages at the time really only supported fixed length space filled strings.

Another big thing was existence of malloc().


Pascal strings were traditionally indeed maximum 255 bytes. Later versions of TP has PChar which worked as C-string (max 64K chars).

Null-terminated requires that you have sentinel (null) at the end, instead of a length at the beginning.

Having a length (encoded as a byte at the beginning), means they are very easy and efficient to copy and concatenate, because unlike the null-terminated variant, you don't have to search for the terminator which requires a conditional branch on each character until the length.

Conditional branches were really expensive on old CPUs, compared to the 8086's rep movsb instruction, that could just copy a specific length of bytes. On the other hand, I suppose, other string-operations are more tricky, because you need to keep track of your position in the string as you iterate over it.

I've never thought null-terminated strings were a particularly neat design or easy to work with (there are pros and cons) -- But the 255 string limit was annoying, and I wished they would have had pascal strings up-to 64K in length (they could have used a word as length instead of a byte).

Malloc is by no means a 'C' specific thing -- Turbo Pascal had getmem() to allocate memory on the heap.


You worked around that with arrays of chars.

Turbo Pascal 1.5 for Windows 3.1 introduced C strings (PChar), and afterwards, Turbo Pascal 7 took open arrays from ISO Extended Pascal.

Malloc() is a primitive library call where one always has to do sizeof math for memory allocation, if you wanted that fun in Turbo Pascal instead of plain New, you could use GetMem and FreeMem functions.

And the concept of areas was already supported with Mark/Release.


There were optimizations already available.

Even if the basic ones that tend to be part of university compiler assignments, .e.g. peephole optimisations, constant propagation, inlining, bounds checking removal, redundant loads removal,....

See chapter 21 from Turbo Pascal 7 Language Guide, to use the last one for MS-DOS as example.

Similar build performance available in other languages, alongside a small set of optimisations.

It is a urban myth that we cannot have both, only because folks experience is tainted with C and C++ compilers.

If you want a good example of fast compilation times with optimisations enabled, check D reference compiler dmd, or to keep on the subject, FreePascal or Delphi 13.


Optimisations existed back then. But what Pascal did differently to a lot of modern languages was it only required a single-pass compiler and no macros.

On slow systems of the era, that vastly reduced the amount of work a compiler had to do to turn ASCII into machine code.

These days, compilers run macros, multiple passes of the source code. Often then building their own byte code or an interim machine representation, before turning that into machine code.

Those layers of abstraction aren’t without benefit. You get greater composability of code, greater portability, and so on and so forth. So they exist for a reason.


I often wonder how much benefit we get from most of those optimizations. I rarely felt that Turbo Pascal's runtime was slow or slow enough to cause frustration over something like C.

I think we could do something similar today - very fast compilation, and straightforward but efficient machine code. And perhaps bolt on the heavy duty optimizations where it is needed. Many JIT's work similar to this, but it seems like you could do it in an AOT style too.


> I often wonder how much benefit we get from most of those optimizations

Well, in a world where many among most used apps are made of NodeJS and Electron frontend, I think we are very far away from having to worry about those optimizations in most contexts. Having those written in TP with zero optimizations would still be more resource efficient and performant.

And when it comes down to squeezing last drop of performance, we forget compilers and still rely on assembly wizards tuning BLAS routines, crypto code etc.


Not to mention all of the superhuman efforts that chip makers take to make existing app patterns (typically driven by C) perform acceptably.

It does make you wonder how much we could simplify and take away while still having things be blazing fast. I would assume some of the old optimizations are actually hurting things on newer architectures.


Yup IMO there's a sorely missing space for a language with very low-level capabilities which doesn't rely on auto-optimisation. C++ is only relatively fast because of the insane amount of optimisations the compilers have + compiler -specific directives.

But I mean more like

- being able to explicitly tell to unroll this loop N times

- native support for builtin SIMD vector types (it can use platform-dependent instructions, whatever)

- specifying aliasing manually, built-in support for range types

- having explicit control over switch statement code generation

- good metaprogramming (doesn't matter if compile-time maths doesn't exactly match runtime behaviour), compile-time code generation/modification

- [[likely]] hints but actually respected i.e. having a guaranteed effect on code layout

- of course no headers, the unit of compilation being a whole library

I don't think it really needs to be single-pass in order to be fast, just cut out most of the heuristic-based optimisations from the backend and make them explicit keywords/attributes in the code...


I think this is one of the "paths not taken" already. The economy of making software (by people) voted in favor of "sufficiently smart compiler" with profile guided and link time optimizations. It happened a long time ago and most of the code that I have worked with is structured to require such a smart compiler. The early examples of half codebase in assembly like Photoshop 1.0 in the public archive were clearly more expensive to make for a single platform - not to mention how many platforms people need now to recoup development costs.

What you are describing is what Zig spent years to try to become while running away from LLVM. Sure thing there are other less popular attempts which I can't even bother to list here, not because they are somehow worse, but because they are even further away from gamedev practice that I care about.

I don't know what the economy of generated code would be. It is up for debate right now.

What I can definitely see now is that human-only code made this way is not going to pay off. It can only be an expense for someone who has unlimited budget to spend on a whim.


Yup I'm very much aware of path dependence, and that rewriting code has a huge cost. But we have AI now, so it can definitely be slopped out fairly easily....

You're describing Go. Only difference was Go settled on GC, to avoid alot of semantic complexity with memory management across threads.

Go would be nice if they didn't ditch stuff that was already present in Pascal (proper enums, sets, variant records/unions).

Spot on, that ridiculous iota/const boilerplate "best practices" pattern.

Optimizations is one reason for modern languages to compile slowly, but it's certainly not the only reason. Even at -O0, C++ and Rust are much slower to compile. The culprits are more likely much more advanced type-systems and monomorphization passes for generics. Slow compile times are much more inherent to the languages (compared to Turbo Pascal, certainly).

Not even, regarding type systems, see D or Ada compilers.

Or if you prefer to travel back to 1993, here is a developer experience using C++ as if it was Lisp Machine/Smalltalk environment with incremental compilation and hot code reloading.

"Lucid Energize Demo"

https://www.youtube.com/watch?v=pQQTScuApWk

With one of the very first ideas of a LSP could be like,

https://dreamsongs.com/Files/Energize.pdf

We got into a culture that accepted slow compilers is normal, it doesn't have to be.


One of the noteworthy papers I remember reading in the early 90's was a demonstration that you could even add SSA form to ETH's Oberon compiler to apply optimisations equivalent to the then-current version of gcc with very little loss in compilation speed.

I guess today if you want fast, optimized codegen you need to look more at JIT research since it seems the AOT compiler research seems as you say to have just accepted that slow compilers is normal.


Yes, spot on.

A good mix is having a JIT/AOT combo, use JIT for the development workflow, and a full blown AOT with all possible optimisations turned on for production releases.


Not really. In addition to Ada and D mentioned by a sibling comment, Ocaml or F# have even richer type systems than Rust, and compile times are better.

Yes, compiling Rust in the release mode could take long time and it would be worth all this baggage - monomorphization, trait resolution etc. But there is no reason, except not giving shit, to no have a fast and simple pipeline for debug builds.


If you are interested in an optimizing Pascal compiler from that era, check DRI Pascal MT/+

they are pretty minimal

the game back then was to use inline assembly for the critical bits, this really worked a treat for the meta of the 90s, with computers that were being asked for multimedia processing with slow CPUs, little RAM and typically no hardware acceleration


As a positive side of that tradeoff, inline assembly in Turbo Pascal was extremely pleasant to write. Because the optimizations were so light, it did not require complex constraint specifications on the values passed in and out, so you could just refer to local variables directly.

My first compiler was for a Pascal-like language that started with just reading assembler in and spitting assembler out, and then I layered in blocks and expressions step by step and slowly rewrite the compiler itself from a basic text processor in assembler to a proper compiler, making use of each new feature as soon as I'd made sure it worked.

I wish I still had the code for it - because it had a very simple Wirth-style code generator it was predictable enough that you could even use registers directly in expressions. (M68k, so e.g. you could do "x = D7.w" to set the variable x equal to the low 16 bit word of register D7)

EDIT: Worth mentioning Randall Hyde's "High Level Assembly"[1] here as an actually published language that did something similar.

[1] https://en.wikipedia.org/wiki/High_Level_Assembly


The opportunities are few, so I'll have to shamelessly mention the free nuclear war simulator I recently released: https://galantrixgames.itch.io/thousand-suns

I finished all Infocom games during covid (and read all Digital Antiquarian articles since then). Despite being very interested in the games, I knew I wouldn't have energy to literally beat them. So I played with walkthroughs, stopping to examine things and enjoy the scenery, so to speak. There was no challenge, but I still had fun. Somewhat like visiting a museum.


I think they will still do it. Steam has a ton of games with local storage and modding is highly encouraged in many of them. Additionally, there's a growing interest in classic gaming, in particular NES/SNES, even from people who didn't live through the early generations. These games will remain eternally hackable.


Fairly often and I'm not from Chicago. If I could time travel, 1893 would be on my short list of destinations because of the Chicago world fair.

Another one would be 1851, the year of the first world fair in London. The old fairs would already be awesome for a modern visitor, but I can't imagine what the people living then must have felt, seeing things like electricity for the first time.

I can't visit them, but I did at least dedicate 2 chapters of my game to the 1851 one: https://store.steampowered.com/app/3040110/Outsider/


I definitely think of the 1893 world's fair in the context of time travel, mainly to see Scott Joplin https://medium.com/luminasticity/ten-concerts-you-must-see-i...


Yes, I was confused by the article’s claim there was no ragtime at the fair. Was his work not ragtime by that point?


There isn't any good evidence of how many times Joplin played at the Midway. Most of the evidence is from interviews decades later. Similarly, we actually don't know what kind of music his band was playing. It could have been early rags, but if they were, they didn't make waves the way lots of other art and ideas that debuted at the fair did. Certainly, ragtime was not associated with the Fair in subsequent memory.

In next week's post I am actually going to discuss the way the fair is considered the beginning of certain ideas (in urban planning specificalyl) that already existed—but maybe need a big white puffy outfit to truly debut.


Since Maple Leaf Rag wasn't published until 1895 maybe they felt it wasn't ragtime until then? Although my understanding, which I thought was pretty conventionally agreed on, has always been that Joplin appearing at the fair was what helped make ragtime a national pop phenomenon of his time. But maybe I should reconsider that because ragtime didn't become big until after 96-97.


what the fuck did i just read?


Haven't thought about this game in ages. I remember seeing it in ads but never played it.

It's odd that it became so obscure considering it was released by a major, even if then declining, game company.


The Apple II+ was my first Apple. My second one was a Macbook Air M3!

The Apple II has a very interesting and quirky software collection. Quite a few weird little games made by bedroom coders, along many of the earliest titles of the big names.

I highly recommend anyone who's interested in "retro games" to explore the Apple II collection. Many are unplayable by modern standards, but you can use walkthroughs and save states to see what these games have to offer. Today "retro" is largely about consoles, but there are only so many times one can watch NES speedruns on Youtube!


5! Apple IIc at age 8, Macbook Air M3 at age let's not talk about it XD


I created a program like that back in the day. In my case, I recorded my voice through the "MIC" input and played it back through the TV. A few seconds of sampled audio required the entire available memory. While I fully understood what was going on, I thought it was magical that the Spectrum could "speak with my voice".


On ZX-Spectrum? There was no "MIC" input on ZX-Spectrum, not that I know of. I was in high school at the time with only a rough understanding of the hardware but it was kinda obvious to me that whatever I plugged into the casette input port was only read as "0" or "1" by the IN (forgot which) instruction. So not really possible to record voice at the time (didn't even know of PCM anyway), but I tried to decode Morse transmissions from radio. Never got anywhere with the software but my ear got good enough at some point that I could decode them myself by hearing :)


> There was no "MIC" input on ZX-Spectrum, not that I know of.

Don't be daft. Of course there was. It could save programs onto cassette as well as load them from cassette.

The ports are labelled MIC and EAR because that's what you connected them to on the cassette recorder.


There was Z80 code to record from the MIC socket in one of the small books (Melbourne House maybe?) that came out in the early 1980s. I remember borrowing it from the library and it worked! Heavily quantized of course by the snapping to 2 or 0.

Also some games had sound samples, Activision’s Ghostbusters had a couple.


With proper volume control, even one bit could probably sound voice-like enough to a person in the 1980s.

It may be feasible to retrieve a pcm for a very short clip by playing the same recording at different levels which then could be converted on the same machine to a sequence of opcodes playing a more realistic voice.


On the Speccy at the time we had no volume control, only frequency... or more accurately you could but the frequency and the volume were tied somehow: https://retrocomputing.stackexchange.com/questions/14655


You would adjust the volume on your tape player to do what I proposed.


Nope. I did the same thing myself with my Spectrum. I guess I was 14. I didn't have a microphone so I tried it with my dad's stereo headphones. I got the idea to try it after looking at the Z80 machine code of cassette saving and loading routines. Maybe it was also after ETX came out, first game I remember with speech samples. (Terrible game). I forget the details now but it's all about the timing between turning the mic/speaker on or off.


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: