FreePascal

Share your ZGE-development tips and techniques here!

Moderator: Moderators

User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

FreePascal

Post by Kjell »

:!:

Edit - Here's a summary of how to compile ZGE using FreePascal.

1 - Go to http://www.freepascal.org and download a Binary release for the platform of your choice.

2 - Run the installer and make sure to include the IDE and Utilities ( for fpcres.exe ).
Image

3 - Start the IDE and select Compiler from the Options menu.
Image

4 - In the Syntax tab set the Compiler Mode to "Delphi compatible" and enter "MINIMAL" in the Conditional defines field.
Image

5 - Open the Assembler tab, and set Assembler Reader to "Intel style assembler", then close the window.
Image

6 - To compile ZGE entirely, first select Open from the File menu, and add "*.dpr" to the filetypes.
Image

7 - Now open "ZzDC.dpr" from your subversion folder.
Image

8 - Finally, from the Compile menu select Compile.
Image

9 - Success!
Image

! Building a new Player.bin is most convenient using either makeFpcWin32.bat or makeFpcSDL.bat located in the Build folder of your subversion.
Image

Once build, move the newly created zzdc.exe to your ZGameEditor folder ( make sure to always use the latest Beta release! ) and rename it to Player.bin.

Good luck ~
Last edited by Kjell on Tue Oct 05, 2010 4:34 pm, edited 3 times in total.
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Assuming you only want to build the runtime (player.bin) then uSymTab unit should not be needed. Find the menu option where you define names and define "MINIMAL". The option to the command line compiler fpc.exe is "-dMINIMAL".

It's been a couple of months since I last tried fpc so let me know if you find any problems with the zge-source. I usually solve any incompatibility problems between Fpc and Delphi when it's time to rebuild the Linux and Mac binaries.
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hej Ville,

Yea, I'm aware of the MINIMAL definition, but it's good to mention that this is the first thing you need to do :) Anyway, after that I'm getting the attached fatal ( TZComponentClass = class of TZComponent; ). Which if I recall correctly is because the compiler needs to be set to Delphi compatible .. and then I get a whole bunch Unknown Identifier & Assembler syntax errors.

K
Attachments
FPC.gif
FPC.gif (4.82 KiB) Viewed 30331 times
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

I made a small change to platform_win32.inc unit so refresh to latest source.

Try the latest fpc-build: ftp://ftp.freepascal.org/pub/fpc/snapsh ... 386-win32/

Set conditional define to "MINIMAL"

Set compiler mode to "Delphi compatible"

Set assembler reader to "Intel style assembler"

That will make it compile ok although I get a couple of runtime errors. I'll see if I can find what the problem is.
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Ah,

Forgot about setting the Assembler to Intel :oops: It does get quite a bit further now, but I'm still getting a fatal error somehow ( see attached ).

K
Attachments
FPC.gif
FPC.gif (3.43 KiB) Viewed 30321 times
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

That error is because Fpc 2.4 does not have support for the Delphi static class variable syntax. I just checked in a fix for this, please try again.
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:)

Now it compiles without any errors ( apart from some pointer to signed integer warnings ). So, using your make batch a zzdc.exe is created ... what's next?

K
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Rename zzdc.exe to player.bin and put it in your ZGameEditor-folder. Then try generating exe-files from ZGameEditor. Start with something simple like a empty project and see if you at least get a opengl-window running without errors.
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Also note that the batch-file makeFpcWin32 builds the version that links to SDL.dll.

If you want to build a version that do not use SDL, build like this instead:

fpc -al -XXis -O2 -dMINIMAL -FU.\build\obj\ -B -Mdelphi -FE.\build\ zzdc.dpr
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:?

It gives me a "Assertion Failure" error when trying to build a standalone, same thing when changing the make batch to WIN32 like you described ( note that my Player.bin is 36Kb larger the the current Beta ).

K
Last edited by Kjell on Sun Oct 03, 2010 11:13 am, edited 1 time in total.
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Please post the exact error message you get.

When generating exe-files you will need the latest ZGE beta-build or it will fail.

Another thing you can try is to unzip the attached file in the same folder as zzdc.exe and then run zzdc.exe. It should give you the About-dialog graphics.
Attachments
zzdc.zip
(428 Bytes) Downloaded 1228 times
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:oops:

Apparently I wasn't running the latest Beta :P Works fine now. I'll post a walk-through of the full procedure ( with screenshots ) in the first post of this thread. Perhaps it would be good to include both makeFpcWin32.bat and makeFpcSDL.bat in the subversion?

Thanks a bunch ~

K
User avatar
Lupo
Posts: 76
Joined: Wed Sep 09, 2009 6:21 pm
Location: Montevideo, Uruguay

Post by Lupo »

thanks!

I think this is the first step in order to generate a player.bin for a new platform.

Do you have an idea, how big is the codebase to be refactored (opengles) and how easy is to detect platform specific code (input, etc) ?


Lupo.
Close, but not there yet.
User avatar
Kjell
Posts: 1910
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi Lupo,
Do you have an idea, how big is the codebase to be refactored (opengles)?
Just had a brief look at the specifications, and it makes quite a difference whether you're porting to ES 1.X or 2.X. Most of the fixed-pipeline functionality has been removed from 2.X ( stuff like glFrustum, glMatrixMode, glPush/PopMatrix etc ), so you have to do pretty much everything through Shaders ( and thus it's allot harder to port ZGE to this spec ).

K
User avatar
VilleK
Site Admin
Posts: 2316
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

There are ways to circumvent the absence of glBegin etc. Here is an interesting article that discuss those techniques:

http://www.fabiensanglard.net/wolf3d/index.php

Scroll down to "Escaping infamous Immediate mode".
Post Reply