Coder Social home page Coder Social logo

codenamecpp / carnage3d Goto Github PK

View Code? Open in Web Editor NEW
461.0 24.0 37.0 12.13 MB

Reimplementation of Grand Theft Auto 1 [GTA1]

License: MIT License

C++ 58.79% C 37.79% GLSL 0.16% Makefile 0.04% Lua 0.05% Objective-C 2.91% CMake 0.15% Batchfile 0.01% Python 0.03% HTML 0.08%
gta gta1 reimplementation video-game c-plus-plus

carnage3d's People

Contributors

codenamecpp avatar jetomit avatar mailaender avatar marmichalski avatar neuromancer 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  avatar  avatar

carnage3d's Issues

[Gui] Enhancements

This includes:

  • Font scale
  • Text word-wrap
  • HUD scale
  • Refactore HUD base classes
  • Clipping for elements
  • Implement Pager, Mission info block
  • Implement target arrow

Linux support?

Hi,

Any plans for Linux support of this neat reimplementation?

Thanks!

Doesn't work after compiling on xubuntu

I followed the instructions for compiling; no issue here.

When I launch the file carnage3d-debug in bin I get an error:
$ bin/carnage3d-debug
System initialize
Working directory: '~/soft/git/carnage3d/bin'
Cannot load config from 'config/sys_config.json'
Cannot load configuration
System shutdown

After running a locate to find sys_config.json I find sys_config.json.default
I rename sys_config.json.default to sys_config.json

I launch bin/carnage3d-debug and get this error:

$ ./carnage3d-debug
System initialize
Working directory: '~/soft/git/carnage3d/bin'
gta_gamedata_location directory does not exists
Init MemoryManager
Frame heap memory size: 12582912
GLFW Information: 3.2.1 X11 GLX EGL clock_gettime /dev/js Xf86vm shared
Initialize OpenGL 3.2 (Core profile)
Screen resolution: 1024x768, Vsync: disabled, Fullscreen: no
OpenGL Vendor: Intel Open Source Technology Center
OpenGL Renderer: Mesa DRI Intel(R) Sandybridge Mobile
OpenGL Version: 3.3 (Core Profile) Mesa 19.0.8
GLSL Version: 3.30
Graphics Device caps:

  • max array texture layers: 512
  • max texture buffer size: 134217728 bytes
    Render program loaded shaders/texture_color.glsl
    Render program loaded shaders/gui.glsl
    Render program loaded shaders/city_mesh.glsl
    Render program loaded shaders/sprites.glsl
    Render program loaded shaders/debug.glsl
    Cannot open map data file 'NYC.CMP'
    carnage3d-debug: ../src/SpriteManager.cpp:21: bool SpriteManager::InitLevelSprites(): Assertion `gGameMap.mStyleData.IsLoaded()' failed.
    Aborted (core dumped)

Graphical artifacts

When I'm moving around, walls tend to flicker like hell. Additionally, after changing elevation or zooming in/out, some of the horizontal tiles spaz out for a second, frequently switching between textures. I'm on Linux (Debian).

Screenshot:
bug

Output:

$ ./bin/carnage3d-debug -mapname SANB.CMP
System initialize
Working directory: '/data/git/carnage3d/bin'
Screen resolution: 1600x900, Vsync: disabled
gta_gamedata_location: '/data/Games/GTA/GTAINSTALLER/extracted/Program_Executable_Files/GTADATA'
GLFW Information: 3.3.0 X11 GLX EGL OSMesa clock_gettime evdev shared
Initialize OpenGL 3.2 (Core profile)
Screen resolution (1600x900)
OpenGL Vendor: NVIDIA Corporation
OpenGL Renderer: GeForce GTX 660/PCIe/SSE2
OpenGL Version: 3.2.0 NVIDIA 418.74
GLSL Version: 1.50 NVIDIA via Cg compiler
Render program loaded shaders/texture_color.glsl
Render program loaded shaders/gui.glsl
Render program loaded shaders/city_mesh.glsl
Render program loaded shaders/sprites.glsl
Render program loaded shaders/debug.glsl
System shutdown

Incorrect rate of fire and ammo consumption

Here's a table illustrating the timing differences of weapons being emptied from full (99) ammo:

Weapon Original game Carnage3D
Pistol ~42s ~50s
Machine gun ~21s ~13s
Flamethrower ~21s ~7.5s
Rocket launcher ~84s ~98s

MG and flamethrower empty way too fast in Carnage3D. They also seem to produce fewer projectiles - Carnage3D considers 1 ammo = 1 projectile, whereas the original game has several projectiles (5?) for 1 ammo.

Blood sometimes moving away from corpses

I haven't found stable reproduction steps, however what usually works is to fire a rocket at a wall, then start killing pedestrians. I think it may have something to do with the smoke effect from explosions because the blood splatters appear to gain the same velocity.

Makefile issues

Some Makefile issues to discuss:

  • Some parts of Makefile specified the use of clang and other just use any compiler (e.g. Box2D)
  • Some parts of Makefile specified the use of sanitizers but not all of them (e.g Box2D) (this is my fault, I know ๐Ÿ˜ž )
  • The shell expansion to select the number of cores is not working properly, we should change it like this.

Allow to use system Box2D

Currently Box2D is pulled in as a submodule (which complicates packaging), but from what I can see there's no reason we couldn't just use Box2D installed system-wide. This would also mean less things to compile since some distros provide it as an official package.

Big hary crashdump

I don't think it likes my embedded intel gfx card.

[baggypants@swordfish2 carnage3d]$ ./bin/carnage3d-debug
System initialize
Working directory: '/home/baggypants/Develop/carnage3d/bin'
gta_gamedata_location: '/home/baggypants/Games/gta/drive_c/GTA/gtadata'
Init MemoryManager
Frame heap memory size: 12582912
../src/stb_sprintf.h:1214:13: runtime error: store to misaligned address 0x000001c3d272 for type 'unsigned int', which requires 4 byte alignment
0x000001c3d272: note: pointer points here
 6f 6e  3a 20 73 69 7a 65 3a 20  31 32 35 38 32 39 31 32  00 67 79 70 61 6e 74 73  2f 47 61 6d 65 73
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:1214:13 in
GLFW Information: 3.3.0 X11 GLX EGL OSMesa clock_gettime evdev
Initialize OpenGL 3.2 (Core profile)
../src/stb_sprintf.h:357:17: runtime error: store to misaligned address 0x000001c3d27b for type 'unsigned int', which requires 4 byte alignment
0x000001c3d27b: note: pointer points here
 78  37 36 38 20 70 72 6f 66  69 6c 65 29 00 53 4d 65  73 61 20 63 6c 6f 63 6b  5f 67 65 74 74 69 6d
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/stb_sprintf.h:357:17 in
Screen resolution: 1024x768, Vsync: disabled, Fullscreen: no
=================================================================
==69484==ERROR: AddressSanitizer: requested allocation size 0xffffffffffffffed (0x7f0 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
    #0 0x5c23b7  (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
    #1 0x7f086f722348  (/usr/lib64/dri/i965_dri.so+0x634348)
    #2 0xffffffec  (<unknown module>)

==69484==HINT: if you don't care about these errors you may set allocator_may_return_null=1
SUMMARY: AddressSanitizer: allocation-size-too-big (/home/baggypants/Develop/carnage3d/bin/carnage3d-debug+0x5c23b7)
==69484==ABORTING

It seems it can't build with Clang 10

It seems that it doesn't build in Clang 10 due to lack of libclang_rt.asan-x86_64.a I'm a bit tired to properly troubleshoot it now, but quick googling returned that this file is no longer used in Clang/Compiler-rt.

Support the GTA demos

Unfortunately, Rockstar no longer offers the original GTA for free. However, some demos are still available. I tried the demos, and Carnage3D seems to work (at least partially) with them (but you need to un-comment the proper .CMP to load: for instance, NYC instead of MIAMI).

In summary, supporting the demos will allow people to quickly test this neat reimplementation ๐Ÿ˜„

Allow to use system premake

Currently it seems impossible to avoid downloading premake during make instead of using the system installed one. Which also happens to make use of wget which isn't documented as a needed dependency..

[Gameplay] Weapons

This incudes:

  • Implement all types of weapons
  • Projectiles
  • Explosions
  • Damage for cars and pedestrians

Continuous Integration Testing

It's never too early for CI testing!

I recommend to setup CI using websites like TravisCI since they allow to specify Window/Linux systems and they are integrated with Github. Let me know if you need help with this.

Build error on Linux

../src/WeatherManager.cpp:5:10: fatal error: 'Cvars.h' file not found
#include "Cvars.h"
         ^~~~~~~~~

Changing it to #include "cvars.h" solves the issue.

BTW, can I ask what this weather stuff is all about? Is it to support the Snowball City mod? I don't recall the original game having weather.

Game freezes when interacting with debug window

When I expand the "Ped" section in the debug window or open the console, the player character disappears and sometimes the game freezes for about 30 seconds. My whole system is barely responsive in that time.

Allow to use system GLFW

Just like the ticket about Box2D, allowing users to use their system-wide GLFW would mean less to compile and less space wasted.

[Gameplay] Add split screen feature

I would like to add cooperative / deathmatch in hot-seat mode so split screen is a must. Support up to 4 players.

Tasks:

  • Implement per-player viewport with own camera and camera controller
  • Split screen layouts
  • Efficient off-screen objects culling mechanism
  • Add command line parameters to start game in split screen mode
  • Rewrite map blocks cache&render mechanism

Assertion `false' failed

