Giter VIP home page Giter VIP logo

donut's Introduction

donut

GitHub Stars Discord chat License

donut is an open source reimplementation of The Simpsons: Hit & Run written in modern C++ and modern OpenGL.

You still need to have the original game assets in order to use this.


Building

Clone the code using: git clone --recursive https://github.com/plowteam/donut.git

The simplest way to obtain all the required dependencies is through vcpkg.

PS> .\vcpkg install sdl2 bullet3 openal-soft fmt
Linux:~/$ ./vcpkg install sdl2 bullet3 openal-soft fmt

If you don't want to use vcpkg; CMake will fallback on installed system dependencies, or manually specified package directories.

Windows

You can either:

  1. Open the donut folder directly in Visual Studio.
  2. Or generate project files with the following:
cd donut
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows

Linux

Note: These instructions are for Ubuntu, but can be easily applied to other distros.

Ensure you have dependencies first

sudo apt install cmake
cd donut
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux
cmake --build build -j 5

Mesa drivers on Linux: if you are trying to run with Mesa drivers and are getting issues with OpenGL context try messing with MESA_GL_VERSION_OVERRIDE when running like so: MESA_GL_VERSION_OVERRIDE=4.3FC MESA_GLSL_VERSION_OVERRIDE=430 bin/donut

Docs

Contributing

Contributions are always welcome, whether it's modifying source code to add new features or bug fixes, documenting new file formats or simply editing some grammar.

You can also join the Discord for development discussion if you are unsure of anything.

License

donut is released as open source software under the GPL v3 license, see the LICENSE.md file in the project root for the full license text.

donut's People

Contributors

aylaylay avatar handsomematt avatar ognik5377 avatar rndtrash avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

donut's Issues

Cannot build with newest g++

Environment: Arch Linux, g++ 9.1.0, building from master branch (ffe6c00)

$ mkdir build
$ cd build
$ cmake ..
$ make -j
[...]
[ 20%] Building CXX object src/CMakeFiles/donut.dir/Level.cpp.o
In file included from /usr/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/include/c++/9.1.0/bits/allocator.h:46,
                 from /usr/include/c++/9.1.0/memory:63,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _Tp = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>]’:
/usr/include/c++/9.1.0/bits/alloc_traits.h:482:2:   required from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _Tp = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true> >]’
/usr/include/c++/9.1.0/bits/hashtable_policy.h:2075:36:   required from ‘std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>]’
/usr/include/c++/9.1.0/bits/hashtable.h:1243:46:   required from ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>&) [with _Key = std::__cxx11::basic_string<char>; _Value = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::__cxx11::basic_string<char> >; _H1 = std::hash<std::__cxx11::basic_string<char> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
/usr/include/c++/9.1.0/bits/unordered_map.h:181:7:   required from here
/usr/include/c++/9.1.0/ext/new_allocator.h:145:20: error: use of deleted function ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::__cxx11::basic_string<char>; _T2 = std::unique_ptr<Donut::Font>]’
  145 |  noexcept(noexcept(::new((void *)__p)
      |                    ^~~~~~~~~~~~~~~~~~
  146 |        _Up(std::forward<_Args>(__args)...)))
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9.1.0/bits/stl_algobase.h:64,
                 from /usr/include/c++/9.1.0/memory:62,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/bits/stl_pair.h:303:17: note: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::__cxx11::basic_string<char>; _T2 = std::unique_ptr<Donut::Font>]’ is implicitly deleted because the default definition would be ill-formed:
  303 |       constexpr pair(const pair&) = default;
      |                 ^~~~
/usr/include/c++/9.1.0/bits/stl_pair.h:303:17: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = Donut::Font; _Dp = std::default_delete<Donut::Font>]’
In file included from /usr/include/c++/9.1.0/memory:80,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/bits/unique_ptr.h:411:7: note: declared here
  411 |       unique_ptr(const unique_ptr&) = delete;
      |       ^~~~~~~~~~
