Description
Hypercooled is a 3D Unity application that allows one to edit map files of
three Need for Speed games. It is still in-progress and being developed mostly in
spare time.
Features
- Made in Unity Engine.
- Allows editing, removing, adding scenery, lights, collision, etc. to existing map files.
- Allows creating entirely new map files from scratch.
- Ability to export and import existing assets (textures, geometry) in FBX format (FBX exporter/importer is written from scratch).
- Ability to move around the world, set up AI paths, occlusion zones, properties of individual objects, and more.
- High performance: low memory requirements, custom memory allocators, 0 game objects used, tons of optimizations.
Motivation
The goal of the project is to create a tool capable of acting as a 3D editing software for maps of several
Need for Speed games. While there are 3D editing softwares like Blender and 3Ds Max, they lack certain
functionality that is required for editing those maps. The project also emphasizes on low-level memory
and performance optimizations when working with Unity engine.
Problems
The main problems when making the tool were rendering highly detailed maps at a reasonable performance (minimum 60 FPS) with a regular
map load. The main optimization that was applied to battle it was not using Unity's Game Objects at all, and instead fallback to
Graphics API that the engine provides. However, that introduced another problem: no Game Objects means no colliders, which means no
raycast detection. Raycasts are important because there should be a way to determine which object user wants to edit via a click of a
mouse. For that, a custom high-performant raycaster was implemented using simple 3D math and physics.
Results
The result Unity application is shown below. For more information and visuals
on how it looks like, check out the YouTube link on top of the page.
The main map editor tab of the application. It provides functionality to select objects,
edit their individual properties, add new ones, remove existing ones. It also gives an option
to export assets in-bulk in one FBX file. User can freely selected what parts of the map they
want to load, or the application can load map the exactly same way the games do.
The individual asset editor of the application. It provides a list of all unique assets that
a map contains, giving an ability to export them and import new ones, as well as edit individual
attributes of each asset. The assets can be previewed in a sub-window, one can rotate and scale
them to see how they look from each side.
Custom rendering and raycasting eliminates game object performance overhead. User can select as
many objects as they want, move, rotate, scale and shear them in one go. Undo-Redo system is also
available, which is an integral part of any 3D editing application.
Conclusion
The project is still work-in-progress. The memory and performance still can be improved: this can be achieved by
rewriting rendering completely to use a custom scriptable render pipeline. Also, currently the UI is written
using Unity UI system, it might be way faster if utilizing UI Toolkit instead. Working on this project allowed me
understand the low level Unity API and optimizations, as well as improved my general C# and math skills.