Skip to content

Commit

Permalink
Merge branch 'master' into 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mafiesto4 committed Sep 20, 2023
2 parents 5b5c6b0 + 2b90a92 commit 390aead
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 15 deletions.
10 changes: 5 additions & 5 deletions manual/editor/large-worlds/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Flax Engine by default uses `32-bit` precision (single precision, `float` type)

### Enabling Large Worlds

Use [Custom Engine build](../advanced/custom-engine.md) and modify `Flax.flaxproj` file by setting `"UseLargeWorlds": true`. Then build the engine. It will overlap all Vector2/3/4 components from `float` into `double` and store object coordinates with higher precision.
Use [Custom Engine build](../advanced/custom-engine.md) and modify the `Flax.flaxproj` file by setting `"UseLargeWorlds": true`. Then build the engine. It will overlap all Vector2/3/4 components from `float` into `double` and store object coordinates with higher precision.

The engine supports loading and saving projects with both `UseLargeWorlds` enabled and disabled without any compatibility issues. Which means that you can still open project with default engine version, even if it was edited with Large Worlds support enabled.
The engine supports loading and saving projects with both `UseLargeWorlds` enabled and disabled without any compatibility issues. Which means that you can still open your project with the default engine version, even if it was edited with Large Worlds support enabled.

### Real type

When using large worlds various in-built types get converted into higher precision format, such as:
When using large worlds, various in-built types get converted into higher precision format, such as:
* `Vector2`, `Vector3`, `Vector4`
* `BoundingBox`
* `BoundingSphere`
Expand Down Expand Up @@ -56,11 +56,11 @@ Real coordinate = GetActor()->GetPosition().X;
Flax contains relative-to-camera rendering which allows to shift the `Origin` of the whole scene when rendering. It's automatically calculated when rendering a scene with `LargeWorlds.UpdateOrigin` based on the current camera location. It can be disabled with `LargeWorlds.Enable`.

> [!TIP]
> Even when using 64-bit precision, the whole rendering still uses 32-bits as using larger data has high-performance impact.
> Even when using 64-bit precision, the whole rendering still uses 32-bits as using larger data has a high performance impact.
## Physics origin

A physical simulation system supports adjusting the origin of the simulation world. This can be used to improve collisions and forces simulation because the underlying PhysX library uses 32-bit precision and won't achieve high-quality simulation in large worlds scenario.
A physical simulation system supports adjusting the origin of the simulation world. This can be used to improve the simulation of collisions and forces, because the underlying PhysX library uses 32-bit precision and won't achieve high-quality simulation in a large worlds scenario.

You can easily synchronize the current main game view origin with physics origin (or manually calculate it with `LargeWorlds.UpdateOrigin`):

Expand Down
10 changes: 5 additions & 5 deletions manual/get-started/flax-for-unity-devs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ This section contains the most common terms used in Unity and their Flax equival

![Flax Project](../media/project-structure.png)

Flax projects structure is similar to Unity projects. Instead of **Library** folder, editor uses **Cache** folder. Also **Assets** folder from Unity is splited into two separate parts: **Content** and **Source**. All C# script files are located in source directory so there is less mess with assets and scripts.
Flax projects structure is similar to Unity projects. Instead of **Library** folder, editor uses **Cache** folder. Also **Assets** folder from Unity is splitted into two separate parts: **Content** and **Source**. All C# script files are located in the source directory so there is less mess with assets and scripts.

Flax also generates a solution and project files for your game C# scripts.

See [Flax projects structure](../project-structure.md) page to learn more about the projects in Flax Engine.

## Assets

Flax doesn't use `.meta` files. Instead of it, every asset contains all required metadata information and is a self contained file. Files with extension `.flax` are using our own binary format that is well optimized for scalability and streaming. Other assets are usually stored in `Json` format (scenes, settings, etc.).
Flax doesn't use `.meta` files. Instead, every asset contains all required metadata information and is a self contained file. Files with the extension `.flax` are using our own binary format that is well optimized for scalability and streaming. Other assets are usually stored in `Json` format (scenes, settings, etc.).

Flax supports the most popular asset files formats (for 3D models and textures) so you can import your game content.
Flax supports the most popular asset file formats (for 3D models and textures) so you can import your game content.

See [Assets](../assets/index.md) page to learn more about importing and using game assets.

Expand All @@ -59,7 +59,7 @@ Flax doesn't use components to build scene objects logic. We use [Actors](../sce
However, you can still use the entity-component design with your scripts because every actor can have scripts like in Unity.
Just instead of using `GetComponent<T>()` in your scripts, write `GetChild<T>()`/`GetScript<T>()`.

In Flax, Scene object is also an Actor so you can access it like any other Actor. This means that Scenes can have their own scripts and be transformed like other objects.
In Flax, a Scene object is also an Actor so you can access it like any other Actor. This means that Scenes can have their own scripts and be transformed like other objects.

> [!Tip]
> Flax's coordinate system's base unit is centimeters instead of meters, meaning a Flax Actor placed at <100,100,100> is in the equivalent position of a Unity Transform placed at <1,1,1>.
Expand All @@ -68,7 +68,7 @@ In Flax, Scene object is also an Actor so you can access it like any other Actor

When it comes to game scripting, Unity and Flax are very similar. There are some differences in C# API (Flax has bigger math library, is more performance-oriented and uses new C# 11 via .NET 7). In fact, the whole C# editor and C++ engine including scripting API is open and can be found [here](https://github.com/FlaxEngine/FlaxEngine). All contributions are welcome.

