Rewriting My Game Engine based off GTA 3 Source Code

  Переглядів 21,636

MakerJSON

MakerJSON

11 днів тому

My second devlog, I've recently done a re-write on my game engine, and used the GTA 3 Re-implementation / OpenRW project for some useful design practices that I've discussed in this video!
My Rewrite it here: (on a rewrite branch)
github.com/jasonmzx/cppkart/t...
And here's a link to the OpenRW Project Website:
openrw.org/
Thanks for Watching
#opengl #gamedev #gamedevelopment #computerscience

КОМЕНТАРІ: 46
@jason_m2003
@jason_m2003 8 днів тому
github.com/jasonmzx/cppkart
@zonea4860
@zonea4860 8 днів тому
OpenRW" and "re3" are two completely different projects. "re3" was the one that got sued and removed from github. From my knowledge "OpenRW" never had such problems. These two projects were made in two totally different ways. "re3" was an attempt in decompiling (decompiling is a form/method of reverse engineering) the original game executable back to readable C++ code, that's why it replicated the behaviour of the original game so well (almost 1:1, even bugs were replicated), but that's also why it got sued. "OpenRW" on the other hand is a project that aims to recreate the game engine to behave as closely to the original as possible, but without actually using any decompiled code, that's why this project is completely legal, but that's also why its less accurate than "re3". In many cases authors of this project had to "eyeball" stuff, because they didn't have the access to the original code, they were coming up with their own code that was able to read the game data and recreate its behaviour. That's also why "OpenRW" is called "OpenRW" as in "Open Re-Write" and not "OpenRE" as in "Open Reverse Engineering" or something like that. Cool devlog tho
@siiipatron1626
@siiipatron1626 7 днів тому
well explained, thank you ❤
@jason_m2003
@jason_m2003 6 днів тому
I was under the impression that the RE3 was just a distribution of the OpenRW engine, however R3 also included the copy-righted assets, and so they where able to re-publish it without those assets? I'm not 100% sure, and what you said here sounds legit
@zonea4860
@zonea4860 6 днів тому
@@jason_m2003 RE3 contained only reverse engineered code without the assets. It required you to have original game files similarly to OpenRW. RE3 got in trouble, because even though they didn't include copyrighted assets, they reverse engineered code from the original executable which itself is copyrighted. Reverse engineering is kind of a grey legal area, so after the first DMCA takedown the creators of RE3 appealed and got the repository back online for a short period of time, but then Take Two filed a second DMCA and the project got taken down again, and this time the creators of RE3 weren't able to get it back online and the project is unavailable to this day
@zonea4860
@zonea4860 6 днів тому
​@@jason_m2003 Just as I said before these are two completely different projects. RE3 contained only reverse engineered code and it didn't have any copyrighted assets. It required you to have original game data similarly to OpenRW. RE3 got in trouble, because even though it didn't have any copyrighted assets, it still contained the reverse engineered code from the original executable which itself is copyrighted. Reverse engineering is kind of a gray legal area, so after getting the project taken down the creators of RE3 managed to appeal from the first DMCA and got the repository back online for a short period of time, but then Take Two filed a second DMCA that the creators of RE3 didn't manage to appeal from and the project got taken down again. They've never managed to get the project back online, so the original repository is unavailable to this day
@jason_m2003
@jason_m2003 6 днів тому
@@zonea4860 Oh wow, didn't know this! Thanks for sharing ZoneA
@eugenetalks
@eugenetalks 9 днів тому
Just wow, I love how you simplified some explanations about OpenRW's engine, for the more intuitive understanding 🎉🎉🎉
@jason_m2003
@jason_m2003 8 днів тому
Glad it was helpful!
@Snowy-AI
@Snowy-AI 9 днів тому
Bro played Shake from Rise RM Gta 3 radio and thought we wouldn't notice
@jason_m2003
@jason_m2003 9 днів тому
👀wow didn't expect you guys to notice so quick
@aliyassin5631
@aliyassin5631 День тому
I am a freshman cs student and planning to make my engine at some point and this video was great inspiration to me, please keep making more devlogs, support from Egypt!
@squiddywtf
@squiddywtf 9 днів тому
i dont know how to program but it looks pretty cool! great job :)
@Sandbowl
@Sandbowl 8 днів тому
rise FM background music 💞🎊
@jason_m2003
@jason_m2003 8 днів тому
Wakey Wakey, You are now listening to RISE !
@zestaboy2455
@zestaboy2455 8 днів тому
Pretty dope! I've been looking at the project myself and making a similar game in Godot but in my own style
@jason_m2003
@jason_m2003 8 днів тому
Nice, Goodluck brother ✌️
@jw200
@jw200 5 днів тому
I wish they would release GTA2 sources. Or hackers would leak it
@daniel50849
@daniel50849 6 днів тому
Plz do more devlogs
@benjamin2713
@benjamin2713 4 дні тому
Nice BG Music
@ismbks
@ismbks 5 днів тому
has anybody ever lost a case, or have been sentenced for reverse engineering? to my knowledge there is nothing illegal about reverse engineering, no matter what the terms and conditions of the software says im genuinely curious if it has ever happened
@toddwasson3355
@toddwasson3355 5 днів тому
If the EULA says you can't then you're in breach of contract by doing so. So yes, it's illegal and yes, you can get sued over it. Big time.
@SuperFranzs
@SuperFranzs 3 дні тому
@@toddwasson3355 The EULA never trumps the law. Not even in the United States. And I'm pretty sure almost every EULA says you can't reverse engineer the product. Most reverse engineering lawsuits claim that one or more people involved in the project has looked at the original code. Most companies want this gray area since they use it themselves.
@raveltammeleht6278
@raveltammeleht6278 8 днів тому
Interesting! Since you now have some knowledge and experience with the code base. How would you personally describe its performance side of things. Such as optimization. I noticed quaternions. Do you have them implemented and how do you go about them. Quaternions are sometimes tricky from my personal experience especially from the vehicle simulation perspective. To my current project they are essential part of the simulation actually. But when I tried to narrow it down to rotation matrix instead (not that I would suggest it) I found some technical limitations, just a learning experience. Why am I asking this? Well mainly because gta3's vehicles felt good, but not exactly amazing, this is how I find the quaternions in this game a bit interesting. As if I would have never guessed that such a advanced rotation model is actually used there in the first place. I previously thought that all the rotations are done in plain simple Euler Angles.
@toddwasson3355
@toddwasson3355 5 днів тому
I do vehicle simulation too and don't bother with quaternions either. I always end up needing the matrices for something (up/right/forward vectors are useful for lots of stuff) so both end up being there. I found it easier just to ditch the quaternions rather than fumbling back and forth between the two. Quats can't be visualized in any sense at all anyway so being creative with rotations and stuff gets hard in a hurry. Back in the old days quaternions could gain you some speed which I think is why so many folks were using them. Nowadays it hardly matters. If I'm not mistaken, GPUs have hardware accelerated matrix ops anyway so they're pretty hard to beat.
@raveltammeleht6278
@raveltammeleht6278 5 днів тому
@@toddwasson3355 thank you for confirming. Matrices seem better for this case, in the middle of integrating them from ground up, so my implementation is process dependent (doesn't matter if its CPU or GPU, the math is plain algebra in my case, but based on the initial efforts of Gottfried Wilhelm Leibniz) I'm integrating everything from ground up to be as reliable as the original concept. Vehicle physics is a great topic in general and I'm highly interested in all of it.
@toddwasson3355
@toddwasson3355 3 дні тому
@@raveltammeleht6278 Yeah, I think quats are overrated personally. Besides, if you're doing rendering you'll have shaders that look something like this anyway: VS_GBuffer_Out VSMain(VS_GBuffer_In input) { VS_GBuffer_Out output; float4x4 vp = mul(cbCamera.view, cbCamera.projection); float4x4 mvp = mul(cbTransform.model, vp); output.pos = mul(float4(input.pos, 1.0f), mvp); } That's a simple vertex shader. The view, model and projections are all matrices (float4x4 is 4x4 matrix of floats). That mul() function is built into hlsl shader language (glsl has an equivalent too) so you'll see it everywhere. Pretty sure there's dedicated hardware for that on the GPU, so when it comes time to render your car or whatever else, you'll probably want the matrix anyway. I figure just skip the expensive converting back and forth. You could write your own shader that uses quats instead if you really wanted to I suppose, but there's not much point these days, I think. We're not compute bound nowadays. Hi performance comes much more from good caching and clever memory use than cutting out a few arithmetic ops.
@eaeaeaeaeaeaeaeaeaeae
@eaeaeaeaeaeaeaeaeaeae 8 днів тому
epik
@toddwasson3355
@toddwasson3355 5 днів тому
Pretty cool. I'm not sure how good of an idea it is to get too buried in engine design patterns from a graphics engine that's 25 years old though, predating almost all GPU hardware acceleration and multicore. Can OpenGL do anything like DirectX12's ExecuteIndirect? I'm sure the old versions can't, but I wonder if the most recent versions can. I've been writing a DX12 engine for the last two years. All draw calls for the entire scene are loaded onto the GPU during loading one time. One big vertex buffer and one big index buffer for everything but 2D overlay stuff, pretty much. It's then rendered with just one ExecuteIndirect call per camera in my system. That runs a compute shader which culls the scene and builds a fresh draw call list that goes straight to the GPU rendering pipeline. There's no looping over objects CPU-side at all per frame other than the cameras.
@jason_m2003
@jason_m2003 4 дні тому
Great point, yea I need to find a way to keep the Vertex & Index buffers on the GPU, and just dynamically update the model matrices and some other minor things, rather than re-computing all instructions which I'm doing now, (including getting the Geometry ptr at every frame, and drawing it with the respective model matrix). I still need to look more into it, but you're totally right I feel like that would be much more efficient and less CPU bound like it is now... Thanks again Todd for your input bro!!
@toddwasson3355
@toddwasson3355 4 дні тому
@@jason_m2003 Yeah, recomputing and reuploading the vertex and index buffers every frame will be hugely expensive. That might explain why you're CPU limited. You're probably barely using the GPU at all right now. OpenGL has had vertex buffer objects (VBOs) forever so if you're not using those, I'd look into it. Probably there's the same for index buffers. At the hardware level (DirectX12 and Vulkan) there are three different types of heaps for buffers (think of it as three different buffer types, in a sense): The first is "upload" which is a buffer that gets uploaded every frame. That's shared between CPU and GPU. That's the slowest and easiest way, but it's way faster than calling glVertex3f and so on zillions of times or transforming the vertices C++ side one at a time. The second is a "default" buffer which lives entirely on the GPU. To get data into that (in DirectX12 anyway) you first create an upload buffer and a default buffer. Then you write your C++ side std::vector or whatever you have into that upload buffer, then you copy that to the default buffer. Then it lives totally on the GPU and is so stupidly fast you won't believe it, as long as you don't do it every frame. (Not relevant here, but the third type is a "readback" buffer which you can write to in a shader and get the results back on the CPU.) Here's an early test I did a couple years ago when starting out in DX12. This is 134 million triangles on an NVidia 1080. Not a typo... ukposts.info/have/v-deo/rYFhiKVooG6EwJc.html&ab_channel=ToddWasson No chunking or culling or anything at all there. Each little "point" is a triangle. That's running with vertex and index both in default buffers using a single draw call for everything. No textures or lighting or anything, just colored triangles. So yeah, in OpenGL I'd look into VBOs (and maybe IBOs if that's what they're called), then also see if there's modes you can set like upload or default. You might have to write to upload and then copy to default like DX12 or something like that, but maybe OpenGL has some mode you can set which will do it for you. Your frame rate will blast off to the moon like you can't imagine.
@Plantum21
@Plantum21 6 днів тому
imagine some1 invent a clay brick, then after a while stops selling good clay brick and starts selling ugly plastic bricks, and also forbids other people from making clay bricks......
@The_Hambone_88
@The_Hambone_88 3 дні тому
I would love to mess with this! Is it pretty easy to setup?
@boopumer
@boopumer 2 дні тому
How did you get the skills to do stuff like this? As Bachelor Graduate I constantly have imposter syndrome because there is so much stuff I don't know about
@xoxoheartz
@xoxoheartz 4 дні тому
shake shake shake
@rawallon
@rawallon 7 днів тому
Thats pretty cool, I don't want to be the guy that does "Well, duh 🤓", but isn't that the most basic of design patterns? (and now I figure I sound just like that guy) What you've seen to have shown seems to be the most basics of inheritance, where you have can have different implementations (say one for openGL, another for Vulkan, etc.) but they respect an interface, that way later in the code they can get passed as an argument and the function that recieves that argument doesn't need to know the implementation of it
@jason_m2003
@jason_m2003 6 днів тому
Don't worry it's a valid point ! There is some nuance involved here, as OpenGL is inherently stateful and requires very careful manipulation of it's context, and how artifacts like VAOs, VBOs, Texutres, etc... are handled for correct rendering, so the OpenRW project provided a good pipeline (Involving API specific steps done at specific stages) to ensure a clean and orderly Object Hierarchy and pipeline, Yes you're correct in thinking that there shall be a "Global Interface", and Yes my new design still does the good old levels of abstractions and interfaces just like everyone else, but certain design aspects, and application specific tweaks where learnt from RW !
@sionyde2345
@sionyde2345 День тому
what are the chances of R* Sending a dmca?
@ttkftykyfts
@ttkftykyfts 6 днів тому
o.o
GTA3 Code Review: Weapons, Vehicles, Cops and Gangs
15:00
Code With Ryan
Переглядів 927 тис.
Learning C++ Game Engine Development in 1 Year
7:57
MakerJSON
Переглядів 8 тис.
одни дома // EVA mash @TweetvilleCartoon
01:00
EVA mash
Переглядів 3,9 млн
0% Respect Moments 😥
00:27
LE FOOT EN VIDÉO
Переглядів 31 млн
I Supercharged This Old Mac To Play Cyberpunk 2077
11:58
Jimmy Mack
Переглядів 119
choosing a game engine is easy, actually
15:08
samyam
Переглядів 134 тис.
So you want to make a Game Engine!? (WATCH THIS before you start)
14:39
Giant Sloth Games
Переглядів 232 тис.
How I Structure Entities In My Own C++ Game Engine
5:13
FuniGameDev
Переглядів 9 тис.
4 Months of Game Programming With My Own Engine
21:30
jdh
Переглядів 367 тис.
The Timeless Beauty of Pre Rendered Graphics
5:21
GameTalesHQ
Переглядів 653 тис.
Notch Has A New Indie Game! (Minecraft Creator)
7:59
Thomas Brush
Переглядів 77 тис.
Making a Very Minimal Windows Executable in C
7:48
Nir Lichtman
Переглядів 56 тис.
DeepMind’s New Robots: An AI Revolution!
8:39
Two Minute Papers
Переглядів 173 тис.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Переглядів 618 тис.
Lp. Последняя Реальность #64 НОВОЕ ТЕЛО • Майнкрафт
31:26
MrLololoshka (Роман Фильченков)
Переглядів 981 тис.
Test IQ CHALLENGE!  Gegagedi- countryballs animation #countryballs #shorts
0:26
CountryBalloons Animation
Переглядів 2,9 млн
Take The Water: Good Family Vs Noob Family
0:33
ToonToon Daily
Переглядів 19 млн