Frame rate independent game loop

Game development specific discussions.
fxm
Posts: 8016
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Frame rate independent game loop

Postby fxm » Nov 02, 2017 6:33

We had also discussed the possibility of using the "CLASS" keyword to declare a specific "TYPE" that would implicitly extend "OBJECT", all of whose member procedures would be virtual per default, .....
(see at viewtopic.php?p=183402#p183402)
Last edited by fxm on Nov 02, 2017 9:44, edited 1 time in total.
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 02, 2017 9:39

fxm wrote:We had also discussed the possibility of using the "CLASS" keyword to declare a specific "TYPE" that would implicitly extend "OBJECT", all of whose member procedures would be virtual per default, .....

If you look at my code, I tend to favor interface inheritance, to keep code coupling low. Laying out class like that would also allow to implement fully abstract classes. Is there a plan to add this to FB soon?
fxm
Posts: 8016
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Frame rate independent game loop

Postby fxm » Nov 02, 2017 9:51

paul doe wrote:If you look at my code, I tend to favor interface inheritance, to keep code coupling low. Laying out class like that would also allow to implement fully abstract classes. Is there a plan to add this to FB soon?

Always and only in the "todo" list.
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 02, 2017 9:57

fxm wrote:
paul doe wrote:If you look at my code, I tend to favor interface inheritance, to keep code coupling low. Laying out class like that would also allow to implement fully abstract classes. Is there a plan to add this to FB soon?

Always and only in the "todo" list.

That's what I suspected =D However, in the current state, most of the actually useful things that can be done in other class-based languages can be implemented without too much fuss...

Missed that one, thanks. Will look at it.
BasicCoder2
Posts: 3127
Joined: Jan 01, 2009 7:03

Re: Frame rate independent game loop

Postby BasicCoder2 » Nov 02, 2017 11:59

paul doe wrote:If you look at my code, you'll see that it is written to be easy to read and understand what I'm doing. Of course, if you're not familiar or know little about OOP it will tell you nothing, but for another person who does, it's really easy to read and figure out what is happening.


I will have to take your word for that. Your code example is a case of jumping in the deep end for an oop beginner. I just got lost in the many files (which takes ages to load into FBIDE) and figuring out the order to read them. Not that I could read them as the nomenclature is lost on me along with the concepts involved. FreeBASIC OOP was evolved for and by those that used OOP it wasn't why I use FreeBasic.

You example is also a fait accompli even if you have commented the code.
When explaining something it needs to be in incremental steps as I suspect you originally learnt it yourself.
I will give an example of what I mean by that in another thread.

[/quote]OOP isn't particularly hard to learn.[/quote]

Has been for me and I fail to see how any of it would add anything to the simple programs I write. The only plus might be to find it easier to translate a program written in OOP.
BasicCoder2
Posts: 3127
Joined: Jan 01, 2009 7:03

Re: Frame rate independent game loop

Postby BasicCoder2 » Nov 02, 2017 12:26

paul doe wrote:If you look at my code, you'll see that it is written to be easy to read and understand what I'm doing. Of course, if you're not familiar or know little about OOP it will tell you nothing, but for another person who does, it's really easy to read and figure out what is happening.


I will have to take your word for that. Your code example is a case of jumping in the deep end for an oop beginner. I just got lost in the many files (which takes ages to load into FBIDE) and figuring out the order to read them. Not that I could read them as the nomenclature is lost on me along with the concepts involved. FreeBASIC OOP was evolved for and by those that used OOP it wasn't why I use FreeBasic.

Your example is also a fait accompli even if you have commented the code.
When explaining something it needs to be in incremental steps as I suspect you originally learnt it yourself.
I will give an example of what I mean by that in another thread.

OOP isn't particularly hard to learn.


Has been for me and I fail to see how any of it would add anything to the simple programs I write. The only plus might be to find it easier to translate a program written in OOP.
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 02, 2017 14:17

Hi, BasicCoder2

You seem to miss the point by miles. First: this isn't a tutorial, but a possible implementation of a game loop (one of the most critically important parts of a game engine). Second: it isn't about metaball rendering (I only used ye olde metaball demo to actually have something to render), but implementing a Frame rate independent game loop (which I stated in the very second line of the first post, and on the thread title. What a marvelous coincidence). Third: I did state that it wasn't exactly for 'beginners' (although it can be argued that the statement is a bit vague, indeed):
yours truly wrote:The code is copiously commented, and shows a few interesting licks. Be warned, however, that the code is fully OO

Fourth: in the comments on 'gameLoop.bi', the very first one, there are two links to the original implementations, along with the author's explanations, which don't use OOP at all. They're also provided in the 'readme.md' file that's in the repo (which is the first thing you see when clicking on the link).

BasicCoder2 wrote:
paul doe wrote:If you look at my code, you'll see that it is written to be easy to read and understand what I'm doing. Of course, if you're not familiar or know little about OOP it will tell you nothing, but for another person who does, it's really easy to read and figure out what is happening.


I will have to take your word for that. Your code example is a case of jumping in the deep end for an oop beginner. I just got lost in the many files (which takes ages to load into FBIDE) and figuring out the order to read them. Not that I could read them as the nomenclature is lost on me along with the concepts involved. FreeBASIC OOP was evolved for and by those that used OOP it wasn't why I use FreeBasic.

Instead of whining, why don't you simply ask politely? I will be more than happy to explain whatever you don't understand from my code. If the nomenclature and conventions I use (which are very basic and pretty commonly used; perhaps not here, but still) aren't familiar to you, they should prompt you to actually search for them (that's the very reason for the comments, you know) and, should you don't understand them, simply ask.
About the order in which to read them: you could begin by, oh I don't know, look at the files in the order that I included them?

