-
Notifications
You must be signed in to change notification settings - Fork 1
Get Started
By the end of this tutorial, you'll have a base understanding of Storm and a complete project up and running!
Table of contents:
As easy as cream! To create a new Storm project, you can just clone th- WAIT! Do you have .NET Framework 6.0+ installed on your machine? This is a C# project after all! If not, install the .NET Framework 6.0 or a newer vesion. Anyways, *hum hum*, you can just clone the StormSampleProject repository, update submodules, pull the latest content on the master branch of Storm, then boom!
git clone https://github.com/Modleyyy/StormSampleProject.git
cd StormSampleProject
git submodule update --init
cd Storm
git checkout master
git pull
You can also just download or clone the repository without updating submodules and whatnot, just download the Storm repo and put it in your project folder. You'll get a simple project with all you need to start making games! You could also create a Storm project from scratch if you want to. (it's more time consuming but okay)
It's a folder containing all of Storm's source code and documentation! (yes, the one you're reading right now so you can even read it offline) You can modify it as you wish :)
A JSON file containing data about the game. (thanks Captain Obvious!) Theres:
- "Width" and "Height: Width and height of the game window (integer).
- "Title": The game window title (string).
- "FPS": Number of frames per second (integer).
- "IconPath": Do I really need to explain (string)?
Storm's main logo as an icon for the game window, replace it by any icon you'd like. If you rename or move the icon file, make sure to modify "IconPath" in "GameData.json" as well.
Last random file before we get into the spicy stuff! Here you can put some Global Usings (introduced in C# 10) instead of doing using {insert namespace};
on every file. You can delete this file if you want though, I won't judge ;)
Finally, here we are! This is the main file as it contains the most important class in all of your game: Your game class! Itw inherits from Storm.Game
and implements all 3 main methods: Storm.Game.OnLoad()
, Storm.Game.OnUpdate(System.Double)
and Storm.Game.OnDraw(System.Drawing.Graphics)
! They each have comments explaining what each one do, so I don't need to explain that.
A simple little player GameObject
with simple arrow movement and the main icon as a placeholder sprite. It's for showcasing how GameObject
s and Component
s work.
The main file of your program, like in any .NET project. It creates an instance of the MyGame
class and calls it's Run
method.
Are you sure you want to do this? Using the Sample Project is much simpler...
- Create a Windows Forms project.
- Delete the "Form1.cs" and "Form1.Designer.cs" files.
- Add a "GameData.json" file and an icon (don't forget to add it's path to the JSON file).
- Put this in the contents of your "*.csproj" file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<!-- Replace "6.0" by your current .NET version if it isn't 6.0 -->
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>CA1416</NoWarn>
</PropertyGroup>
</Project>
- Download the Storm repository from Github and place the "Storm" folder in your project folder.
- Create a game C# class inheriting from
Storm.Game
and extend all 3 main methods. It is recommended to add the line#nullable disable
at the start of the file, so you don't get any annoying warnings saying "[var name] is required to be not null at the end of the constructor" or stuff like that. - In "Program.cs", create an instance of your game class and call it's
Run()
method.
And there you go! It took some time, but you got your Storm project up and running from scratch. You can start coding some stuff now :D