I posted this over on gamedev.net but haven't had any hits yet, hoping some of the bright minds here can give me some guidance.
I have started working on writing a 2D Isometric style game. The idea is to have a persistant world (each tile is unique) and sent from the server where it is then generated (tile object) and then drawn when needed.
The way the game code works right now is that all objects have Draw() and Update() functions that are called every loop by it's parent "Screen" (Static objects, with their own controls/objects/references) Draw() and Update() functions, which in turn are called during the game loop. Basically:
While (!Exited)
ActiveScreen->Update(); -> In turn updating all child objects
ActiveScreen->Draw(); -> In turn drawing all the child objects
While our FPS > Max wait
Inside the Update() functions are things such as positioning, reloading certain objects I free to prevent leaks, checking sdl events (mouse movements, key presses, etc).
Then the Draw() functions determine if that object is visible on the screen, if it is marked visible, if the texture is valid, etc then it runs the SDL Functions to draw it (blit).
The screens Draw() function first clears the screen, runs all the draw functions for the objects that have been programmed then it refreshes the screen so that the changes are visible.
First question, is the above the right concept? I used things I had read/sdl tutorials/way XNA did things to put that bit together. If anyone has a better suggestion I am all ears.
Second question, even though I have the checks to ensure that things show on screen I notice that with a large tile array it slows right down even though it is only displaying a small portion, should I have an array that is filled on the update function that holds all the tile objects instead of looping through all of them at draw time? As each tile is it's own thing and done isometrically I need to redraw each visible tile every time so that they stack properly, so updating only 1 tile at a time isn't doable as it will end up overlapping in the wrong way.
I am sure I will have more questions as I go along. I am pretty experienced with C# and I understand C++ enough to make it work/work right however I am not that well versed in game logic as I do application programming for a living. I want to do this in C++ with SDL instead of using a pre-built solution (XNA,MonoGame,etc) as this will teach me a lot more than using things I am already comfortable with, and a lot of the logic is already handled in.
It’s amusing how Microsoft is pushing IT admins as if this was a major, game-changing update. In reality, it’s just an enablement package that bumps the build number, which is disappointing compared to the more substantial 22H2 and 24H2 releases. Technically, 25H2, 26H1, and the upcoming 26H2 are essentially the same, differing only in support schedules. They could have included the Windows K2 improvements here, but chose not to.
The era of Windows being in the backburner continues, and this 26H2 release feels like an afterthought. Shame, Nadella, shame.
After I installed those, my older but capable Win 11 laptop (16GB RAM) reported it as 26H2 26300.8697.
Then I installed it on my big laptop (128GB RAM! Hehe sorry), it reported it as 25H2 26220.8690. Ugh. Do I have to switch Insiders channels from Release to Beta?
Question
firey
I posted this over on gamedev.net but haven't had any hits yet, hoping some of the bright minds here can give me some guidance.
I have started working on writing a 2D Isometric style game. The idea is to have a persistant world (each tile is unique) and sent from the server where it is then generated (tile object) and then drawn when needed.
The way the game code works right now is that all objects have Draw() and Update() functions that are called every loop by it's parent "Screen" (Static objects, with their own controls/objects/references) Draw() and Update() functions, which in turn are called during the game loop. Basically:
While (!Exited)
ActiveScreen->Update(); -> In turn updating all child objects
ActiveScreen->Draw(); -> In turn drawing all the child objects
While our FPS > Max wait
Inside the Update() functions are things such as positioning, reloading certain objects I free to prevent leaks, checking sdl events (mouse movements, key presses, etc).
Then the Draw() functions determine if that object is visible on the screen, if it is marked visible, if the texture is valid, etc then it runs the SDL Functions to draw it (blit).
The screens Draw() function first clears the screen, runs all the draw functions for the objects that have been programmed then it refreshes the screen so that the changes are visible.
First question, is the above the right concept? I used things I had read/sdl tutorials/way XNA did things to put that bit together. If anyone has a better suggestion I am all ears.
Second question, even though I have the checks to ensure that things show on screen I notice that with a large tile array it slows right down even though it is only displaying a small portion, should I have an array that is filled on the update function that holds all the tile objects instead of looping through all of them at draw time? As each tile is it's own thing and done isometrically I need to redraw each visible tile every time so that they stack properly, so updating only 1 tile at a time isn't doable as it will end up overlapping in the wrong way.
I am sure I will have more questions as I go along. I am pretty experienced with C# and I understand C++ enough to make it work/work right however I am not that well versed in game logic as I do application programming for a living. I want to do this in C++ with SDL instead of using a pre-built solution (XNA,MonoGame,etc) as this will teach me a lot more than using things I am already comfortable with, and a lot of the logic is already handled in.
Link to comment
https://www.neowin.net/forum/topic/1156484-csdl-game-design-guidance/Share on other sites
8 answers to this question
Recommended Posts