SFML community forums

General => SFML projects => Topic started by: Jack Lam on February 26, 2022, 02:39:22 pm

Title: Creating a classic game
Post by: Jack Lam on February 26, 2022, 02:39:22 pm
        public void Run()
        {
            load();
            // game loop
            Clock clock = new Clock();

            while(window.IsOpen)
            {
                window.DispatchEvents();
                totalTimeElapsed = clock.ElapsedTime.AsSeconds();
                deltaTime = totalTimeElapsed - prevTimeElapsed;
                prevTimeElapsed = totalTimeElapsed;

                frameTimeElapsed += deltaTime;

                if (frameTimeElapsed >= UPDATE_TIME)
                {
                    update();
                    this.window.Clear(this.backgroundColor);
                    draw();
                    this.window.Display();
                }
            }
        }

Hi, there. I just started making a link-up game with SFML.Net and was surprised by how great this tiny library is. By developing the game, I am also learning the structure of a game engine. Here i am seeking advices for the development of a game engine (especially lighting system), anyone there could share his experiences?
Title: Re: Creating a classic game
Post by: eXpl0it3r on March 02, 2022, 12:41:09 am
Glad you're enjoy working with SFML.

Might want to be a bit more specific on what you need help with.
Personally, I highly recommend to build a game and not an engine on its own. It's very easy to over engineer things or build things you don't even need. By focusing on the game itself, you're solving actual problems you're running into, instead of guessing what might be useful and having those things fail when trying to use them.

For lighting there are quite a few articles and implementations out there, I suggest to search a bit.
Here's one library in C++, which you potentially could port to .NET: https://github.com/MiguelMJ/Candle
Title: Re: Creating a classic game
Post by: pizzadox9999 on June 27, 2022, 03:23:10 pm
Hey,

I was wondering if you did the .NET port? Because I would like to ask if I could use it.

Best regards pizzadox
Title: Re: Creating a classic game
Post by: Jallen on August 26, 2022, 08:58:27 pm
Hey,

I was wondering if you did the .NET port? Because I would like to ask if I could use it.

Best regards pizzadox

For the benefit of anyone else stumbling across this thread, the SFML .Net bindings are available on Nuget on the Zlib license (at the time of me writing this post), which is very permissive. By reading the license you can see whether you can use it without asking.
https://www.nuget.org/packages/SFML.Net/