Oxygen Basic

Programming => Example Code => Topic started by: Peter on April 10, 2011, 09:58:01 AM

Title: Uffo2
Post by: Peter on April 10, 2011, 09:58:01 AM
Deleted
Title: Re: Uffo2
Post by: Charles Pegge on April 10, 2011, 01:06:44 PM

Earthlings, Earthlings! We want your planet. Resistance is useless!
Title: Re: Uffo2
Post by: Aurel on April 10, 2011, 08:51:19 PM
Excellent Peter :)
Title: Re: Uffo2
Post by: JRS on April 10, 2011, 09:31:56 PM
I can't seem to get it to run under Wine.

Is this program requesting the full screen to run?

Quote
hardcore hoby programmer

hobby not hoby

Title: Re: Uffo2
Post by: Aurel on April 11, 2011, 11:34:14 AM
OK ..OK ..hobby ;D
No John ,this program don't need full screen.
Code: [Select]
OpenWindow "Uffo2",800,600,ws_popup
Title: Re: Uffo2
Post by: JRS on April 11, 2011, 08:41:31 PM
I never see a window either.  ???

Maybe Charles can try it on his version of Wine and see if it's just my PC.

Title: Re: Uffo2
Post by: Charles Pegge on April 11, 2011, 09:01:35 PM
I can't seem to get it to run under Wine.

John,
One possible problem: WS_POPUP

Ypu could try:

Code: [Select]
  OpenWindow "Uffo2",800,600,CS_HREDRAW or CS_VREDRAW 'ws_popup

Charles
Title: Re: Uffo2
Post by: JRS on April 11, 2011, 10:25:00 PM
No luck.

There is a brief frame of a window displayed  (no client content) and it immediately closes.
Title: Re: Uffo2
Post by: JRS on April 12, 2011, 03:45:02 PM
The full screen went black and when it returned, I was left in 800x600 resolution mode. I had to log out to recover.

Title: Re: Uffo2
Post by: Charles Pegge on April 12, 2011, 04:56:37 PM


I could get it to run at about 1 frame per second by bypassing the Esc Key test. I think the only way to resolve this in the long term is if Peter could test his software with Wine/Ubuntu - if he is willing.

A few months ago I made a version of "func.inc" that worked correctly in Wine though it is out of date now. The main principle is to stick rigorously to the WinMain / WndProc message processing conventions and also mask off the upper 16 bits of the virtual key state which I think was the cause of the blank window in this case.

Charles


[attachment deleted by admin]
Title: Re: Uffo2
Post by: JRS on April 12, 2011, 06:20:07 PM
I was able to get 2 or the 3 programs to run.

magic8erw.exe failed in a similar way to the Uffo program I can't run.
Title: Re: Uffo2
Post by: Charles Pegge on April 12, 2011, 06:30:17 PM
That's okay John. The exe file is now defunct but the scripts are valid.
Title: Re: Uffo2
Post by: JRS on April 12, 2011, 10:52:09 PM
The recompile solved the problem.

That still doesn't explain why Peter's Uffo example doesn't work. Are you saying that Peter is bypassing standard Windows API calls and accessing Windows services at a lower level?
Title: Re: Uffo2
Post by: Aurel on April 13, 2011, 01:04:56 AM
Its not low level then is in wine.
Wine probably dont recognize ws_popup style.
ws_popup is style without caption and without sysmenu.
You can try this example:
Code: [Select]
indexbase 0
include "wFunc.inc"
% WS_CAPTION = 0xC00000
% WS_SYSMENU = 0x80000
INT wstyle
INT w1
wstyle = ws_popup or WS_CAPTION or WS_SYSMENU
w1=OpenWindow "Uffo2",300,300,wstyle
 
'
do while bRet := GetMessage (&wm, 0, 0, 0)
    if bRet = -1 then
      'show an error message
    else
      TranslateMessage &wm
      DispatchMessage &wm
    end if
  wend

[attachment deleted by admin]
Title: Re: Uffo2
Post by: JRS on April 13, 2011, 05:29:05 AM
I was able to get your example to run but the CPU was at 100% and I couldn't get any of the keyboard functions to work. When I closed the window, it left a mess in my upper left corner of my screen. (like previous examples you wrote)

[attachment deleted by admin]
Title: Re: Uffo2
Post by: Aurel on April 20, 2011, 11:10:23 AM
I just looking into source code and i was wondering from where you generate
all this graphics.
So ,Peter do you use BitBlt api for sprite blittering?
Title: Re: Uffo2
Post by: Aurel on April 20, 2011, 01:39:49 PM
Quote
What are you planning?  Do you intend to write Uffo3?
Yes,  the Api is very stable and you can do plenty of fine things with it.
I do not know why the other members want not write a super game with the wFunc library ?  Is so simple like the first school day.

