CRYENGINE is a huge team effort, and today we’re meeting Michael Bosschert, one of our C# programmers. You might know him already as Cry-Miron from the CRYENGINE forums, or our Discord and Slack channels, where Michael regularly engages with the community. Improving C# integration with CRYENGINE is a big focus for the team, so read on to find out more about Michael, get some awesome tips about starting out in game development, and check out a sweet C# tutorial for good measure!
Hey Michael! How did you end up joining Crytek?
Michael: Before I joined Crytek I had already worked on several games made with C#. At GDC 2016 Crytek announced C# support for CRYENGINE which made me very curious, so I applied to Crytek. Initially I was hired as Application Developer for a separate R&D team that was working with C#, developing projects using the latest CRYENGINE features. A few months later I joined the CRYENGINE team to help out with the development of the C# implementation
What does a regular day at work look like for you?
Michael: We have flexible work hours at Crytek, so depending on what time it is, the first thing I do in the morning is attend our team stand-up. After that, or before if I came in early, I usually grab the latest changes from Perforce and start compiling the engine so it’s up to date again. Meanwhile, I check what’s been happening in the community on our channels and see if QA has any tasks that require my immediate attention. Usually I check which tasks I have assigned for the current sprint and work on those. This can be anything from improving an existing feature, for example adding Vector3 as a valid type for EntityProperties, or completely new features like the Visual Studio debugger extension. However, if we’re stabilizing an engine version for release, I usually spend my day going through tickets found by QA. Every now and then I’ll have to compile the engine which gives me the opportunity to check up on the CRYENGINE forum, and our Discord and Slack channels.
What are your most satisfying moments working on CRYENGINE projects at Crytek?
Michael: It’s not related to C#, but making it possible to easily package your project in a build. It actually happened a bit by accident. I noticed Cry-Patsy had already set up a big part of it, so I started tinkering. Next thing I knew, I was implementing the RC into the process and it was properly packing everything in PAK files and using the right binaries!
Related to C#, it would have to be when I got the debugger for C# in Visual Studio to work. It was something we all wanted really badly, so I was really looking forward to being able to share the extension with everyone.
C# functionality in CRYENGINE is improving each release. What advantages does C# give users?
Michael: C# is a great tool for quickly prototyping a game or new idea. You don’t have to worry about long compile times, and with hot-reloading in the Sandbox you can even test new functionality while you’re developing it. Even on C++ projects it can be used to quickly create isolated pieces of functionality. Of course, C# can only be as good as the features that are exposed to it, so that’s why we want to expand C# as much as possible, so you can almost do everything in C# that you can do in C++. On top of that C# tends to be easier to get into than C++, so it’s also a great starting point for new programmers that want to start developing with CRYENGINE.
Can you tell us about the new C# debug extension?
Michael: CRYENGINE uses Mono to run the C# code, instead of .NET, which is the default in Visual Studio. By default, Visual Studio is not able to debug C# code running on Mono. The extension adds a debugger to Visual Studio which makes it possible to debug Mono with Visual Studio. To detect if the new debugger is required, we give C# projects a specific project type which the extension can recognize, so it can activate the right debugger. Once we got that working we also saw the chance to make it easier to switch between debugging targets, so you can now easily switch between the GameLauncher, Sandbox, and a dedicated server.
CRYENGINE 5.5 will let users create and edit C# scripts which dynamically update within the editor itself. How will this help users?
Michael: It will make it possible to rapidly add new features and changes to your project, without having to interrupt your workflow by closing the Sandbox or compiling code. So, if you want to test if one method of movement works better than another, you can quickly adjust the code, jump back into the Sandbox, and it will automatically swap out the old code for your new updated code. You can immediately start testing your changes and adjust the values. The best part is that this will work in both C# and C++ projects. So in a C++ project you can quickly test if a feature would work in C#, and convert it to C++ once you’ve got the details worked out later.
What are you most looking forward to coming to the engine on the roadmap?
Michael: I’m actually really looking forward to more of the Technical Documentation we have in the works coming out. That work has begun already and there’s more good stuff planned. Right now, it already includes some really nice examples for C++, and we want to bring this to the C# documentation as well. That way if you ever look up the details of a C# function you can instantly see an example of how this function can be used.
Do you have any tips for people starting out with CRYENGINE?
Michael: I absolutely recommend everyone join us on our community channels such as Slack and Discord. It means you can learn from and interact directly with a wide range of CRYENGINE developers. In there, we have other people that are just getting started, engine veterans who have been there since the Crysis 1 modding days, and Crytek people from various specialized fields that work with the engine every day. It’s a brilliant way to pick up and share information.
On a more practical level, if you’re starting out with game development, begin with simple, achievable goals. The Rolling Ball templates are often a good entry-point because you don’t have to worry about more difficult areas such as Networking, AI and Animation. From there, set up a small goal, such as adding jumping or double jumping, and build more achievable features from there. This way you’ll have a better sense of making progress. Game development is awesome, but it can be daunting. Go step-by-step and you’ll find it more rewarding and get better, quicker.
Have you got any tips or tricks that you think might be useful for members of the community working with C# and CRYENGINE?
Michael: One really useful tip I have is to show how you can easily get the Sandbox C# code, the managed plugin code, and the C# source code of the engine in one solution.
First, create a new C# project if you haven’t done so yet. Open the project in the Sandbox. This will make the Sandbox generate a solution for the C# assets. If your project doesn’t have any C# assets, you’ll have to create one to make it generate the solution.
Next, generate the solution for the managed plugin by right-clicking on the cryproject file of your project and selecting Generate Solution. This will generate a solution file in the code folder. Right now you would have the normal setup of one solution for the C# assets, and another one for the code in the code folder.
Go into the code folder and copy the Game.sln file. This is done so our changes aren’t immediately overwritten if you generate the solution again. Give the solution a nice name, for example Game-DEV.sln, and open it in Visual Studio 2017. In Visual Studio rename the Game project to GamePlugin. This is required to prevent a name conflict in the next step, because we’re going to import the Sandbox C# project. Right click on the solution in the Solution Explorer and select Add→Existing Project. Browse to the root folder of your CRYENGINE project and select the Game.csproj file. You now have one solution with both the plugins code and the C# assets code.
We can make it even better though. The engine ships with the source code of C# Core and Core.UI library, so we can also include this in the solution. Right click the solution in Visual Studio again, and select Add→New Solution Folder. Give this folder the name Engine. Right click the engine folder and select Add→Existing Project.
This time browse to the root folder of the engine, which is located by default in C:\Program Files (x86)\Crytek\CRYENGINE Launcher\Crytek\CRYENGINE_5.5\. From there go to Code\CryManaged\CESharp\Core and select the Core.csproj file. Now do the same thing again, but instead select the Core.UI.csproj file from Code\CryManaged\CESharp\Core.UI. Now your solution includes both the source code for your project and the C# source code of the CRYENGINE.
We’re not done yet though! The Sandbox and plugin project still refers to the binaries of the engine instead of the projects we just included in the solution. So open up the References of both projects in the Solution Explorer and remove the CryEngine.Core and CryEngine.Core.UI references from both projects.
Now right click on References and select Add Reference… which will open a new window. In the Projects category enable the Core and Core.UI projects and press OK. Do the same for the other project as well, and your project will correctly reference projects in the solution instead of the dll files they create. The Sandbox project also has a reference to the plugin project, which can be changed in the same way to have it properly reference the project.
Now just make sure the configuration of your solution is set to Debug and x64, and you’re ready to start developing with access to all the C# source code.
Solution before editing the references
Adding the Core and Core.UI projects as references.
Solution after editing the references.
Awesome. Thanks Michael!
We hope you enjoyed this latest feature. As Michael says, hanging out on our Slack and Discord channels, as well as our forums, is a great way to learn from fellow CryEngineers, including the team who are working on the engine every day. As ever, we welcome your feedback, so we look forward to your comments, insights, and ideas on the forums, Facebook, and Twitter
- Your CRYENGINE Team