LukasPJ Posted October 9, 2019 Share Posted October 9, 2019 Hello everyone,Progress is slow, but I have made some updates to the C# stuff.Where to try T3D.netI have a spectatorGameplay implementation in C# at this repository: https://github.com/lukaspj/T3D.Net-BaseGameThe repository contains pre-compiled Torque3D as well as .sln and .csproj files which should work, but there might be some paths wrong etc.The pre-compiled version of Torque3D uses the branch from this PR:https://github.com/GarageGames/Torque3D/pull/2366Quick introThe repository has 3 folders: BaseGame GameCore T3DNetFramework The GameCore folder contains a typical Torque3D project, with scripts, assets, binaries.The T3DNetFramework folder contains a library which is used for the interop layer between T3D and C#.The BaseGame folder contains the C# game project, with a C# implementation of the SpectatorGameplay scripts.The whole thing is unpolished, but I'm happy to answer any questions here or in Discord. How can I help?If anyone wants to help me on the project, please just download the C# project and muck about in it. Find bugs, or stuff you think has a weird syntax or functionalities that are missing.What is the current feature set?The C# implementation currently has: The full ConsoleObject class-hierarchy generated as C# classes. Full, statically typed interop on all function calls from C# to T3D Full interoperability with TorqueScript Stringly typed interop on all function calls from T3D to C#, with reflection-based conversion of parameters Stringly typed property accessors API documentation exported from the EngineAPI Differences between TorqueScript and C#The primary difference is type-safety, if the underlying T3D function requires a float, you have to pass a float. Not a string or int.All Global ConsoleFunctions are prefixed with Global.You have to "register" SimObjects (similar to how it's done on the C++ side). As an example see the VolumetricFog class:https://github.com/lukaspj/T3D.Net-BaseGame/blob/master/BaseGame/Game/Spectator/Server/VolumetricFog.cs#L60As an example this TorqueScript: if (isObject(LevelFilesList)) { for ( %file = findFirstFile( "data/spectatorGameplay/levels/*.mis" ); %file !$= ""; %file = findNextFile( "data/spectatorGameplay/levels/*.mis" )) { LevelFilesList.add(%file); } } Becomes this C#: if (Global.IsObject("LevelFilesList")) { for (string file = Global.FindFirstFile("data/spectatorGameplay/levels/*.mis"); file != ""; file = Global.FindNextFile("data/spectatorGameplay/levels/*.mis")) { Core.SimObjects.Collections.LevelFilesList.Add(file); } } Global variables has to be accessed via a function instead of via the dollar-sign thingy: Global.SetConsoleString("Game::DefaultCameraClass", "Camera"); Global.GetConsoleString("Game::DefaultCameraClass"); And dynamic fields has to be accessed via a method as well: client.SetFieldValue("camera", camId.ToString()); client.GetFieldValue("camera"); Quote Link to comment Share on other sites More sharing options...
noemen Posted October 11, 2019 Share Posted October 11, 2019 Very good, I liked it. I don't know C #, but I support language diversification support. This makes the artist's life easier, continue with his wonderful work. Now I will learn C # because I have a reason. lol Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted October 15, 2019 Author Share Posted October 15, 2019 Thank you very much @noemen :)I hope that the C# project at the very least can serve as a template for how people can integrate external runtimes / languages to the engine. The principle techniques are actually very simple, so it should be a nice step forward! Quote Link to comment Share on other sites More sharing options...
LukasPJ Posted October 16, 2019 Author Share Posted October 16, 2019 More updates!The generator has been updated with a new templating engine and more edge-case handling:https://github.com/lukaspj/T3DSharpShould be much easier to get up-and-running with now for anyone who wants to look into it at some point.(Albeit still far from "pretty")Code documentation!I have extended the Generator with the capability to convert Torque3D's internal doxygen-based comments to C#'s XML comment language.https://github.com/lukaspj/T3D.Net-BaseGame/blob/master/T3DNetFramework/Generated/Classes/Sim/ActionMap.cs#L628-L647So now you can get that API documentation directly in your IDE! Quote Link to comment Share on other sites More sharing options...
noemen Posted October 17, 2019 Share Posted October 17, 2019 More updates!The generator has been updated with a new templating engine and more edge-case handling:https://github.com/lukaspj/T3DSharpShould be much easier to get up-and-running with now for anyone who wants to look into it at some point.(Albeit still far from "pretty")Code documentation!I have extended the Generator with the capability to convert Torque3D's internal doxygen-based comments to C#'s XML comment language.https://github.com/lukaspj/T3D.Net-BaseGame/blob/master/T3DNetFramework/Generated/Classes/Sim/ActionMap.cs#L628-L647So now you can get that API documentation directly in your IDE! I'm studying the c#, in the future I will support you in this wonderful project.In 2 months or more I will be ready. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.