Code: Select all

#include once "inc/platform.bi"
#include once "inc/core.bi"
#include once "inc/math.bi"
#include once "inc/vec2h.bi"
#include once "inc/arrayList.bi"
#include once "inc/interfaces.bi"
#include once "inc/renderContext.bi"
#include once "inc/renderer.bi"
#include once "inc/renderDevice.bi"
#include once "inc/state.bi"
#include once "inc/metaball.bi"
#include once "inc/player.bi"
#include once "inc/gameLoop.bi"

Some of them may be familiar to you (the paperplane 3D demo used, for example, 'platform.bi', 'core.bi', 'math.bi', and 'arrayList.bi') while others (beginning with 'interfaces.bi') are specific to this implementation. Again, no question was ever asked of me about what these files are, why I include them in everything I post, and how they are supposed to work.
BasicCoder2 wrote:Your example is also a fait accompli even if you have commented the code.
When explaining something it needs to be in incremental steps as I suspect you originally learnt it yourself.
I will give an example of what I mean by that in another thread.

I hadn't explained nothing, because nothing was asked. The comments are there, precisely, to prompt questions (should somebody doesn't understand what I'm referring to) and to help you figure out the code. Look at Imortis post, a little earlier in this very thread. He does understand OOP, and the code made perfect sense to him. If it doesn't for you, did you ever asked? Besides, I don't even know what the hell a 'fait accompli' is XD

BasicCoder2 wrote:Has been for me and I fail to see how any of it would add anything to the simple programs I write. The only plus might be to find it easier to translate a program written in OOP.

If it's hard for you and you can't see the value of it, how about asking? Nonetheless, Imortis already told you about some of the benefits and drawbacks of OOP, also in this very thread. On a side note, this code wasn't posted specifically for you (as was the case with the paperplane thingy), although I'd have to admit that I was in fact thinking of you when I wrote the OOP warning of the first post ;)

All in all, I may be mistaken, but I didn't see the post in which you asked me concrete questions about the code, only whining that my code is hard to understand for 'beginners' (which in fact you aren't). If you want the code dissected here, piece by piece, simply ask for it, ok?

PS: I'm now going to your other thread, guns blazing, to reclaim your head!
PPS: Not really =D
PPPS: I can't understand the reluctance to ask a simple question. If I can't understand somebody's code, the very fastest route for me is: 'Yo, what the hell does this piece of code do!?'
Last edited by paul doe on Nov 02, 2017 15:47, edited 2 times in total.
Kuron
Posts: 30
Joined: Jul 26, 2005 3:22
Location: Nashville

Re: Frame rate independent game loop

Postby Kuron » Nov 02, 2017 15:37

Image
BasicCoder2
Posts: 3127
Joined: Jan 01, 2009 7:03

Re: Frame rate independent game loop

Postby BasicCoder2 » Nov 02, 2017 20:38

paul doe wrote:I coded a very simple demo to show how you can implement a frame rate independent game loop.

And I was just pointing out for me it wasn't simple. No criticism intended. My problem not yours.

Yes I understand it was about implementing a Frame rate independent game loop and you did indicate OOP knowledge was required. However how "simple" something is depends on the reader's knowledge base agreed? Of course an object can be used without understanding how it works only requiring knowing how to use it and your frame rate thingy may fit that requirement?

Instead of whining, why don't you simply ask politely?

Sorry if it sounded like whining. I never meant to be impolite. I just responded with where I was at. There is too much there for me to ask questions it would take forever although I understand you would see it as a whole. Maybe I am just a bit out of my depth at times.
Although not a beginner I do have limited knowledge and no formal qualifications. When young I was just fascinated by "thinking machines" and in particular interfacing to hardware to automate things. Code for this can be very simple. I earned my living with physical not mental work.

Look at Imortis post, a little earlier in this very thread. He does understand OOP, and the code made perfect sense to him. If it doesn't for you, did you ever asked? Besides, I don't even know what the hell a 'fait accompli' is XD

Yes you needed to have a firm grasp of OOP and most of those active in the forum seem to have such a grasp. I would have to start with that before trying to follow the code.

I think you are a great asset to the forum and FreeBASIC so please don't take offence at what I write. I will try and be more gaurded in what I write.
.
Last edited by BasicCoder2 on Nov 02, 2017 22:16, edited 4 times in total.
BasicCoder2
Posts: 3127
Joined: Jan 01, 2009 7:03

Re: Frame rate independent game loop

Postby BasicCoder2 » Nov 02, 2017 20:42

@Kuron,

Thanks for that one it made me smile.

