Cool video of the Linux version

It is probably not a secret to those who check the svn regularly, but Wagic is now available for Linux as well, thanks to the great work of J.

JGE++ is probably now the only library in the world that allows to compile a C++ game for Windows, Linux, and the PSP from the same source code !

What else, the Linux version allows to resize the screen, which is a nice bonus compared to the Windows version. This is a very short video that shows resizing, I just wanted to share it here :)

  1. J’s avatar

    For those who care :
    Yes the Linux version is quite cranky yet. I mean, sure it’s working, but you still have a number of
    things to do by hand to build it, mostly because I’ve been much to lazy to automate it yet.
    JGE now has a half-decent makefile that should allow compilation of any of the supported versions with
    minimal effort, but same cannot be said of wth?! for which building the Linux version has to be
    done half by hand. Bindings can’t be redefined without changing the code as of yet, and also, I’m
    using the Glut library for window interaction, which means easy development but for some reason
    the library does not allow detection of Ctrl or Alt or Shift as stand-alone keys, so we’ll have to redo some work and shed Glut if we want to have them – which is quite desirable, indeed.
    What else ? The game is playable but has some speed issue – it’s way, way too fast. Due to some hairy
    internals animations finishing in the blink of an eye mess with the IA, and the deck editor is barely
    usable for excessive speed – that’s the next thing I intend do fix.

    So… yeah it’s pretty nice. The presence of a bazillion development tools for Linux that do not exist
    for windows should account for easier debugging, and good development environments could save us
    some time.

    Ah, also, new artwork is being created, as you can see some of it in the video. The artwork currently
    being used borders on copyright infringement and that’s something we’re really not keen on, and
    it’s the chance to continue giving Wagic its own graphical style. I’m not much of an artist, but I’ll be
    giving it a try with Wololo :)

    Reply

  2. x-man’s avatar

    A quand une version Mac ???

    Reply

  3. wololo’s avatar

    Je pense que la version Linux doit pouvoir compiler pour mac avec des changements mineurs.

    I think you can compile the Linux version for Mac as well…but I ‘m not the one who’ll try

    Reply

  4. J’s avatar

    Logically if you got all the dependancies installed I suppose compiling on a Mac as if it was a Linux
    (as in make linux, instead of make) would work.
    I don’t really have a mac in handy to test however, if I happen to stumble upon one on which I can
    install dependencies I’ll look into it

    Reply

  5. Nanocore’s avatar

    FWIW I am going to have a go at compiling on the Mac. We’ll see how far I can get…

    Reply

  6. Incantus’s avatar

    So does JGE require the PSP SDK? I’m trying to figure out how to compile it on my mac, but as far as i can tell there is no way.

    Reply

  7. wololo’s avatar

    I think that if you are not compiling it for the PSP, you should type “make linux”… this would be a question for J, I’ll try to have him answer your question

    Reply

  8. J’s avatar

    Ah, no it doesn’t. You do not need the psp sdk to compile the game for Unix.

    Basically, you need :
    - libgif
    - zlib
    - fmod
    - glut and its dependancies
    …and I think that’s all ?
    On top of your normal build system, including gcc and its libs and make.

    Then to compile JGE you go into the JGE directory and type `make linux’. That’s supposed to compile the linux version ; if you just type `make’, it’s trying to determine whether you got the PSP SDK or not and if not it’s building for linux – and if you got it it defaults to compiling for PSP firmware 3.x.
    It’s supposed to be as simple as that to get JGE for PSP.

    Now for the game, I started writing the real Makefile yesterday and it’s not complete – I’m reluctant to do it because it’s boring :p So there is a Makefile for linux (that I think would work on Mac) but it is cranky to use.
    Basically you should start by cleaning the build tree – erasing the .o files and all. Then use `make -f Makefile.linux’ which hopefully will compile the game then put the binary into the ./bin dir under the Makefile.

    Note that you cannot run the game unless you go in its binary dir before you run it – it’s using relative paths to find files, and crashes if resource files are not present under the ./Res directory from where you are. Looks like a job for Autoconf… if I ever get the time…

    Reply

  9. Nanocore’s avatar

    I am compiling for Mac and am about 2/3 the way through the JGE library and it is stumped at compiling the source “src/linuxmain.o”. A source file by the name linuxmain.cpp does not exist, so I will look around and see what you meant to use for this file.

    As a side note, FWIW, I am using the darwin ports which are ports of unix libraries and includes. So far, I have included the following ports:
    glut @3.7_1+darwin_9 (active)
    jpeg @6b_3 (active)
    libpng @1.2.33_0 (active)
    libungif @4.1.4_2 (active)
    zlib @1.2.3_1 (active)

    Reply

  10. Nanocore’s avatar

    in addition… I added the freetype library and includes and went with the glutmain.cpp and the library was compiled. Now I am working on the game itself, and all source compiles but it doesn’t link yet. Will try again later…

    Reply

  11. wololo’s avatar

    Nanocore, thanks for your efforts so far !
    It seems glutmain.cpp is the one. I’ll ask J to give you more precise answers, maybe the Makefile isn’t up to date in the SVN ? Do you have the latest version ?

    Reply

  12. J’s avatar

    The linux version was first made with glut ; because of various limitations of glut I switched to glX and rewrote the file. The glut version should still work, though with these limitations – the glX version won’t work on a mac unless you use an X server, which you probably won’t want to do.

    I think you have an old version of the Makefile as the new one mentions Xmain.cpp and not linuxmain.cpp ; you are right however in using glutmain.cpp, this is the file that used to be linuxmain.cpp, and probably the easiest version to have it work on a mac.

    The game doesn’t have a proper Makefile yet – I compile the linux version using make -f Makefile.linux, which you probably figured out. You also need to have the hge library compiled, which I thought was generated when you call Make in the JGE dir but it apparently doesn’t – I’ll have to look into it when I got a second. Anyway, go into the JGE directory and just use “make hge”, that should work.

    Thanks for your help on this, it would be nice to have it work on mac :o

    Reply

  13. Nanocore’s avatar

    OK, a couple of things… Yes, there is an X11 server that comes with the Mac, so compiling for an X server is certainly a possibility. The X applications run right alongside regular Mac apps. Also, yes, I did use the Makefile.linux. Once I have something working then I will see if you want to incorporate my changes to the various files. Once it works, I will go through and make the changes more robust (ie, ifdef and probably a separate Makefile etc) and then submit for SVN commit. And yes, the hge source compiled without a problem (had to make a lib/linux/ directory first). So, at least all source compiles without a problem, it just doesn’t link. I just need to be able to have a block of time to get over this last hump.

    Reply

  14. Nanocore’s avatar

    After I pulled in fmod and got the framework libraries correct (its a Mac thing) I was able to produce a binary. Upon running, I get a window, some output in the terminal and then crash before anything fills the window. Close, so close!

    Reply

  15. Nanocore’s avatar

    OK, it errors out with a null font address and after some tracking back it looks like it may be a reference creating a font. In GameStateMenu.h around line 112

    mFont = GameApp::CommonRes->GetJLBFont(“graphics/f3″);

    I don’t see a file called “f3″ in graphics. And I am assuming this is in the bin/Resources directory, as that is where I found a “graphics” directory. What is “f3″?

    Reply

  16. Nanocore’s avatar

    Sorry, one more for today… there is another GetJLBFont call that is looking for “graphics/magic” that isn’t in that directory either…

    Reply

  17. wololo’s avatar

    Nanocore, I am very sorry, these files where missing from the SVN.
    I added them, but may I suggest that you also retrieve the PSP version of the game (on the download page) ? It probably contains most of the needed resource files, including card pictures.

    Reply

  18. Nanocore’s avatar

    I had thought that maybe I would find the needed files in the source tarball and downloaded it. It does have a few other files but not the ones under the “bin” directory. Hmm, maybe you are referring to another tarball.?. I will check later on today.

    Reply

  19. wololo’s avatar

    I was talking about the “main” download file : http://wololo.net/files/wagic/wth_021.zip
    Everything that is in the “Res” folder can be important. The SVN version of the files (in bin/Res), when they exist, are of course more recent and should be used.

    Reply

  20. Incantus’s avatar

    Well, I’ve gotten wagic running on my powerpc Mac, unfortunately the font system is screwy, and instead of printing text, everytime there is a font string being rendered I just see the entire font alphabet. But otherwise it looks great :)

    Reply

  21. Incantus’s avatar

    OK, I figured out what was wrong. The dat files for the 2 bitmap fonts (f3 and magic) were in little endian format, while my machine is big endian (ppc). A quick python conversion script and I’m in business :).
    Thanks J for the linux port :)

    Reply

  22. Nanocore’s avatar

    And I am up and running on my (Intel) MacBook Pro. I will add the things from the zip you mention in the link above and see how it looks then.

    Reply

  23. Incantus’s avatar

    I can run the program and enter all the menu options, but as soon as i start a game it says i lose. I wonder if there are any more binary data files that might have endian issues. Wololo, can you think of any?

    Reply

  24. wololo’s avatar

    Incantus :
    There are lots of text files in the game. The card database are simple ASCII text files in the DOS format. It might be the cause ?
    When you immediately lose the game, it generally means that your deck has no cards (and the game tried to draw a card from your library). You might want to check Res/players/deck*.txt, or maybe try to create a deck from scratch in the editor.

    Reply

  25. Nanocore’s avatar

    Is there a key mapping when not running on a PSP device? I can build a deck and select one but can’t seem to play a game. The demo mode runs very well, at least it looks like it runs pretty well. The esc and space key seem to be mapped, just need to figure out the rest.

    Reply

  26. wololo’s avatar

    hmmm, when I did it initially for windows, left, right, up and down where working, but the controls have been updated recently and I’m not sure the arrows still work.
    I’m not 100% sure but try these (sorry, french keyboard mapping…):
    A = left trigger
    E = right trigger
    Z = up
    S = down
    D = right
    Q = left

    i = triangle
    k = cross
    j = square
    l,space = circle
    ctrl = select
    esc = start

    In the near future we’ll have a configuration file for the key mapping

    Reply

  27. Nanocore’s avatar

    Thanks for the heads up, that got me looking. As it turns out those keys are defined in the “main” you use for the JGE library. I am using the glutmain and there are only 5 keys defined. So, I will go through and see what keys were used in the other “main” sources and determine the key codes from there and add them to glutmain source.

    Reply

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>