Ambient: A high-performance multiplayer game engine written in Rust

Produced | OSC Open Source Community (ID: oschina2013)

After more than a year in development, Ambient, an open-source multiplayer game engine written in Rust, has finally released version 0.1.

According to reports, Ambient is a runtime for building high-performance multiplayer games and 3D applications. It uses WebAssembly and WebGPU technology. It is compatible with any language that compiles to WebAssembly or runs on WebAssembly. It aims to enable the construction and deployment of rich Multiplayer worlds and experiences made easy. Its development team says that with Ambient, they hope that building a multiplayer game will be as easy as building a single-player game.

characteristic

  • Seamless networking: Ambient acts as both a server and a client. Developers only need to build server and client logic, and Ambient automatically handles data synchronization.

  • Isolated Sandbox: Projects that developers build for Ambient are executed through WebAssembly’s isolation capabilities. So if there is a crash, it won’t break the entire program, which also means it’s safe to run untrusted code.

  • Data-Oriented Design: Ambient’s core data model is an entity-component system that each WASM module can operate on.

  • Multilingual: Developers can build Ambient modules in any language that can compile to WebAssembly (Rust is currently the only supported language, and the team is working on extending it to other languages)

  • Single executable: Ambient is a single executable that runs on Windows, Mac, and Linux. It can act as server or client.

  • Interoperability: Ambient allows custom components and “concepts” (collections of components) to be defined. As long as Ambient projects use the same components and “concepts”, they can share data and interoperate.

  • Asset pipeline and stream processing: Ambient includes an Asset pipeline that supports compiling multiple asset formats, including .glb and .fbx . Assets are streamed over the network, so clients receive all the data they need when they join.

  • Powerful Renderer: The Ambient renderer is GPU-driven, and culling and level-of-detail switching are fully handled by the GPU. It uses PBR by default, and in addition supports cascading shadow maps and instancing everything that can be instantiated.

example

First install Ambient, then create a new Ambient project:

 ambient new

Then open _src/lib.rs_, add the following content to the main function, and let the IDE import it automatically:

 spawn_query(player()).bind(move |players| { for _ in players { Entity::new() .with_merge(make_transformable()) .with_default(cube()) .with(translation(), rand::random()) .with(color(), rand::random()) .spawn(); }

});

This will generate a random cube for each player that joins (see https://ift.tt/sxSyc13 for a full example). Start booting:

 ambient run

After running the above command, you will see the following screen:

Now open a new terminal window and type:

 ambient join

You’ll see two boxes, which means you’ve successfully built your first multiplayer experience with Ambient.

Members of the Ambient development team, who have built AAA games, explained why they started the project – they found that many game engines were optimized for building single-player games, but very few were designed to simplify multiplayer games. So they wondered: How would you build a multiplayer game that was as easy to use as a single player game? When developers are freed from the details of the network, what kind of extraordinary experience can be imagined – new and interesting interactions?

Ambient is the start of their answer to these questions: a runtime designed to enable developers of all kinds to build and share the experiences they want to build. However, the problem here is not just doing client-server communication well. It also includes all the other challenges that arise in multiplayer game development: server resources, distributing the game, running the game sustainably as a service, interacting with users, and more. The runtime is just the first step in that direction, and there are many other problems to be solved.

Ambient has adopted the MIT License, the team said, because their goal is to establish a standard for everyone to build multiplayer games. As a company, their plan is to provide value-added services (including servers and asset hosting) to the runtime that will be “monetized”, but the runtime itself will always be free and open source. As users of the runtime, they can choose to use some of the services provided by the Ambient team and implement others themselves.

In the future, the development team said that Ambient will support deployment to the Web, support more languages ​​that can be compiled into WebAssembly (currently only Rust), and provide a collaborative editor.

Speaking of open source game engines, Godot, as a “predecessor”, its development team thought about a question when 4.0 was launched: How far are they from mainstream commercial products ? Although Godot is free and open source software, anyone can modify it to achieve their own needs, and many large studios have the ability to create their own in-house technology. But even then, as the development of hardware became more and more complex, they gave up and instead spent money on existing commercial technology products.

The text and pictures in this article are from the OSC open source community

loading.gif

This article is transferred from https://www.techug.com/post/ambient-high-performance-multiplayer-game-engine-written-by-rust2404f35690513f30a29d/
This site is only for collection, and the copyright belongs to the original author.