Yes i have in plan write game like this but i currently dont have time for this.
I still study some things.And yes wFunc lib look fine ;)
I do not know why the other members want not write a super game with the wFunc library ?
Yeah,that's good question...i really dont know why?
Title: Re: Uffo2
Post by: Aurel on October 23, 2011, 01:49:36 PM
I was wondering where you find all this sprite bitmaps?
I made some search and simply cannot find nothing similiar or some good free sprite creator...
Title: Re: Uffo2
Post by: Aurel on October 24, 2011, 11:38:40 AM
Hi Peter

My computer don't have alien but sometimes i think that have gremlins. ;D

Hmm about Charles comp i'm not sure :-\
something is strange...out there ;D

By the way thanks for links...
Allegro is a junk but Reiner tilemaker i will try... ;)
Title: Re: Uffo2
Post by: Charles Pegge on October 25, 2011, 04:48:44 AM

The Sirians have shackled me to the motherboard until I make more progress with 64 bit compiling. I hope to be released soon.  ;D
Title: Re: Uffo2
Post by: efgee on October 25, 2011, 06:55:55 AM
I do not know why the other members want not write a super game with the wFunc library ?  Is so simple like the first school day.
Yeah,that's good question...i really dont know why?

Not really into games myself...

Besides: the only game I would make would be a "Perestroika" clone. But I think the hardest part would be to write the AI for the "Buerokrats"  ;D

A driving simulator would be OK as well  8)

bye
Title: Re: Uffo2
Post by: JRS on October 25, 2011, 07:38:29 AM
Quote
until I make more progress with 64 bit compiling. I hope to be released soon.

That should turn PowerBasic and FreeBasic programmers heads in your direction.  :o

When do you see a Linux port in your crystal ball?

Title: Re: Uffo2
Post by: Charles Pegge on October 27, 2011, 02:16:14 AM

I dare not predict, John. The test and debugging phase is hard to quantify. Wherever possible I code and test in small increments to avoid embedding bugs, which have to be traced down later. Once buried in the code, they can be very time-consuming to flush out.

Do you have 64 bit Wine?

Charles
Title: Re: Uffo2
Post by: JRS on October 27, 2011, 05:40:24 AM
Quote
Do you have 64 bit Wine?

I'm running on Ubuntu 11.10 64 bit with Wine installed from the Synaptics software installer. Since all the applications I run under Wine are 32 bit, I think not. I didn't know there was a 64 bit version of Wine. I have no interest in 64 bit Windows. I'm waiting for a 64 bit Linux OxygenBasic.

Title: Re: Uffo2
Post by: Charles Pegge on October 27, 2011, 11:05:50 AM

It is available but perhaps not perfected yet.

http://wiki.winehq.org/Wine64
Title: Re: Uffo2
Post by: Aurel on June 04, 2012, 05:00:55 AM
Hio Peter...
As i say already...i want do some things with this small & simple and great game.
In first place because i don't touch long time ago any game programming.
Ok after few try-s with your new include i decide to download and use old release 036 because
work with game fine( UNFORTUNATELLY -last not work at all)
Title: Re: Uffo2
Post by: kryton9 on June 04, 2012, 06:58:19 AM
I downloaded the zip file from the first post and I get an error. Unknown type. overlapped line 303 wfunc.h

Peter why do you name the folder temp and the game Ufo2. The folder should be Ufo2 so when we extract it matches what is in it. As with other members here, I make a folder with their name in my oxygen/projects folder. So for you I have oxygen/projects/peter/  now when I extract your zip it should put in your folder oxygen/projects/peter/Ufo2. Instead you name a lot of things temp and it name conflicts. I hate to complain, but you put a lot effort into making nice things for us to try, but you don't put effort into packaging it in a nice manner.

At least this time you had the source, inc and bmps all together in the zip, so thanks for that.
Title: Re: Uffo2
Post by: Aurel on June 04, 2012, 08:46:29 AM
Peter...
As i  say it compile fine but is execution is to to slow, on my XP computer.
I try change setFPs but nothing heapend.... ???
What might be a problem, i really don't understand.

When i try old example i recive same error like kent with overlapped ::)
It is something very strange, i also discover problem with coulor depth..
I don't know what to say more ... :-\
Title: Re: Uffo2
Post by: kryton9 on June 04, 2012, 11:37:05 AM
I got a score of 1025. The speed is right for me. It gives me time to react :)

This zip has all the files needed to make it run with a exe file with the runtime built in, so no need for the oxygen.dll.

Just unzip into OxygenBasic\projects\Peter
Title: Re: Uffo2
Post by: Aurel on June 04, 2012, 12:38:39 PM
Kent...
Is this some kind of joke or something goes very wrong.
Not work at all,just back image with white rectangles...
what a heck is that ???

Peter...
As i say and i repeat again.
You say that GDI is slow...maybe you right.
BUT how you can explain to me that your original program with version 036 work
incredible fast on my computer and
latest not ?

So mine conclusion is that problem is not in GDI,right?
If you don't believe , download old 036 and try ...
what to say else...
Im very angry about all that problem.... >:(
Title: Re: Uffo2
Post by: kryton9 on June 04, 2012, 04:08:27 PM
It runs slow on my computer, but I like it slow as it helps me score better :)