Latest revision (1d44f7a) fails to run:

$ make run_demoversion
./bin/carnage3d-debug -mapname SANB.CMP -gtadata "gamedata/demoversions/GTAECTS/GTADATA"
Carnage3D 0.0.2
System initialize
Working directory: '/home/g/Games/carnage3d/bin'
carnage3d-debug: ../src/FileSystem.cpp:284: bool FileSystem::ReadConfig(const std::string &, cxx::json_document &): Assertion `false' failed.
make: *** [Makefile:39: run_demoversion] Aborted (core dumped)

Visual studio build error

Hi, I'm getting the following error when trying to compile with Visual Studio 2015:

Error MSB8020 The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

If I do 'retarget solution', i get

We were unable to automatically populate your Visual Studio Team Services accounts.

The following error was encountered: VS30063: You are not authorized to access https://app.vssps.visualstudio.com.Retargeting End: 1 completed, 0 failed, 0 skipped

Cannot Change Inputs

New to writing issues, sorry in advance.

I was trying to change the inputs for the game by editing gamedata/config/inputs.json but after changing anything, I got the error
carnage3d-debug: ../src/enum_utils.h:98: bool cxx::parse_enum(const char *, TEnum &) [TEnum = eKeycode]: Assertion false' failed. make: *** [Makefile:39: run_demoversion] Aborted (core dumped)
I am using arch linux if that helps, i am probably missing something obvious here

[UI] Implement basic HUD

This includes:

  • Show current player stats on screen (health, weapon, powerups, score)
  • Font draw

Bikes turn 90 degrees

Driving cars feels ok, but bikes will turn 90 degrees each time I press the left/right arrow.

Cannot map different players to same keyboard

In earlier builds, you used to be able to map multiple people to a single keyboard, but that doesn't seem to be the case.
Here is my inputs.json file:

{
"player1":
{
"gamepad_id": "Gamepad1",
"actions":
[
// common
{"action":"NextWeapon", "keycode":"2", "gpbutton":"LeftBumper"},
{"action":"PrevWeapon", "keycode":"1", "gpbutton":"RightBumper"},
// on foot
{"action":"TurnLeft", "keycode":"a", "gpbutton":"Left"},
{"action":"TurnRight", "keycode":"d", "gpbutton":"Right"},
{"action":"Jump", "keycode":"q", "gpbutton":"LeftTrigger"},
{"action":"WalkBackward", "keycode":"s", "gpbutton":"Down"},
{"action":"Run", "keycode":"w", "gpbutton":"Up"},
{"action":"Shoot", "keycode":"z", "gpbutton":"B"},
{"action":"EnterCar", "keycode":"e", "gpbutton":"X"},
{"action":"EnterCarAsPassenger", "keycode":"x", "gpbutton":"A"},
// in car
{"action":"HandBrake", "keycode":"q", "gpbutton":"Y"},
{"action":"Accelerate", "keycode":"w", "gpbutton":"Up"},
{"action":"Reverse", "keycode":"s", "gpbutton":"Down"},
{"action":"SteerLeft", "keycode":"a", "gpbutton":"Left"},
{"action":"SteerRight", "keycode":"d", "gpbutton":"Right"},
{"action":"Horn", "keycode":"3", "gpbutton":"A"},
{"action":"LeaveCar", "keycode":"e", "gpbutton":"X"}
]
},
"player2":
{
"gamepad_id": "Gamepad2"
"actions":
[
// common
{"action":"NextWeapon", "keycode":"5", "gpbutton":"LeftBumper"},
{"action":"PrevWeapon", "keycode":"4", "gpbutton":"RightBumper"},
// on foot
{"action":"TurnLeft", "keycode":"f", "gpbutton":"Left"},
{"action":"TurnRight", "keycode":"h", "gpbutton":"Right"},
{"action":"Jump", "keycode":"r", "gpbutton":"LeftTrigger"},
{"action":"WalkBackward", "keycode":"g", "gpbutton":"Down"},
{"action":"Run", "keycode":"t", "gpbutton":"Up"},
{"action":"Shoot", "keycode":"v", "gpbutton":"B"},
{"action":"EnterCar", "keycode":"y", "gpbutton":"X"},
{"action":"EnterCarAsPassenger", "keycode":"b", "gpbutton":"A"},
// in car
{"action":"HandBrake", "keycode":"r", "gpbutton":"Y"},
{"action":"Accelerate", "keycode":"t", "gpbutton":"Up"},
{"action":"Reverse", "keycode":"g", "gpbutton":"Down"},
{"action":"SteerLeft", "keycode":"f", "gpbutton":"Left"},
{"action":"SteerRight", "keycode":"h", "gpbutton":"Right"},
{"action":"Horn", "keycode":"6", "gpbutton":"A"},
{"action":"LeaveCar", "keycode":"y", "gpbutton":"X"}
]
},
"player3":
{
"gamepad_id": "Gamepad3"
},
"player4":
{
"gamepad_id": "Gamepad4"
}
}

I only have ps4 controllers, so i was trying to map each player to the keyboard and then use a joystick mapper on top of that, however, running this results in this error:

carnage3d-debug: ../src/FileSystem.cpp:250: bool FileSystem::ReadConfig(const std::string &, cxx::json_document &): Assertion `false' failed.
./Play.sh: line 1: 6884 Aborted (core dumped) ./bin/carnage3d-debug -mapname SANB.CMP -gtadata "gamedata/fullversion/GTADATA" -numplayers 2