make[2]: *** [src/CMakeFiles/donut.dir/build.make:193: src/CMakeFiles/donut.dir/Level.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4802: src/CMakeFiles/donut.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

My C++ skills are not good enough to fix this myself.

ARM support?

Hello,
is the project ready (or is it possible) to be ported for other ARM based platforms? I was wondering about Android, Raspberry Pi or Nintendo Switch.

Thanks for your attention.

LoadP3D issues - Pure3D branch - Unreconized Chunk

Hi,
Trying to understand the code and what it currently does, currently it gets to loading the krustyPoster.bmp from the l1z1.p3d, Upon the next loop of block i get a begin chunk type of 48347 that becomes an unreconized chunk of (1900/36).
(I am using Ghidra to see where the data is and trying to compare to how the loader is choosing what memory ranges to load in)
Where do you get the information for the chunk types and how they are linked back to the game itself, which parts of the rewrite work and which bits need work?

Is there a discord chat (current link in readme is dead)?

RADScript Mission Script Files (.mfk, .con)

RADScript appears to be the internal name used for mission script files (.mfk) but also to describe vehicles (.con)

apu_v.con:

// Apu's Longhorn

SetMass(1500.0);

SetGasScale(7.5); 
SetSlipGasScale(8.5);
...

m0i.mfk:

SelectMission("m0");

SetMissionResetPlayerInCar("level1_carstart");
SetDynaLoadData("l1z1.p3d;l1r1.p3d;l1r7.p3d;");
...

Archive Format (.rcf)

file format header:

char[32] "RADCORE CEMENT LIBRARY"
uint8_t version? (always 1)
uint8_t version? (always 2)
uint8_t ??? (always 0)
uint8_t ??? (always 0)
uint32_t dict pos? (always 2048)
uint32_t ??? (always 0)
uint32_t dict pos? (always 2048)

rest of data is null until pos=2048 then it's probably some sort of dictionary listing

Information

What's the status of this project!!?

Ohh, opengl 4.x required... Mm

Cant build on linux using newest cmake, g++

Enviroment: Ubuntu 18.04.3 LTS, building from master branch 861e294

MSBRG:~/Desktop/donut/build$ sudo cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/lemorz56/Desktop/donut/build

MSBRG:~/Desktop/donut/build$ make
[  1%] Building CXX object src/CMakeFiles/donut.dir/AnimCamera.cpp.o
/home/lemorz56/Desktop/donut/src/AnimCamera.cpp:7:10: fatal error: filesystem: No such file or directory
 #include <filesystem>
          ^~~~~~~~~~~~
compilation terminated.
src/CMakeFiles/donut.dir/build.make:62: recipe for target 'src/CMakeFiles/donut.dir/AnimCamera.cpp.o' failed
make[2]: *** [src/CMakeFiles/donut.dir/AnimCamera.cpp.o] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/donut.dir/all' failed
make[1]: *** [src/CMakeFiles/donut.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

LICENSE?

Hi,

I'd like to work with this, but what license is the code under? I can only find license markers in thirdparty libs.

Thanks!

How was it made?

Hi,
I am curious about the process followed to re-create a game. It would be useful to document the project (or make a wiki) to help others contribute to it or even start their own projects.

  • Which computer knowledge is needed (computer architecture, libraries)?
  • How do you use the original software files (debugger, decompiler)?

Thank you for your attention.

cmake issue

[corey@corey-pc Storage]$ git clone --recursive https://github.com/plowteam/donut.git
Cloning into 'donut'...
remote: Enumerating objects: 3931, done.
remote: Counting objects: 100% (586/586), done.
remote: Compressing objects: 100% (464/464), done.
remote: Total 3931 (delta 327), reused 346 (delta 121), pack-reused 3345
Receiving objects: 100% (3931/3931), 6.41 MiB | 5.25 MiB/s, done.
Resolving deltas: 100% (2769/2769), done.
[corey@corey-pc Storage]$ cd donut
[corey@corey-pc donut]$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-linux
CMake Error at /usr/share/cmake-3.20/Modules/CMakeDetermineSystem.cmake:129 (message):
  Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
  CMakeLists.txt:16 (project)


CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

cmake builds failing on linux

Attempting to build the project with the instructions from readme are failing. I could find another issue but it appears to be closed, so raising a new one

GL Context is double-freed

Problem: donut always exits ungracefully.

+---------------------------------------------------+
|    _____        /--------------------------\      |
|   /     \      |                            |     |
| \/\/     |    /     donut game               \    |
|  |  (o)(o)    |                              |    |
|  C   .---_)   \_   _________________________/     |
|   | |.___|      | /                               |
|   |  \__/      <_/                                |
|   /_____\                                         |
|  /_____/ \                                        |
| /         \                                       |
+---------------------------------------------------+

hellooooooooooo new york!!!!
Initializing SDL...
SDL Version/Compiled 2.0.12
SDL Version/Linked 2.0.12
OpenGL version loaded: 4.6
Vendor: NVIDIA Corporation
Renderer: GeForce GTX 1050 Ti/PCIe/SSE2
Version: 4.6.0 NVIDIA 460.73.01
// some unrelated messages //
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  4 (X_GLXDestroyContext)
  Serial number of failed request:  3409
  Current serial number in output stream:  3409
AL lib: (EE) alc_cleanup: 1 device not closed

Theory: this error is caused by double-free of GL context.
Proof of concept:

#include <GL/glew.h>
#include <SDL2/SDL.h>

int main(int argc, char* argv[])
{
    SDL_Init(SDL_INIT_VIDEO); /* Initialises Video Subsystem in SDL */

    /* Setting up OpenGL version and profile details for context creation */
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
    
    /* A 800x600 window. Pretty! */
    SDL_Window* window = SDL_CreateWindow
        (
        "SDL Context",
        SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
        800, 600,
        SDL_WINDOW_OPENGL
        );
    
    /* Creating OpenGL Context */
    SDL_GLContext gl_context = SDL_GL_CreateContext(window);

    /* Loading Extensions */
    glewExperimental = GL_TRUE;
    glewInit();

    /* The following code is for error checking. 
    *  If OpenGL has initialised properly, this should print 1.
    *  Remove it in production code.
    */
    GLuint vertex_buffer;
    glGenBuffers(1, &vertex_buffer);
    printf("%u\n", vertex_buffer);
    /* Error checking ends here */

    /* Main Loop */
    SDL_Event window_event;
    while(1) {
        if (SDL_PollEvent(&window_event)) {
            if (window_event.type == SDL_QUIT) {
                /* If user is exiting the application */
                break;
            }
        }
        /* Swap the front and back buffer for flicker-free rendering */
        SDL_GL_SwapWindow(window);
    }
    
    /* Freeing Memory */
    glDeleteBuffers(1, &vertex_buffer);
    SDL_GL_DeleteContext(gl_context);
    SDL_GL_DeleteContext(gl_context); // <=
    SDL_Quit();

    return 0;
}
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  4 (X_GLXDestroyContext)
  Serial number of failed request:  299
  Current serial number in output stream:  299

.cho file loader

.cho files are used by the game to describe playable character rigs, define their animations in a standard key value string and their "locomotion" animations / speed / etc..

// skeleton rig
rig "homer"
{
    skeleton "homer";

    // roots
    jointIndex_AIRoot 0;
    jointIndex_OrientationRoot 0;
    joint_MotionRoot "Motion_Root";
    joint_BalanceRoot "Balance_Root";
    joint_CharacterRoot "Character_Root";

    // balance root
    maxBalanceRootCompress 0.25;

    // legs
    leg "left"
    {
        jointIndex_FootPlant 1;
        footPlantChannelIndex 1;

        joint_FKMin "Hip_L";
        joint_FKMax "Ball_L";

        joint_Thigh "Hip_L";
        joint_Knee "Knee_L";
        joint_Ankle "Ankle_L";

        //joint_Effector "Left_Foot";
        //joint_PoleVector "Left_Knee";
        //joint_OrientOffset "L_Foot_O_Off";

        isIKRigged 0;
    };

   // ...
};

similar to https://developer.valvesoftware.com/wiki/KeyValues

Build fail

When building the project, running cmake --build build -j 1, it gives me the following error message:
home/pedrodemargomes/pedro/donut/src/Render/SkinAnimation.h: In member function ‘T Donut::SkinAnimation::ValueKeyCurve<T>::Evalulate(float, T)’: /home/pedrodemargomes/pedro/donut/src/Render/SkinAnimation.h:79:11: error: ‘glm’ has not been declared 79 | time = glm::mod(time, _keyValues[lastIndex]->GetTime()); | ^~~ make[2]: *** [src/CMakeFiles/donut.dir/build.make:63: src/CMakeFiles/donut.dir/AnimCamera.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:94: src/CMakeFiles/donut.dir/all] Error 2 make: *** [Makefile:84: all] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.