Search found 1043 matches

by badidea
Dec 10, 2018 23:44
Forum: Documentation
Topic: Union
Replies: 36
Views: 918

Re: Union

Maybe this wikipedia article helps to explain it: https://en.wikipedia.org/wiki/Union_typ ... _Structure
A simple drawing there of a 32-bit integer and a 32-bit float at the same memory location
I don't use union often, but for some uses they are awesome.
by badidea
Dec 10, 2018 22:41
Forum: Beginners
Topic: UDT Question (solved)
Replies: 8
Views: 107

Re: UDT Question (solved)

I got the same error, this at line 14 seems to solve it:

Code: Select all

for n as long = 1 to lim-1

Edit: too late
by badidea
Dec 10, 2018 22:26
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback) (solved)

I was reading 'Bushfire Algorithm' instead of 'Brushfire Algorithm' initially. I guess the first one is the more violent version :-)
by badidea
Dec 10, 2018 20:01
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback) (solved)

Sounds like a an idea for a specific task that can take a lot of CPU-time. E.g. 100 AI-enemies trying to find a way to you in a big complex map. Disadvantage is maybe a different game experience on a faster/slower PC. A path finding algorithm that does only path-finding for a part of the path each l...
by badidea
Dec 09, 2018 23:52
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback) (solved)

Meanwhile, my game is not progressing at all. Only helping the competition :-) Need to cut some features, making it too complicated.
by badidea
Dec 09, 2018 23:31
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

leopardpm wrote:cool! will implement - how does it work on yours with this code?

Looks good (32-bit & 64-bit), a steady 60 Hz. 78% of time sleeping.
Also here at 500 Hz the last digit sometimes different, still pretty stable, no sleeping any more.
by badidea
Dec 09, 2018 23:06
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

Is there a compiler check to determine the OS type so I can turn on/off these calls depending on the OS? This might do the trick (a __FB_WIN64__ does not seem exist): #ifdef __FB_WIN32__ Declare Function timeBeginPeriod Alias "timeBeginPeriod"(As Ulong=1) As Long Declare Function timeEndP...
by badidea
Dec 09, 2018 22:50
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

Info on timeBeginPeriod: https://docs.microsoft.com/en-us/window ... eginperiod
These calls won't work on linux, but I think linux uses a shorter sleep period anyway.
by badidea
Dec 09, 2018 21:24
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

Yeah, it isn't the best test code. Probably adding a sleep before the measure sleep already improves it: sleep 1 dim as double t = timer sleep 1 print (timer - t) * 1000; " ms" sleep end An average of e.g. 100 runs would be better, but I was lazy. I have good use for a horse, but I think I...
by badidea
Dec 09, 2018 21:02
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

leopardpm wrote:... it shouldn't blow up badidea's laptop anymore ...

The first prize of the competition should be enough to buy me a new laptop :-)

I am going to draw horses of 33 x 33 pixels, that should be fun!
by badidea
Dec 09, 2018 19:29
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

mine gives: 1.307731842771887 ms Then 60 FPS should not be a problem (on your system). Edit: correction, It will not be exactly 60 FPS any more. I use the loop time in the movement of things. Edit2: Dodicat's regulator: https://freebasic.net/forum/viewtopic.php?f=15&t=27052&p=252704&hil...
by badidea
Dec 09, 2018 19:20
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

I run linux here, so I can't answer the first question. 10% sound fine to me. Yes, sleep sucks. This wasn't needed in the old days with 80486 cpu's and the like. Those where always doing something or nothing full speed. What does this code give you? dim as double t = timer sleep 1 print (timer - t) ...
by badidea
Dec 09, 2018 19:10
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

But your code keeps 1 CPU-core 100% busy here, and the laptop-fan blowing out hot air. lol - sorry.... guess it does hog the cpu and will need a minimal SLEEP time... how does the core work with SLEEP 1 added? With sleep 1, the CPU will do nothing most of the time, unless there is has lot to proces...
by badidea
Dec 09, 2018 18:59
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

But your code keeps 1 CPU-core 100% busy here, and the laptop-fan blowing out hot air.

On the timing of events. It sounds like a good idea, but I did not study your code. For my game, I'll probably check a lot of timers each loop. I don't need to many (I hope).
by badidea
Dec 09, 2018 18:48
Forum: Game Dev
Topic: Game Main Loop Timing (desiring feedback) (solved)
Replies: 52
Views: 407

Re: Game Main Loop Timing (desiring feedback)

I noticed that you don't have a 'sleep' anywhere in the loop. This can give trouble. But adding a 'sleep' gives different trouble, especially on systems with a long sleep time.

Go to advanced search