It must be the graphic mode as Peter mentioned Aurel. Check what the older version was setting the screen to, I think you said version 036.
Title: Re: Uffo2
Post by: Aurel on June 04, 2012, 09:59:14 PM
Im not sure what is wrong here but for example all GDI examples in folder...GDIWindow
like fern,fade...etc work with excellent speed on my both computers with XP
and all this examples use window.inc  version 039(Inprogress)
window.inc there is written in old way without call.
Why Peter change way of his header is a mistery to me... ::)
And i was wondering why change something if work fine with good speed?

About using other graphics engines i can say that i try HGE wrapper for EB once and work
perfect.so what about that?
Title: Re: Uffo2
Post by: kryton9 on June 04, 2012, 10:07:39 PM
It is funny Aurel that you didn't like it with calls either. I went ahead and changed mine to run without calls. attached is the win.h file.
win.7z unzipped will be win.h without calls, interesting to see if it runs better.
Title: Re: Uffo2
Post by: Aurel on June 04, 2012, 10:19:06 PM
Refuse to compile properly... ::)
Oh mine...what a mess. >:(
Title: Re: Uffo2
Post by: kryton9 on June 05, 2012, 12:00:29 AM
Did you get the latest oxygen.dll from here http://www.oxygenbasic.org/forum/index.php?action=dlattach;topic=450.0;attach=905
Title: Re: Uffo2
Post by: Aurel on June 05, 2012, 01:31:49 AM
yes Kent i have.
problem is in wFunc or other things (i mean includes)
i do it like this:
Code: [Select]
Sub WaitFrames(Frame as long)
Sleep Frame                                             
End Sub

And now i can set wait time.
Some problematic things about speed i found in this api calls:
Code: [Select]
Declare Function QueryPerformanceCounter   Lib "kernel32.dll" (ByRef lpPerformanceCount As LARGE_INTEGER) As Long
Declare Function QueryPerformanceFrequency Lib "kernel32.dll" (ByRef lpFrequency As LARGE_INTEGER) As Long

In older inc are declared as LARGE_INTEGER

Code: [Select]
Type LARGE_INTEGER
lowpart AS INT
highpart AS INT
End Type

In newer are defined as quad.
Which cause some trouble with work to.
So do you can imagine what amount of incompatibility is in game?
Peter work on headers are fine and i respect
but i repeat again why work something if work ok,right?
This only increase confusion...
Title: Re: Uffo2
Post by: Aurel on June 05, 2012, 02:29:25 AM
Peter i try this of course...

Quote
A full declaration with parameters works anytime sure.
Bingo...!

Quote
'Call' is super and the best friend of the programmer.
I don't agree with you at all.
It looks to me that call is another word for import like some
other languages have.

But as i say i don't see any advantage to use this way because don't
work properly for me ,but old way with old wFunc work and
looks that i will use this old method.
First looks simplier to me and is quite better to understand what is what.

PS.Peter
You say that GDI is slow and i agree that GDI is slower then hardwer acelerated graphics
BUT i see many GDI examples written in C which work excellent.
I must investigate this thing much closer. ::)
Title: Re: Uffo2
Post by: Charles Pegge on June 05, 2012, 04:56:54 AM
I found that, Uffo got a lot faster when the background image was replaced by clsColor. Perhaps this large element was causing problems for Aurel.

One advantage of using bind is that the compiler knows that all the defined symbols are procedures, then call is automatically inserted. You can still use call with any procedure, if that is your preference.

I have included a compact version of uffo with the latest Oxygen, filed in projects/games, along with win.inc. But I'll continue to support projects/GDIWindow/window.inc, as we have many demos that depend on it, and I think most Basic users would prefer a prototyped API, where the compiler takes care of type conversions and referencing.

I am delighted we have a complete game, Peter, small enough to include in the OxygeBasic zip :)


Charles
Title: Re: Uffo2
Post by: Aurel on June 05, 2012, 05:35:01 AM
I agree with Charles...
And i just tested many gdi examples with win64.inc and most of them work fine ;)
Title: Re: Uffo2
Post by: kryton9 on June 05, 2012, 06:45:42 AM
Hi Kryton9,

There is no more speed  with 'Bind'. 'Bind' is not sure !
Many of the Opengl declarations and GdiPlus with 'Bind' did  not go, at least here.
A full declaration with parameters works anytime sure.

'Call' is super and the best friend of the programmer.

Try this to see how many frames has 'Kryton9 Win.inc' and 'Peter win.inc'.
 
I got  (1080-1082 frames).
I just found a wave file and bmp file, nothing to run Peter.
Title: Re: Uffo2
Post by: kryton9 on June 05, 2012, 06:53:59 AM
Don't give up Peter. You and Charles are the only ones that make headway with assembly and bringing headers to the rest of us. I am studying all the headers I can to learn, but it is all very confusing as there are so many ways people do it in so many languages.
Title: Re: Uffo2
Post by: Aurel on June 05, 2012, 07:43:15 AM
Yes i agree with Kent, don't give up man... ;)
I hope that you don't interpret in a wrong way my observation.
I like & follow your work all the time...