.
Kuron
Posts: 30
Joined: Jul 26, 2005 3:22
Location: Nashville

Re: Frame rate independent game loop

Postby Kuron » Nov 03, 2017 0:02

BasicCoder2 wrote:@Kuron,

Thanks for that one it made me smile.

.


I thought the thread could use a little levity. ;C)
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 03, 2017 3:53

Kuron wrote:I thought the thread could use a little levity. ;C)

Me too =D
Don't worry, Kuron. There isn't any bad blood between me and BasicCoder2. He just happens to have this 'you-are-too-advanced-and-I-will-never-understand-it' attitude, which of course isn't really true, only he didn't realized it yet =D
Last edited by paul doe on Nov 05, 2017 6:41, edited 1 time in total.
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 03, 2017 4:44

BasicCoder2 wrote:
paul doe wrote:I coded a very simple demo to show how you can implement a frame rate independent game loop.

And I was just pointing out for me it wasn't simple. No criticism intended. My problem not yours.

No problem with criticism, really. Don't worry about it.
BasicCoder2 wrote:Yes I understand it was about implementing a Frame rate independent game loop and you did indicate OOP knowledge was required. However how "simple" something is depends on the reader's knowledge base agreed? Of course an object can be used without understanding how it works only requiring knowing how to use it and your frame rate thingy may fit that requirement?

Agreed, of course. And yes, 'my' frame rate thingy can be used without knowledge of how it works internally. However, it isn't designed to work alone. Sorry =D
BasicCoder2 wrote:Sorry if it sounded like whining. I never meant to be impolite. I just responded with where I was at. There is too much there for me to ask questions it would take forever although I understand you would see it as a whole. Maybe I am just a bit out of my depth at times.

Don't worry, I didn't say you were, I was just saying. However, it did looked a bit strange to me that you took it so personally, if you get my drift. Also, bear in mind that I'm from Argentina, and we do tend to be way too sarcastic sometimes. Then we go wondering why people from other countries treat us like dipsh*ts. I just realized that we probably are XD
BasicCoder2 wrote:Although not a beginner I do have limited knowledge and no formal qualifications. When young I was just fascinated by "thinking machines" and in particular interfacing to hardware to automate things. Code for this can be very simple. I earned my living with physical not mental work.

Yes, it can. I distinctly remember controlling mechanical 'turtles' with the joystick of a MSX (which were wildly popular here in South America) when I was a toddler. I absolutely loved it =D
BasicCoder2 wrote:Yes you needed to have a firm grasp of OOP and most of those active in the forum seem to have such a grasp. I would have to start with that before trying to follow the code.

I think you are a great asset to the forum and FreeBASIC so please don't take offence at what I write. I will try and be more gaurded in what I write.

I can help you (and others interested, of course) get started with OOP with a tutorial. Imortis also generously commited himself to the task, if you wish a comprehensive tutorial on the subject, aimed at beginners, of course =D
I didn't take any offense, don't worry. My offer still stands, of course: we can dissect the code to little, easily digestible pieces, right here. Think of it as a sort of 'code review'. It can provide very insightful feedback, both for you and me. What do you say? =D

PS: while I'm grateful that you see me as a 'great asset', do be aware that statements like that painfully step on the toes of a lot of people here, that really are Great Assets. I'm just 'learning the ropes' in the forum, if you know what I mean.
BasicCoder2
Posts: 3127
Joined: Jan 01, 2009 7:03

Re: Frame rate independent game loop

Postby BasicCoder2 » Nov 03, 2017 9:10

@paul doe,
Emotional intonations are not really communicated in text. I don't take things personally even when they are meant to be personal. I don't have a problem with sarcasm. There is nothing more painful than having to tip toe verbally around some people who are super sensitive to what you say and quick to infer negative intentions in your statements. Usually you just stop talking to them unless they are relatives in which case you just have to be continually aware of their delicate feelings.

I will keep your offer in mind about OOP but just up front I have to set my own pace.

I doubt any toes were stepped on in my saying you were an asset to FreeBASIC (because of your knowledge). The big movers and shakers were those who developed the language, those that provided the documentation, those that added extensions to it and those who provided the means to use it with other libraries. One of the main ones, D.J.Peters, is the reason I decided to use FreeBASIC when he provided the means to use a .dll to access webcams.

.
paul doe
Posts: 535
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Frame rate independent game loop

Postby paul doe » Nov 03, 2017 10:05

BasicCoder2 wrote:I will keep your offer in mind about OOP but just up front I have to set my own pace.

No problem. Whenever you like.
BasicCoder2 wrote:I doubt any toes were stepped on in my saying you were an asset to FreeBASIC (because of your knowledge). The big movers and shakers were those who developed the language, those that provided the documentation, those that added extensions to it and those who provided the means to use it with other libraries. One of the main ones, D.J.Peters, is the reason I decided to use FreeBASIC when he provided the means to use a .dll to access webcams.

That's perfect. I was making sure that this is correctly understood. I had a very unpleasant experience in another forum (not about programming, mind you), and would hate that the same thing happened again.

Return to “Game Dev”

Who is online

Users browsing this forum: No registered users and 1 guest