Menu

Game port to modern OpenGL + Android

Ivan
2024-05-09
2024-08-23
  • Ivan

    Ivan - 2024-05-09

    Hi there, folks!

    I was following this game for a really long time (I think since 2008), and I dare to say this is one of the most fun and chilling driving games out there. Big kudos to you for that!

    This month I had a bit of spare time and I've decided to "have fun" in another way.

    I performed a rewrite of the rendering engine from the "legacy" fixed-pipeline OpenGL to a "modern" one with VBOs and shaders.

    Here it is: https://github.com/Barracuda72/Trigger-NG

    I've tried to make as few modifications as possible, and I deliberately limited myself to using only a common subset of OpenGL 2.x, OpenGL 3.x+ and OpenGL ES 2.0.

    The lowest-tier device I have at my disposal is an old netbook with GMA 950 and a limited OpenGL 2.1 support, and the rewritten renderer works correct on it (thou performance-wise it's really bad, but with the "old" renderer the game is equally unplayable on that machine).

    With only a few extra lines of code I was able to run the game not only on my PCs, but also on a few Android devices (featuring both Adreno and Mali). Touchscreen support is lacking (SDL emulates mouse via it), so the only way to control the car in-game is via an external joystick or gyro.

    Keep in mind that I've based my work off the official 0.6.6.1 codebase (which corresponds to r942, if I'm not mistaken) as I wasn't aware of the semi-active community here at the time I've decided to perform the port.

    Also, I haven't touched most of #if 0 or #ifdef INDEVEL code, as some of it seems rotten beyond repair.

    IDK if you'll be interested in that, but decided to share my work nonetheless.

     

    Last edit: Ivan 2024-05-09
  • Onsemeliot

    Onsemeliot - 2024-05-11

    Hi Ivan, thank you for sharing your code. It is really a shame that I wasn't capable of creating a new release a while ago since most people wanting to contribute seem to start with the last stable release and forego the advanced development version. This leads to the situation that such exciting experiments usually miss the newest features and it doesn't seem to be an easy task to merge those attempts without losing relevant capabilities. At least I don't know enough to attempt something like this.
    When I try to build your version from GitHub I get the following output/error:

    $ make
    
    current values of user-set variables:
        DESTDIR      ?= 
        prefix       ?= /usr/local
        exec_prefix  ?= /usr/local
        OPTIMS       ?= -march=native -mtune=native -Ofast
        WARNINGS     ?= -Wall -Wextra -pedantic
    
    resulting values of build variables:
        CXXFLAGS     += -std=c++11 -Wall -Wextra -pedantic -march=native -mtune=native -Ofast -g
        CPPFLAGS     += -DNDEBUG -DUNIX -DPACKAGE_VERSION="0.6.6.1" -I'./include' -I'../glm'
        LDFLAGS      += -lSDL2main -lSDL2 -lSDL2_image -lphysfs -lopenal -lalut -lpthread -ltinyxml2 -lGL -lGLEW
    
    g++ PEngine/app.cpp -> PEngine/app.o
    PEngine/app.cpp:7:10: fatal error: glm/gtc/type_ptr.hpp: No such file or directory
        7 | #include <glm/gtc/type_ptr.hpp> // For glm::value_ptr
          |          ^~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make: *** [GNUmakefile:174: PEngine/app.o] Error 1
    

    I guess I miss some vital component. But since I did only follow the old README which it seems you didn't adapt for your contribution I am not really surprised. What else do I need to add so that I can test your version?

     

    Last edit: Onsemeliot 2024-05-11
  • Ivan

    Ivan - 2024-05-11

    That depends on how you downloaded the code.

    If you did it via Git, I think it would be sufficient to run

    git submodule update --init

    in the source directory.

    If not, you can either install glm library from your distro's package manager (beware of old versions tho) or download it from Github as a zip archive and put all relevant files into glm directory of the source tree.

    Also note that the build defaults to OpenGL 3.x+, so if you want to build for OpenGL 2.1 / ES 2.0 you need to do extra steps. For OpenGL 2.1 you need to comment out #define MODERN_GL in PEngine/app.cpp, and for OpenGL ES 2.0 you need to run make as make GLES2=1.

     
  • Ivan

    Ivan - 2024-06-25

    Just wanted to note that I've updated the code to r1007, adapting and rewriting some pieces in the process.

    I've decided to take a break at r1007 because options menu (r1008..r1012) and brake lights (r1014) will most likely have to be (almost) completely rewritten due to different rendering method.

    Other revisions (r1013, r1015-r1019) should be fairly straightforward to merge.

     
    • Onsemeliot

      Onsemeliot - 2024-07-08

      Sorry for the late reply, Ivan. Does this mean we lost the features you mentioned if we want to actually include your optimisations? Would you be able and willing to incorporate the later features into your rewritten code?

       
      • Ivan

        Ivan - 2024-07-12

        Sorry for the late reply, Ivan.

        Don't worry, I already know this project is relatively slow-paced :)

        Does this mean we lost the features you mentioned if we want to actually include your optimisations?

        If you want to do it ASAP, then yes. But I don't think it's at the stage you should consider it.

        From my POV it would make more sense to do a 0.6.7 release featuring everything that is accumulated up until now. After that you can bump development branch to 0.7.0 and work on integrating new renderer into the game may begin. There're a lot of tinkering, optimizations and testing to be done before this can be made available to the general public.

        Would you be able and willing to incorporate the later features into your rewritten code?

        Yes, but as with all the hobby projects the limiting factor is the time. I've stopped at r1007 because I think it would take a couple of days to rewrite r1008..r1012 and r1014, and I don't have those few days free right now.

         
      • Ivan

        Ivan - 2024-07-12

        Also, here're two videos featuring my GLES-powered port of Trigger Rally on an Android devices:

        SD860: https://www.youtube.com/watch?v=ger6-D2XC2I

        RP4 Pro: https://www.youtube.com/watch?v=Smw5c0vHRas

        On SD860 I've controlled the car using SDL2's joystick emulation via gyro, and it was kinda flunky. RP4 Pro has a proper joystick, so it was much more pleasant :)

         

        Last edit: Ivan 2024-07-12
        • Eugene MC

          Eugene MC - 2024-08-23

          Sorry, and how to compile android app with your code?

           

Log in to post a comment.