Also, Flax support native **[C++](../../scripting/cpp/index.md)** scripting and **[Visual Scripting](../../scripting/visual/index.md)** as an in-build feature. We don't want to limit our developers to just a one programming language for the game development as using C\+\+ and Visual Scripting together with C# can benefit.
Also, Flax support native **[C++](../../scripting/cpp/index.md)** scripting and **[Visual Scripting](../../scripting/visual/index.md)** as a built-in feature. We don't want to limit our developers to just one programming language for the game development as using C\+\+ and Visual Scripting together with C# can benefit.

If you write C# scripts simply replace `MonoBehaviour` with `Script` as it makes more sense (and is shorter to write).

Expand Down
2 changes: 1 addition & 1 deletion manual/get-started/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The launcher will check and begin installation if it is missing, however if your

Flax Launcher requires [Microsoft .NET Framework 4.5.2](https://www.microsoft.com/en-us/download/details.aspx?id=42642) or higher.

Flax Editor requires [.NET SDK 7](ttps://dotnet.microsoft.com/en-us/download/dotnet/7.0).
Flax Editor requires [.NET SDK 7](https://dotnet.microsoft.com/en-us/download/dotnet/7.0).

We also recommend using Visual Studio 2022 for writing code.
You can download the free community edition [here](https://www.visualstudio.com/downloads/).
Expand Down
Binary file modified manual/graphics/tutorials/media/outline-material.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion manual/networking/high-level.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ GameSettings.LoadAsset<NetworkSettings>().SetInstance(networkSettings);
|--------|--------|
| **Max Clients** | Maximum amount of active network clients in a game session. Used by server or host to limit amount of players and spectators. |
| **Protocol Version** | Network protocol version of the game. Network clients and server can use only the same protocol version (verified upon client joining). |
| **Network FPS** | The target amount of the network system updates per second. Higher values provide better network synchronization (eg. *60* for shooters), lower values reduce network usage and performance impact (eg. *30* for strategy games). Can be used to tweak networking performance impact on game. Cannot be higher that UpdateFPS (from [Time Settings](../editor/game-settings/time-settings.md)). Use 0 to run every game update. |
| **Network FPS** | The target amount of the network system updates per second. Higher values provide better network synchronization (eg. *60* for shooters), lower values reduce network usage and performance impact (eg. *30* for strategy games). Can be used to tweak networking performance impact on game. Cannot be higher that UpdateFPS (from [Time Settings](../editor/game-settings/time-settings.md)). Use 0 to run every game update. Use value lower than 0 if you want to disable automatic field replication. |
|||
| **Address** | Address of the server (server/host always runs on *localhost*). Only `IPv4` is supported. |
| **Port** | The port for the network peer. |
Expand Down
2 changes: 1 addition & 1 deletion manual/scripting/code-examples/properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class MyScript : Script
{
public bool Field1 = 11;
public float Field1 = 11;
public Color Field2 = Color.Yellow;
public DirectionalLight Field3 { get; set; }
}
2 changes: 1 addition & 1 deletion manual/scripting/code-examples/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ API_CLASS() class GAME_API MyScript : public Script
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE(MyScript);

API_FIELD() bool Field1 = 11;
API_FIELD() float Field1 = 11;
API_FIELD() Color Field2 = Color::Yellow;
API_FIELD() ScriptingObjectReference<DirectionalLight> Field3;

Expand Down
15 changes: 14 additions & 1 deletion manual/scripting/cpp/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,23 @@ Example:
```cpp
#include "Engine/Serialization/JsonWriters.h"
#include "Engine/Serialization/JsonSerializer.h"
#include "Engine/Platform/File.h"
rapidjson_flax::StringBuffer buffer;
// PrettyJsonWriter can be also used here for better JSON formatting
CompactJsonWriter writer(buffer);
writer.SceneObject(this);
writer.StartObject();
object->Serialize(writer, nullptr);
writer.EndObject();
File::WriteAllBytes(TEXT("Output.json"), (byte*)buffer.GetString(), (int32)buffer.GetSize());
BytesContainer data;
File::ReadAllBytes(TEXT("Output.json"), data);
ISerializable::SerializeDocument document;
document.Parse(data.Get<char>(), data.Length());
if (!document.HasParseError())
object->Deserialize(document, nullptr);
```

### Custom types
Expand Down
3 changes: 3 additions & 0 deletions manual/scripting/tutorials/custom-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace GraphicsFeaturesTour
#endif
```

> [!TIP]
> GenericEditor should be usually used for Script inherited objects, while for custom actors you should be using ActorEditor.
If your script is in editor-only module then you can skip `#if FLAX_EDITOR / #endif` pair.

### 5. See the results
Expand Down
5 changes: 5 additions & 0 deletions manual/scripting/tutorials/use-third-party-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ To add a reference to prebuild .Net DLL file in your game scripts simply modify
options.ScriptingAPI.FileReferences.Add(Path.Combine(FolderPath, "..", "..", "Content", "JetBrains.Annotations.dll"));
```

Additionally, if the DLL is going to be used by an editor module, the same dll needs to be added as an external dependency:
```cs
options.ExternalModules.Add(new BuildOptions.ExternalModule(BuildOptions.ExternalModule.Types.CSharp, path));
```

Then generate scripts projects solution to use types from imported C# module inside game code.
This will work for scripts build for the editor and cooked game as the referenced assembly will be packaged. Build system will also copy relevant `.pdb` and `.xml` files if provided.

Expand Down

0 comments on commit 390aead

Please sign in to comment.