Skip to content

Releases

v0.9.0

Choose a tag to compare

@qiangqiang101 qiangqiang101 released this 09 Nov 17:35

FH2 Mod Platform for .NET 0.9.0 (preview)

Write Forza Horizon 2 mods in C# or VB.NET. This first release brings the whole FH2 Mod Platform API to .NET. It also adds the FH2 classes, which let you work with the game itself without addresses or hooks:

ANNA.Items("Car").Add("Repair", Sub() Player.Car?.Repair())
AddHandler Game.Tick, Sub() If Player.Car?.SpeedKmh > 300 Then UI.Notify("Slow down", "")
If World.Waypoint IsNot Nothing Then Player.TeleportTo(World.Waypoint.Value)

This is a preview. The API can still change before 1.0, and some classes haven't been tested much in the game yet (see Known issues below).

Download

File For
FH2ModPlatform.NET-v0.9.0.zip Players and mod authors: the platform, Platform.NET, examples and the SDK package
FH2ModPlatform.0.9.0.nupkg Mod authors: the SDK on its own, for your projects

Installing (players)

  1. Install the .NET 10 runtime (x64). Hosted mods and scripts need it; NativeAOT mods don't.
  2. Close the game, and extract the zip into your Azimuth folder (the one with azimuth.exe).
  3. Put hosted mods in fh2-mods-dotnet\<Name>\, scripts in fh2-mods-dotnet\scripts\, and NativeAOT mods in fh2-mods\.

The zip includes the FH2 Mod Platform 2.8.0 as DWrite.dll. It needs the 24 November 2015 build of the game, the one everyone plays through Azimuth.

📖 Installing · Troubleshooting

What's new

The SDK and Platform.NET

  • The whole platform API (API 9, platform 2.8.0) in .NET: game text, title-screen entries, files, the game database, hooks and patches, settings, pages, hotkeys, commands, sessions and crash dumps.
  • Two ways to ship, from the same project:
    • Hosted: reload while the game runs, and use breakpoints.
    • NativeAOT: one DLL, loaded like any C++ mod, with no runtime needed.
  • VB.NET works in both.
  • Scripts: drop a .cs or .vb file in fh2-mods-dotnet\scripts\ and it runs. No project needed.
  • Reloading: rebuild and the mod swaps in, from a key or the console.
  • The console (~): the log as it's written, and a prompt for every mod's commands.

The FH2 classes

  • Game: the frame, the game's thread, every car's physics step, IsDriving, Language.
  • Player, Vehicle, World: your car and every other car, with repair, headlights, exhaust flames and backfires; the time of day; the map's waypoint; and Player.TeleportTo.
  • Garage, CarCatalog, Profile: cars you own, every car's names, the profile's values.
  • ANNA: entries in FH2 ANNA's menu.
  • UI, Hud, Camera, Audio: HUD notifications, the speedometer, camera shake, your own sounds.
  • Controller, GameInput, GameWindow: the controller, feeding the game's controls, playing without a controller, the mouse and keys.
  • Menus, UiElement, SettingsTile, ButtonIcons and more: everything a mouse and keyboard mod needs.
  • DebugOverlay: text over the game.

Getting started (mod authors)

  • 📖 Your first mod in C# · in VB · Scripts
  • You need the .NET 10 SDK, plus Visual Studio's C++ tools for NativeAOT builds.
  • The examples in the zip (examples\) show a hosted mod and a NativeAOT one.

Known issues

  • Not tested much in the game yet:
    • Camera.Shake, Hud.SetGaugeItem, DebugOverlay
    • Game.Rewound and CarRelocated
    • MapView, PhotoCamera, GarageCamera
    • Garage.Add, GameInput.PlayWithoutController
    • exhaust flames on Drivatars' cars
  • A replay after a race crashed the game once with several mods installed. It isn't known yet whether this SDK was to blame.
  • Hosted mods' own pages and links can't be reached from the MODS tab. Use NativeAOT or SettingsTile.
  • Crash reports don't name a hosted mod whose own code crashed.

Found a bug? Open an issue and attach fh2-mods\platform.log.

Thanks

Built on the FH2 Mod Platform (MIT), with MinHook (BSD 2-Clause), and Roslyn (MIT) for scripts.