TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond (2001)

398 点作者 AntiRush超过 2 年前

18 条评论

Centigonal超过 2 年前
Seeing stuff like this on here fills me with nostalgia.<p>I basically learned to code thanks to a few helpful and extremely patient IRC members in the Spring RTS engine[1] community (some of whom I spot in these comment sections on occasion - hi!), and deterministic lockstep simulation for online play was one of the first ideas that totally blew my mind when I learned about it (&quot;b-but that means all the &quot;random&quot; numbers on every computer need to be the same! and so do all the floating point calculations across different hardware!&quot;). Of course, to me at the time, that was deep magic that I thought I&#x27;d never be able to fully understand.<p>[1] see <a href="https:&#x2F;&#x2F;springrts.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;springrts.com&#x2F;</a> - or check out <a href="http:&#x2F;&#x2F;zero-k.info&#x2F;" rel="nofollow">http:&#x2F;&#x2F;zero-k.info&#x2F;</a> and <a href="https:&#x2F;&#x2F;www.beyondallreason.info&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.beyondallreason.info&#x2F;</a> for games on the engine that are still pretty active
评论 #34397166 未加载
评论 #34396652 未加载
评论 #34401284 未加载
评论 #34397216 未加载
评论 #34400252 未加载
CSMastermind超过 2 年前
Lots and lots of great things in here, thank you for sharing.<p>&gt; At first take it might seem that getting two pieces of identical code to run the same should be fairly easy and straightforward<p>I found that a little funny. I would certainly <i>not</i> assume that. Synchronization problems are one of the scariest areas of programming in my opinion.
评论 #34396671 未加载
Waterluvian超过 2 年前
I think this is a “must-read” for anyone, even if you aren’t in game dev or doing networking stuff. There’s just so many mini “eureka!” nuggets to enjoy.<p>I think that internet multiplayer is possibly one of the hardest things in game dev (use an engine that gives it to you!!!) despite feeling like some little sideshow.<p>I imagine Blizzard and Westwood have similar stories from the 90s.
评论 #34398314 未加载
lamacase超过 2 年前
&gt; Cheating to reveal information locally was still possible, but these few leaks were relatively easy to secure in subsequent patches and revisions.<p>I don&#x27;t understand this. Running the whole simulation locally on both ends means that a modified client would have access to the whole game state, and I don&#x27;t really see how you could patch that out.<p>Anyone have any idea what they actually did? Try to detect modified clients? Obfuscate the game state to make it harder to interpret?
评论 #34396626 未加载
评论 #34398337 未加载
评论 #34396858 未加载
Dalewyn超过 2 年前
As someone who grew up playing Age of Empires II and still consider it among the best games ever made, reading this is nothing short of amazing.
评论 #34396511 未加载
评论 #34396149 未加载
AshleysBrain超过 2 年前
What I find interesting about the lockstep approach described here is it seems a lot of modern RTS games still use the same approach, even though the bandwidth calculations have changed radically. When developing my own RTS game I was able to fairly straightforwardly get 1000 units in combat to live stream using about 50 KiB&#x2F;s bandwidth, which is nothing these days: <a href="https:&#x2F;&#x2F;www.construct.net&#x2F;en&#x2F;blogs&#x2F;ashleys-blog-2&#x2F;rts-devlog-units-bandwidth-1603" rel="nofollow">https:&#x2F;&#x2F;www.construct.net&#x2F;en&#x2F;blogs&#x2F;ashleys-blog-2&#x2F;rts-devlog...</a><p>So as much as this is a fascinating piece of history and an impressive technical solution to the constraints of the time, I think modern games ought to move past it.
评论 #34399515 未加载
评论 #34398958 未加载
TacticalCoder超过 2 年前
IIRC, and I&#x27;ve got nearly all my emails since the nineties until now so I could find out, I sent an email to the author of that article back when I read it, I think, still IIRC, on the <i>Gamasutra</i> website. And he answered me: we chit-chatted about deterministic game engines, for I wrote one in... 1991! (not for a networked-game though).<p>The subject already came up here on HN and some posted about games using deterministic engines before AoE.<p>The reason I did it is I had a bug which happened ultra-rarely and couldn&#x27;t figure it out so I thought a long time about this and realized a could make the game deterministic and that would <i>maybe</i> allow me to record the bug happening and then be able to replay it. I found that by myself: back in 1991 I had never heard of anyone writing a deterministic engine back then. So I took a few days and rewrote the engine to be fully deterministic. Sure enough it eventually caught the bug: some case where the hero would clear a level after having fired two shots at once, which was an extra (by default it only had one shot at any time). The shot still on the previous level would continue to &quot;live&quot;, invisible, in the following level, and would corrupt the memory. Classic.<p>Oh the memories to see that article again!
tigerlily超过 2 年前
This site used to be Gamasutra didn&#x27;t it?
评论 #34396399 未加载
评论 #34395946 未加载
评论 #34396860 未加载
poglet超过 2 年前
It&#x27;s interesting how the online gameplay has changed between the different versions of the game as network latency has improved.<p>For example, being able to micro manage archers to dodge other archers, and time their shots is something that wasn&#x27;t possible previously.
评论 #34395886 未加载
评论 #34396090 未加载
Emjayen超过 2 年前
As someone who fixes up old games in my spare time, and Age of Empires II being one of them, I&#x27;ll provide a bit of trivia about the game&#x27;s internals:<p>- The AI system is not part of the deterministic simulation. This was surprising to me, and after contacting one of the original programmers it was explained that it was due to a desynchronization bug that the &quot;AI and network programmers weren&#x27;t able to fix it in time&quot;.<p>A consequence of this design regression is that, due to the AI now being authoritatively run by the designated host player, network congestion issues arose which lead to a clear series of progressively more aggressive optimizations to reduce egress traffic. This primarily consisted of a very simple filter (mentioned in the article) which dropped duplicate commands in the common submission path, meaning it applied to both local user and AI commands, along with batching of AI-submitted commands which would be flushed at rather arbitrary times.<p>I&#x27;ll note that I&#x27;ve restored AI being deterministic in my project.<p>- A rather obscure determinism bug resulted from their compiler&#x27;s implementation of a few CRT routines, namely fsin&#x2F;fcos and a few others, which leveraged the specialized ISA instructions of the same name. The problem being that these transcendental functions are beyond the scope of the IEEE 754 spec. and ergo are hardware implementation-dependent. In practice, contemporary Intel&#x2F;AMD chip families produce bitwise the same result, however those around the time of AoE are known to diverge on results to some small margin (as confirmed by an Intel engineer on a thread I came across while researching).<p>- The game employs a dirty-update system for rendering, not only that it&#x27;s at a scanline granularity. This was something I was very pleased to see, as it&#x27;s a exceedingly rare to see such an important optimization in games of this era (although common in earlier eras)<p>- There&#x27;s some &quot;interesting&quot; naming conventions, one being prefixing member variables names with &quot;value&quot; -- there&#x27;s even a &quot;valueValue&quot;. Very little consistency in general in this regard, a reflection of independence between teams working on different components.<p>- While there are attempts at validation of input into the simulation (albeit woefully inadequate), it relies on ad hoc inclusion of PID (player ID) fields within commands. This is entirely useless, as this information is not authoritative and controlled by the players, permitting them to &quot;spoof&quot; the contextual information required for validation.<p>This is one of the more perplexing aspects of the engine, especially given the necessary information about the origin of a command is ofcourse available.<p>(As this information was later publicly published by other individuals I don&#x27;t see a problem with elaborating on it here as I have)<p>- An example of missing the wood for the trees: session information goes through an ad hoc compression for its wire form (just bitpacks fields) to conserve bandwidth, however the architectural choice is to synchronize this session state by just having the host broadcast the state --dirty or not-- every 200ms, flooding the network pointlessly (atleast in the 18.8k days)<p>- While Age of Empires is somewhat notorious for its poor multiplayer performance (notably when contrasted with say, the recent &quot;Definitive Edition&quot;), and while its implementation of this synchronization model is certainly rather juvenile, it should be understood that the final MP gameplay issues are primarily due to the choice of a peer-to-peer topology over the public internet, which at the time was the most reasonable.<p>While superficially P2P may seem like it should achieve the lowest latencies for instance, the reality is that the primary determinant is the characteristics --jitter, delays and packet-loss, reordering, ect-- of the path between two hosts and a P2P architecture means there&#x27;s n*n paths (network egress&#x2F;ingress paths are typically asymmetric). In contrast, a server&#x2F;client model you not only have far fewer routes, but datacenters are located at critical points in the network, roughly analogous to comparing travelling A-&gt;B along a freeway versus via the maze of residential streets.<p>- The state checksum &quot;algorithms&quot; involved are bordering on useless, atleast for state-tracing (such as when debugging desync. bugs.). They appear to have been devised by way of believing doing &quot;a bunch of random bitwise ops&quot; constitutes sufficient mixing -- a quick test demonstrated that csum collisions were not just possible, but occured sometimes for over 80% of inputs.<p>--<p>There&#x27;s a lot more that could be said but I feel that&#x27;s enough for now.
评论 #34399242 未加载
评论 #34398528 未加载
评论 #34398437 未加载
评论 #34422514 未加载
评论 #34400414 未加载
评论 #34404527 未加载
xivzgrev超过 2 年前
I enjoyed reading how they solved synch problem: schedule this moments commands for 2 turns from now, and the turn length is dynamic to smooth out experience.
xupybd超过 2 年前
Maybe a 2001 in the title would help?
评论 #34396168 未加载
评论 #34396186 未加载
ironSkillet超过 2 年前
I love seeing the inside of the game development cycle from a technical perspective, thanks for sharing.
khalidx超过 2 年前
That&#x27;s crazy I see this post. Haven&#x27;t read it yet, but I just played a 3v3 game out of nostalgia. People still play this game years later, and it works great.
lithander超过 2 年前
An RTS we developed just recently (Iron Harvest) is still based on the same basic principle. But instead of peer to peer we use a &quot;smart&quot; proxy server that receives the commands of all clients and sends the entire sequence back to the client. That way if one client has a high ping the other players latency isn&#x27;t affected.
fragmede超过 2 年前
(2001)
idorosen超过 2 年前
For those who don’t want to suffer from eye-bleeds due to ads, interstitial scrolling ads, more ads, and awful formatting, Googling the title yields this PDF:<p><a href="https:&#x2F;&#x2F;zoo.cs.yale.edu&#x2F;classes&#x2F;cs538&#x2F;readings&#x2F;papers&#x2F;terrano_1500arch.pdf" rel="nofollow">https:&#x2F;&#x2F;zoo.cs.yale.edu&#x2F;classes&#x2F;cs538&#x2F;readings&#x2F;papers&#x2F;terran...</a><p>Maybe the link can be replaced? Also can (2001) be added to the title?
评论 #34396141 未加载
评论 #34396714 未加载
mirchiseth超过 2 年前
Who remembers tourneys for Age of Empires at Sunnyvale Fry&#x27;s.
评论 #34398079 未加载