Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Day Of Destruction!

  1. #1

    Day Of Destruction!

    Hi all,
    Now that the PGD Annual 2009 - Arcadia competition is over, I thought I'd start a new topic dedicated to "Day Of Destruction!"

    I have now managed to port it over to Lazarus/Freepascal (Win32 only), with minor code changes...

    It does have a graphical glitch now under freepascal with the singularity for some reason (need to find this), but it still seems to work ok regardless..yay!

    So it now compiles using Delphi AND freepascal

    I do have one question now...if I want to port it over to a Linux flavour (Ubuntu, for example), does anyone have any hints or tips on using SDL/OpenGL libraries under Linux?

    Or do I just have to find equivalent SDL, etc .so ? files to replace the Win32 dlls and it will then run?

    Perhaps PJP Dev could pipe in? LOL

    cheers,
    Paul

  2. #2
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Re: Day Of Destruction!

    Keep up the work!!
    NecroSOFT - End of line -

  3. #3

    Re: Day Of Destruction!

    Quote Originally Posted by NecroDOME
    Keep up the work!!
    Thanks

    cheers,
    Paul

  4. #4

    Re: Day Of Destruction!

    Quote Originally Posted by paul_nicholls
    I do have one question now...if I want to port it over to a Linux flavour (Ubuntu, for example), does anyone have any hints or tips on using SDL/OpenGL libraries under Linux?
    I'd be interested in information along those lines for OSX - I can probably provide partial answers for linux since I've dealt with SDL from there, I've just not done so in FPC (yet) - I too am from the Win32 world, and wonder just how much I'd have to change in my game (that I just started writing five days ago).

    For the most part so far on mine, I've avoided making any calls to Windows and have used JUST SDL and OpenGL... with one exception, the inclusion of the windows unit just so I can pull the desktop resolution as the game default the first time it runs - and I put that behind a $IFDEF Windows with a fallback to 800x600 for all others.

    Code:
    	{$ifdef Windows}
    		defaultWidth:=GetSystemMetrics(SM_CXSCREEN);
    		defaultHeight:=GetSystemMetrics(SM_CYSCREEN);
    	{$else}
    		defaultWidth:=800;
    		defaultHeight:=600;
    	{$endif}
    Thankfully under Windows that pulls the default display and not all displays - so SDL reduces the headaches of multi-display too. (though does anyone know if it can specify what display to make a fullscreen surface on?)

    I've written cross platform in other languages, and so long as you keep to the libraries that will be available across platforms (SDL, OpenGL) in terms of building the game executables there should be no problems - or in the handful of cases where you want to use some OS specific feature JUST on that one OS, well, blessed be $IFDEF

    Quote Originally Posted by paul_nicholls
    Or do I just have to find equivalent SDL, etc .so ? files to replace the Win32 dlls and it will then run?
    On Linux, all you have to be sure of is that SDL is installed, and FPC should bind to it when you compile. Thankfully it seems like most Linux distributions come with SDL already present, and if not and you are on a mainstream distro it's usually a simple matter of an apt-get or yum away.

    You might find this article of use:
    http://linux.omnipotent.net/article....ticle_id=12443

    Unlike in Windows where you end up needing SDL.DLL either in /SYSTEM or the same directory as your game, in linux so long as the dependency in the source-tree is satisfied you don't have those extra files - good since the version of SDL that works with each distro can vary wildly depending on the versions of svgalib or X11 that are installed. (though I'd not even try working with SDL atop svgalib these days)

    Distributing it, particularly if you don't want to share the source or encumber the user with installing FPC is going to be the tricky part - involving makefiles. I've not dealt with makefiles and FPC as yet, not entirely certain I'm looking forward to that since with make I'm always asking "and why the *** can't it just figure this shit out from the compiler defaults and the program source?!?"


    The accessibility of a website from time to time must be refreshed with the blood of designers and owners. It is its natural manure

  5. #5

    Re: Day Of Destruction!

    Hey Paul, great to see you're coming over the to dark side (Lazarus and Cross Compiling). Linux is EASY to get your apps running on with Lazarus. Here is how I do things (granted, its not the only way, but its the best way I've found).

    Download and install a pendrive install of linux on a windows box (makes life easier for initial testing) http://www.pendrivelinux.com/
    * Personally I have 3 installs Ubuntu, Knoppix, and Arc

    Structure your project so you have better control over platform builds (Lazarus does a POOR job of storing settings for each platform in the same lpi file)
    ProjectName\
    bin\
    forms\
    lib\
    win\
    linux\
    mac\

    DON'T COPY YOUR WIN LPI FOR ANY OTHER VERSION, MAKE NEW ONES! Seriously, I've had really bad luck trying to copy from one to the other its much easier to just create a seperate project file for each OS.

    Create your a new .pas file that contains the actual application and link it from each of your platform projects (IE: instead of placing your code in the begin..end. sections of the lpr place it in a new file and call a method in that file between begin..end.)

    Make sure ALL of your file names are lowercase (ok, this isn't necessary, but it sure as hell makes life easier)

    Build and run to your hearts content!

    As for MAC and SDL, Savage has a great writeup. Using it I've been able to get JumpStart to compile on Windows, Win64, Linux, and MAC. All except its scripting engine (Lua) support (can't get the bindings to work on MAC for some reason).

    Some place I've got a sample project that shows using SDL in all 3 platforms, I'll see if I can find it. Can't guarntee the MAC support any more as I don't have a test MAC

    - Jeremy

  6. #6

    Re: Day Of Destruction!

    @deathshadow: thanks for the tips
    As far as I know I don't use any windows platform specific stuff, so this should make it easier

    Thanks for the link


    @jdarling: Going over to the dark side, I love it! haha!
    thanks for the advice chief
    As you probably already know, I have done some win32 -> arm-linux cross-compiling before with my gp2x, but not using Lazarus at all, so this should be fun

    It will be nice to get my game running under Ubuntu, for example...

    hmm...not sure what you mean by this:

    Create your a new .pas file that contains the actual application and link it from each of your platform projects (IE: instead of placing your code in the begin..end. sections of the lpr place it in a new file and call a method in that file between begin..end.)
    If it helps, I have my original .dpr file, which I then started a new project from file in Lazarus (Win32) from this (gives me a .lpi file,etc.)

    This means I can still edit the .dpr file, .pas files, etc. and still compile it in Delphi and Lazarus.

    So I suppose I should take my .dpr file, and do new project from file in each OS's Lazarus?

    cheers,
    Paul

  7. #7

    Re: Day Of Destruction!

    Download and install a pendrive install of linux on a windows box (makes life easier for initial testing) http://www.pendrivelinux.com/
    Thanks Jeremy, I have downloaded pen-drive linux now and installed it on my new (replacement computer; old one died...) vista home laptop.

    It took me a bit of faffing around with Linux packages and dependancies, but I have finally installed freepascal, lazarus, dbg (debugging under Lazarus - wouldn't run without it), and sdl on my linux.

    It is certainly fun to be able to use Linux stuff from within windows

    I now have to try and upgrade my project so I can have different versions like you suggested, and can try a Linux version

    EDIT: Now I have moved my pen-drive linux folder to my 8GB USB Key so now it is completely portable - nothing installs on any windows machine...yay!!

    cheers,
    Paul

  8. #8

    Re: Day Of Destruction!

    Ok, this may sound like a silly question, but how do I tell lazarus (under Linux) where the SDL libs are installed?

    I am getting a linking error:

    /usr/bin/ld: cannot find -lSDL
    if it helps, in Linux, I used this (from memory) to install SDL (as root user):

    apt-get install SDL
    cheers,
    Paul

  9. #9

    Re: Day Of Destruction!

    Quote Originally Posted by paul_nicholls
    Ok, this may sound like a silly question, but how do I tell lazarus (under Linux) where the SDL libs are installed?

    I am getting a linking error:

    /usr/bin/ld: cannot find -lSDL
    if it helps, in Linux, I used this (from memory) to install SDL (as root user):

    apt-get install SDL
    cheers,
    Paul
    Not silly at all, first make sure SDL is actually installed (find something that uses it and try running it to see if it runs as if all you did was type "apt-get install sdl" it probably isn't installed). Typical APT command to install SDL:

    sudo apt-get install libsdl1.2-dev
    sudo apt-get install libsdl-image1.2-dev
    sudo apt-get install libsdl-net1.2-dev
    ...

    Do the above for each of the libraries that you want to install (image, net (shown), sound, mixer, etc). Another (cheater) way of doing this would be to install Wesnoth (a game):
    sudo apt-get install wesnoth

    Once SDL (and all the libraries you are trying to use) are installed properly you won't get that error any more.

    See if that helps a bit,
    - Jeremy

  10. #10

    Re: Day Of Destruction!

    Thanks Jeremy,
    I will let you know how I go

    Long live pen-drive Linux! haha!

    cheers,
    Paul

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •