Hacker News new | past | comments | ask | show | jobs | submit | yohannesk's comments login

Writing correct code did not start after the introduction of the rust programming language


Nope, but claims of knowing to write correct code (especially C code) without borrow checker sure did spike with its introduction. Hence, my question.

How do you know you haven't been writing unsafe code for years, when C unsafe guidelines have like 200 entries[1].

[1]https://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definit... (Annex J.2 page 490)


It's not difficult to write a provably correct implementation of doubly linked list in C, but it is very painful to do in Rust because the borrow checker really hates this kind of mutually referential objects.


Hard part of writing actually provable code isn't the code. It's the proof. What are invariants of double linked list that guarantee safety?

Writing provable anything is hard because it forces you to think carefully about that. You can no longer reason by going into flow mode, letting fast and incorrect part of the brain take over.


I am curious as a non game developer, are these types of games deterministic? If so if I send to the server that I moved huge units to attack another huge units, can the server determine what the end will be? Why do we face a network issue?


This article is a classic, 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond

https://www.gamedeveloper.com/programming/1500-archers-on-a-...

Edit: original where the pictures work https://web.archive.org/web/20180719170411/https://www.gamas...

> Rather than passing the status of each unit in the game, the expectation was to run the exact same simulation on each machine, passing each an identical set of commands that were issued by the users at the same time. The PCs would basically synchronize their game watches in best war-movie tradition, allow players to issue commands, and then execute in exactly the same way at the same time and have identical games.


Which was great until there's a bug and it just says "sync error" and your 3 hour game is gone.


When this happens in Factorio, the game pauses, one player (the server?) saves the game and sends it to all other players who load the savefile and the game resumes when that's done. It's not a nice experience, but it's a lot better than "you can't play today, goodbye!"


Same with RA2/YR.

All it took was for some salty player to activate a trainer or prez IFS and kill the game.

I like that the lobbies were ran over IRCd.

Dreamforge IRCd with the server password being "supersecret".


Many (not all) RTS games use a networking method called lockstep synchronization that requires the gameplay to be deterministic, but has its own downsides. One of those being that if one player lags, everyone lags. I know AOE 1 and 2 use it, and I assume 3 as well


For Beyond All Reason, it seems the Spring/Recoil engine will eventually decide to "close the action window", so that if one player is lagging hard, they simply submitted no actions for that "round" and the rest of the players keep going.

I know because I've gotten to the point in the late game where my computer can't simulate at realtime, and I can no longer control my units, but everyone else keeps playing.

Conveniently you can even still sort of chat in this state, and ask a teammate to assume control of your army on your behalf.


The good thing being that you get replay for free.


It's got downsides. There's often no way to recover game state without actually running the simulation, and often no way to go backwards either. If you miss a moment in the replay you gotta watch the whole damn thing all over gain.


You get that with any type of networking.


They can be deterministic but I think you might be confused about the kind of game

In RTS games like 0AD or AoE you don't just send a single huge unit to attack and wait for the result, you send many tens of individual units near enemy units, then the "battle" goes on in real time and you can micromanage units to influence the outcome. You can't just simulate it on the server because the server can't simulate the thought process of the players


AoE2 battles are all about the micromanagement. Last minute splitting the onslaught of trash units against your opponents treb micro shot can change everything.

Kind of old but lots of micro tactics per unit here: https://youtu.be/hjUgisPD_C4?si=F-UvzDOTsWRZhZSq


Even more absurd is that Mac Studio with 512GB RAM costs around $9.5K


> Peak HN.

But, alas, not a single upvote.


If you are wondering why not Rust instead of Go, they outline why Rust was not chosen. This is a port not a reimplementation. Many of the data structures can not easily be ported to Rust, such as Nodes with cyclic dependencies. Check the longer interview here: https://www.youtube.com/watch?v=10qowKUW82U&ab_channel=Michi... Also, I think the discussion on esbuild's choice of language applies here as well as it has a large similarity. You can find it here on hn


I don’t think there was any dig implied. And I will second that it will add to self esteem. Specially during discussions if you have more understanding about the code you will have both better contribution and take away


Sure, when you succeed in understanding someone else's legacy codebase, it builds self esteem. When you fail attempting to do that, it does the opposite.


I have inherited projects where I just could never understand what they were thinking well enough to make the service good (not running out of memory and crashing). It was very humbling; I still sometimes wake up in the middle of the night with things I wish I'd tried, but the assumptions of how it all worked was just scattered throughout a bunch of files and the assumptions of everything was just not how I'd do it.


I have a question, do you know of any spaced repetition app that is free for iOS similar to AnkiDroid?


The anki website has some UI so you could do the reviews there. A bit minimalist though.


How? Which ever button I press, I only get static. Am I region blocked? I have tried all the keys on my keyboard as well

Edit: It works on Firefox for some reason. Maybe extensions? I am not sure


That’s quite nice. But to put things in perspective, the entire country of Norway’s population is much less than NYC and also it’s not dense. I can’t imagine how you would implement that here


It is here. AED’s are everywhere in NYC. Whether someone actually stops to help is another story.


Is there a language or tool with no runtime? Also Config files can be JSON. I find nothing weird when it comes to .NET on linux vs any other technology


The Redis runtimes are colloquially referred to as "Linux" and do not have to be installed by the user.


I think you're really picking at nits.

"apt install redis-server" on my server says that the following will be installed:

- libjemalloc2

- liblzf1

- redis-tools

Garnet requires .NET, so...

apt install aspnetcore-runtime-8.0

Acting like Redis works "out of the box" while Garnet requires a whole other paradigm shift is disingenuous. I have no dog in the fight - I use macOS and I don't use Redis or Garnet.


Just flag+downvote and move on, it's been 8 years already and it never changes.

While on the topic of macOS, Swift Library Evolution ABI support is coming .NET for native integration with Swift (particularly for system APIs). I have not tried it yet but it's an interesting feature AFAIK no other language has, well, besides Swift itself.


Couldn’t you do that with self contained dotnet build?


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: