🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

c# clearing images

Started by
53 comments, last by phil67rpg 5 years, 2 months ago

@kseh unfortunately WinForms will not help him. I say about me. I will not take WinForms for writing simple games, because OpenTK have built-in smooth game loop. I know how to make smooth game loop using WinForms and WinAPI. I read about it in this book: C# Game Programming: For Serious Game Creation Author of this book uses Tao and WinForms. Tao is analog of OpenTK but Tao is not supported now. It is very difficult for beginners to create smooth game loop in WinForms. Beginner will spend a lot of time. If I want to study low level API I will take modern OpenGL. If you want to use game engine I will take Unity. These two things (OpenGL and Unity) help me to study general programming. Some people wrote me in PM that @phil67rpg have spent more than 6 years for writing simple games. It would be better if he spent this time on modern OpenGL 3+ (or DirectX) or on Unity (or UE4 and so on).

Advertisement

yes, unless he were to excel in business applications or similar. Game coding will require leveling up for certain.

Thanks for the heads up. I was never clued in privately. All though I've been aware. That changes the landscape slightly... 
9 hours ago, 8Observer8 said:

@kseh unfortunately WinForms will not help him. I say about me. I will not take WinForms for writing simple games, because OpenTK have built-in smooth game loop. I know how to make smooth game loop using WinForms and WinAPI. I read about it in this book: C# Game Programming: For Serious Game Creation Author of this book uses Tao and WinForms. Tao is analog of OpenTK but Tao is not supported now. It is very difficult for beginners to create smooth game loop in WinForms. Beginner will spend a lot of time. If I want to study low level API I will take modern OpenGL. If you want to use game engine I will take Unity. These two things (OpenGL and Unity) help me to study general programming. Some people wrote me in PM that @phil67rpg have spent more than 6 years for writing simple games. It would be better if he spent this time on modern OpenGL 3+ (or DirectX) or on Unity (or UE4 and so on).

Yes, I seem to recall that Phil has struggled in the past trying to work with OpenGL and trying to setup a basic game loop with a high resolution timer. The majority of advice he gets seems to be directed to more advanced solutions, which may indeed be the best path to set a lot of beginners on that want to learn game programming. But it hasn't worked in his case. People give up trying to help and then later on another well meaning person figures they'll take a shot at helping and start all over again with the classic advice that has not worked in the past.

Given the difficulty Phil had understanding how to compose the logic to show a sprite for a period of time and then stop drawing it, I'm not convinced that what he needs right now is a smooth game loop or the ability to use shaders. I think, with his "Bug Invaders" project in WinForms, we can see that it is not a technology platform kind of problem but a learning to program kind of problem. One that is about making the variables, conditionals, and loops do what you want it to do.

I do wonder if switching to some kind of visual scripting technique available in advanced engines may be helpful. A graphical representation of rather than textual code may make it easier to see the flow of logic and be able to tell where updates to variables and objects are best done. Or for that matter other recommendations for different approaches to learning programming are worth considering.

I think there could be value in working with WinForms for a bit as well. Looking at the calculator project, assuming that it wasn't a blind replication of code or instructions from the book he's reading, we might actually have a bit of a baseline of his current abilities. So, what would be an appropriate next step? I will certainly admit I don't really know the answer myself.

 

@kseh respect for that one...

what I was thinking was to supply sniplets of code. very small (very small) interesting black boxes that this group could puzzle together. It might be like taking it to higher lever (constructs?) that have purpose. Understandable purpose but the inner workings are foggy to the user. Would certainly take a lot of coordination and a common ground (lang/tech) to start. Might be interesting to new comers and the rest of this group. 

The gamedev code grab bag. Get it while it's hot..... :P

Just a thought... @khawk umm...ping.

 

edit: and on the contribute side, the exercise is to write black box code that doesn't break core.

 

@phil67rpg would you like it if there was somewhere you could just grab a piece of code that did something you wanted it to do? Or is it more important to you to try to figure it out on your own?

18 minutes ago, kseh said:

I'm not convinced that what he needs right now is a smooth game loop

Yes, I am too. I am beginner and It is very difficult for me to make a game loop using WinForms and GDI. I create a window using OpenTK from the "Console Application" project. OpenTK has the built-in game loop. I do not want to spend my time on difficult things. I can just add OpenTK.dll to references to my new "Console Application" project. I can create new class, for example, with name "Window" and I can extends GameWindow class from OpenTK:

Window.cs


using System;
using OpenTK;

namespace GameLoop
{
    class Window : GameWindow
    {
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            Console.WriteLine(e.Time);
        }
    }
}

What is e.Time:

Quote

Gets a System.Double that indicates how many seconds of time elapsed since the previous event.

This is all code that I need to create the window and run game loop:

Program.cs



namespace GameLoop
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var window = new Window())
            {
                window.Run();
            }
        }
    }
}

 

GameLoopOpenTK.zip

I do not understand what means "clearing images". I think it means "clearing draw area" or "clearing canvas". I will add a few lines of code to my code above. This code just clears the draw area and fill the draw area with default black color: GameLoopOpenTK.zip

Window.cs


using OpenTK;
using OpenTK.Graphics.OpenGL;

namespace GameLoop
{
    class Window : GameWindow
    {
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            // Clear the draw area and fill the draw
            // area with default black color
            GL.Clear(ClearBufferMask.ColorBufferBit);

            // Swaps the front and back buffer, presenting
            // the rendered scene to the user.
            SwapBuffers();
        }
    }
}

 

56 minutes ago, GoliathForge said:

Just a thought... @khawk umm...ping.

I've had simliar ideas, especially for beginners. Game development is a fantastic way to learn how to code, and I want to encourage that learning process.

I don't want to derail this thread, so maybe we should discuss in CSI or DM (or group if others want to join)? If you'd like to kick off the ideating? I'd like to get a handle on how this might work if you could kick things off with more of what you're thinking from a "how would it work" view.

Now's a fantastic time to bring it up too as the new platform development is underway, so it could be introduced there. It was also fun to read this from that version of the site..... ??

Spoiler

Light theme

goliathforge-light.png

Dark theme

goliathforge-dark.png

 

Admin for GameDev.net.

23 minutes ago, khawk said:

Game development is a fantastic way to learn how to code

In addition, for me: GameDev is fantastic way to learn English, computer graphics and Linear Algebra. GameDev motivates me to learn all these stuffs. My dream to be a freelancer, but my spoken English and programming skills is not good. I think now what simple game I could write for my portfolio using modern OpenGL. Now I study a simple tutorial for beginners. I completed two lessons. This is my code on GitHub: elven-scout I read topics of @phil67rpg because his topics motivates me. I see that he loves his hobby very much.

well thanks for all the input, I have been working on my collision problem a lot but I cant seem to figure it out, I have also  googled it but  to no avail. I am working as hard as I can.

5 minutes ago, 8Observer8 said:

GameDev is fantastic way to learn English, computer graphics and Linear Algebra. GameDev motivates me to learn all these stuffs.

Yes that too! I've appreciated reading your blogs. You get into some very interesting topics, and your progression has been inspirational to watch!

7 minutes ago, 8Observer8 said:

This my code on GitHub: elven-scout 

Perhaps GameDev.net could use some Github integration.

Admin for GameDev.net.

This topic is closed to new replies.

Advertisement