Any ideas on how to get this to work?

Include sane defaults for sys_config.json options in case this file is not created

This will avoid make run_demoversion to fail if there is no sys_config.json file in gamedata/config:

$ make run_demoversion
./bin/carnage3d-debug -mapname SANB.CMP -gtadata "gamedata/demoversions/GTAECTS/GTADATA"
System initialize
Working directory: '/home/games/carnage3d/bin'
Cannot load config from 'config/sys_config.json'
Cannot load configuration
System shutdown
make: *** [Makefile:39: run_demoversion] Error 1

MacOS Support

Hi,

I am working on making this work with macOS.

Would you be accepting PR's? If so, my to-do list is as follows:

  • Make the source compile on mac (#70)
  • Add DPI awareness (currently hardcoded for testing purposes ๐Ÿ˜›)
  • Prepare build env for mac, either with premake or cmake (#68)

carmage3d

[Gameplay] Implement basic city traffic

This includes:

  • Traffic cars generation and navigation
  • Pedestrians generation and navigation

Traffic cars and peds should be destroyed over time when they go out of screen.

Game freeze on MIAMI.CMP

After 9c0361c, the game stops responding when loading the map MIAMI.CMP. I am not familiar with the code but I can see SpriteAnimation::UpdateFrame looping forever because mAnimDesc.mFrameRate evaluates to infinity.

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.