[SCRIPT] [RELEASED] - Ground Vehicle Effects
-
@Cyron43 I love debug info.. it's part of the fun.
But they are based on certain aspects of the particles. I store their Scale and their Lifespan. So for the line length, I have:
float DebugLineHeight = (2f * (float)Scale);And then for the colour, I have:
float greenPart = ((float)255 / cGroundVehicleEffects.ParticleLifeSpan) * LifeSpan;Which returns a value of 1 to 0 based on the lifespan of the particle.
I then pass all that to this:
cGroundVehicleEffects.DrawLine(Position, Position + new Vector3(0, 0, DebugLineHeight), Color.FromArgb(255, (int)greenPart, 0));Which calls this function:
internal static void DrawLine(Vector3 _position, Vector3 _target, Color _colour) { Function.Call(Hash.DRAW_LINE, _position.X, _position.Y, _position.Z, _target.X, _target.Y, _target.Z, _colour.R, _colour.G, _colour.B, 255); }That draws lines that scale in height and go from yellow to red as the particle goes through its lifecycle.
-
@LeeC2202 Wow thanks so much.
-
@Cyron43 You're welcome... my mods are quite a sight when I'm debugging. With bounding boxes, spinning radius displays, location markers etc...
I think it's because I relate to visual cues more than anything, so these let me see what is going on with things that don't normally have a visual counterpart. A good example is in the video on this thread https://forums.gta5-mods.com/topic/5499/tip-code-optimised-getnearbyvehicles-ped-process
-
@LeeC2202 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
@Cyron43 You're welcome... my mods are quite a sight when I'm debugging. With bounding boxes, spinning radius displays, location markers etc...
I think it's because I relate to visual cues more than anything, so these let me see what is going on with things that don't normally have a visual counterpart. A good example is in the video on this thread https://forums.gta5-mods.com/topic/5499/tip-code-optimised-getnearbyvehicles-ped-process
Bookmarked with Toby. I'll go check it out later. Looks very interesting. I come from the enterprise applications development and I'm used to unit tests but unfortunately those are not applicable for creating GTA V mods most of the times - or are they?
-
@Cyron43 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
I come from the enterprise applications development and I'm used to unit tests but unfortunately those are not applicable for creating GTA V mods most of the times - or are they?
I'm not sure... I'm not familiar with unit tests. I've done games most of my life and when I have done applications, they have always been small scale data processing, or game development tools.
I'm pretty clueless outside my small field of experience... and inside it sometimes.
-
@LeeC2202 Hmm... I've written a 2 part article about unit tests and test driven development back in 2010 but it's in German. In a nutshell, unit tests target a single functionality (method, event, property) and query the result with an expected outcome (and that's the crux in game development. Such an outcome depends on what happens in the game). Unit tests make use of unit test frameworks like NUnit or the Microsoft test framework. But testing functionality is not all. With the "test first" approach you define the syntax for a caller. This is very useful, for example, for fluent interfaces like:
AccountManager.Withdraw(500).FromAccount(12345678).ToAccount(98765432); // This is way better readable and less error prone than AccountManager.Withdraw(500, 12345678, 98765432);
-
Someone asked about heat haze effects from planes to use with cars, it's possible by using VFXVEHICLEINFO_PLANE_GENERIC in <vfxInfoName>. Results aren't so beautiful, but hey, it's something.
-
@CP I ended up doing it on the bonnet with with veh_exhaust_plane and it's okay as long as you don't look underneath. I had to write some code to disable it if the car flipped because the actual effect is about the same height as an aircraft hangar.
But that's an interesting effect that would work for the exhaust, I'm not sure I understand where it's located though. Is vfxInfoName the library and VFXVEHICLEINFO_PLANE_GENERIC the effect?
At the moment I am using core and veh_exhaust_plane, so would I use that effect in the video the same?
-
really cool thread going on here. Not completely off topic since its of similar nature. Do any of you know how I would get a smokey/haze/hotbox effect inside of Franklin's house? To make it look like a bunch of people have been smoking?
-
@LeeC2202 You have to edit vehicles.meta.
-
@_CP_ Ah... that's a pity, it would have been nice to script that in.
-
I need to try and get this mod back on track somehow... I came into this all hyped up and focused and the niggly problems keep chipping away at my enthusiasm.
So in that respect, I am going into party-pooper mode and am going to avoid dragging the thread sideways by not getting involved with other discussions for a while. If I don't, this won't get any further than its current state and it ultimately is something I would like to share with people.
So my task for the night ahead, is to reacquaint myself with what I have, reorganise things in a better, more functional manner and then try and deal with the problems one by one. As anyone who has followed my threads before will know, things go through multiple re-writes as I learn new things and then write the code to better implement the new things I learn.
I am a "get it working... then get it working properly" type person... mainly because I don't always know how to do it properly when I start.
I don't always know how to do it properly when I finish either saying that, but there you go.
So hopefully, more progress later...
-
This post is deleted!
-
@ikt said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
If you don't mind, maybe you could open-source it and its development.
I'm not confident enough in my own code to be comfortable with that... I also don't work well with people these days. It is inevitable that if you work in a group, that group begins to think their ideas deserve to be included and that just isn't good for me. I'm too unstable to deal with that.
I'll get it done, it might take me a bit longer but I'm in no rush. All it needs is one good day where I am mentally in a receptive mode and I will get through the things that I am struggling with, that's just how I am.
Anyway... I did some code re-jigging, got things into better State managed processes and I now have it handling burnouts, wheelspin, skidding and normal driving. This is just a short video showing them all in action... I added a static camera so I could demonstrate things a bit better, although as you will see from my excursion into the ditch, it's not always easy to drive at a distance.
It probably doesn't seem like much progress from the first videos but the reality is I haven't done much with it since then. Other things and tiredness have slowed things down... not that I mind the other things, any creating is good creating and I don't put deadlines on the things I create, so it's not a problem.
-
Damn, I'm so eager to get it, get a rally car with realistic handling and go try it down mount chilliad.
...have you taken into account burst tires?
-
@LeeC2202 Looks so cool
Maybe the effect that starts to increase the smoke should be a bit more noticeable? When driffting in the video I could see that it takes a bit more time than it should (at my PoV, of course) to increase the smoke effect.
-
@Reyser At the moment, when you are drifting it is in Burnout mode because I haven't added a way to differentiate a drift from a burnout. A Burnout is initiated with high wheel-speed and low velocity and the transition out of that mode is caused by an increase in forward velocity. A skid is
highvariable forward velocity and a high lateral velocity. But a drift is somewhere in between, so that's another mode to implement.Burnout mode has two phases, a launch phase and then the drift phase. The launch phase is intended to mix my particles with the default ones, so they try and appear as part of the same effect. I don't want the default effects to extend beyond where my effects are... I had that at the very start and it really looked bad.
Skidding had the same delay problem but that was caused by me launching the particles into the wrong mode but drifting needs it's own wheel state rather than a particle state.
Don't worry... this is still only a 3 day old project yet as far as time-spent goes... so far I have only looked at a single burnout video for reference. I looked at a lot more than that for Helicopter Effects, so at some point I will sit down and acquaint myself with drifting... which is going to be hard because I hate drift racing.
@Eddlm Burst tyres... not yet. Shouldn't be too bad because the way this works, is it alternates between left and right wheels for each spawn, to try and ease the load. So it just means a check on the switch and then a rejection if they are both burst. I'll add a #TODO in my code though to remind me of that, thank you.
-
@LeeC2202 Nice work! Can't wait to see it when you get done
-
@ikt said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
@Cyron43
Isn't the entire point of unit testing to be able to test independently from the rest of your platform? You should be able to run some functions fine if they don't use any natives, and for the rest you'd be able to mock functionality if your testing framework supports that.That's right but it would be too much of an effort to mock the game's behavior and the results would be questionable. Memory issues and remarkable FPS drops wouldn't even show. I create unit tests where possible, saving, loading and checking configuration data for example.
The way @LeeC2202 does it is just great and I learned a lot just by watching this video. Up until now I just displayed debug messages for exceptional behavior.
-
@LeeC2202 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
I'm not confident enough in my own code to be comfortable with that... I also don't work well with people these days. It is inevitable that if you work in a group, that group begins to think their ideas deserve to be included and that just isn't good for me. I'm too unstable to deal with that.
Same here.
-
@Cyron43 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
@LeeC2202 said in [SCRIPT] [WIP] - Ground Vehicle Effects (Working Title):
I'm not confident enough in my own code to be comfortable with that... I also don't work well with people these days. It is inevitable that if you work in a group, that group begins to think their ideas deserve to be included and that just isn't good for me. I'm too unstable to deal with that.
Same here.
I think some people think that makes us control freaks but from my perspective, I spent so many years as a commercial artist, where someone else was in control of my ideas, that modding is time for me to be in total control.
Commercial art can be a soul destroyer, as you see idea after idea twisted and stretched into something you didn't imagine. I think sometimes, the conviction you have in your own vision is a major part of completing it... once it starts to become an ours instead of a mine, it starts to lose importance.
Plus my code is pretty damned shameful at times.
-
@LeeC2202 I see that's more complex than expected lol, np. For me in 3 days you did a lot of progress with it 😉
-
@Reyser When I started it and looked through the vehicle properties, I found
Vehicle.IsInBurnout()and I thought "Great... this is going to be easy!" Then while driving down the highway at excessive speeds, I just happened to hit the Brake & Accelerator controls and the game went "Hey, you're in burnout mode" and I thought WTH??So IsInBurnout() is a control based state (in compatible vehicles), not a vehicle state based state... you can actually trigger that state in something like the Military Barracks vehicle, even though you can't spin the wheels. Suddenly, that easy task got more complex... but with complex comes fun.
The annoying side of it, is that you have to reinvent the wheel, to detect the same things that you just know the game is already detecting. That's performance wastage, which is frustrating... especially when you're dealing with particles, which eat performance for fun anyway.
-
@LeeC2202 Yeah I'm following the process and saw your old comments about this. At least, as you said, it's more fun because it's complexity, but sad because the performance impact it can cause to the game (Memory error's commonly). I agree with you 100%.
-
Well, this is turning out to be a one-step-forward, fall backwards down the stairs kinda day.
Have done a large amount of code restructuring to try and make things easier to handle, which is okay. But trying to find the balance between all the permutations of vehicle parameters, so they smoothly change from one state to another is proving tricky, especially as I have added another state.
To help that I have further enhanced the debugging display, so that the lines now display as a different colour based on the state that spawned them. This gives me better feedback about which state is active and how things like spawn rate in those states is working. And that's another thing to add to the mix.
If you have a spawn rate of say 75ms and you are stood still, you get a constant flow of particles. If you have a spawn rate of 75ms and you are driving pretty fast, then that might be too slow and will cause gaps to appear between the spawn point that are too large. So it looks like I am going to have to factor speed into the spawn frequency... on top of everything else.
So just to give an idea of what is currently involved in the process of spawning a particle... as the car is doing a burnout, a point is set at the base of the left or right wheel, depending on which side is active. From that point a material is retrieved, and via a LUT, that material is exchanged for a material structure that contains things like base colour and alpha levels.
If you are driving in a way that isn't classed as a burnout, drift or skid and you are driving over materials that are sandy or dusty, then the turbulence particles get spawned, which are just to try and simulate dust kick-up. Because these need to cover a longer distance behind the vehicle, they are done based on a point between the two wheels, that is randomly shifted left or right on each spawn. In this instance, the material is picked from that spot on the ground, instead of where the wheels are. The means that only a single particle is spawned, so they can cover a longer distance as a trail.
Once that particle is sent into the spawn process, it goes through a variation process that takes a percentage value and calculates a noise modifier... currently up to +/- 15%. The base colour is then modified, which will either lighten or darken the colour by that noise percentage. The base alpha value will be adjusted by that noise percentage, as will the scale value. What that means is that the chance of having two identical particles spawned side by side, is very slim.
The final part of the process takes the wheel state into account. The Spinning state is a high-speed, low traction state, like a burnout. This throws the particles for a set period of time, in a direction opposite to the direction the car is facing (at launch time), at a speed based on the wheel rotation speed. After that period of time, during which the particle is evolving the scale value to grow in size slightly, the particle goes into Drifting state, which is the state Skidding and Rolling launch them in. Skidding and Rolling each have their own unique initial scale values.
Drifting leaves the particles completely at the control of wind speed and direction. All particles that have come from a burnout will transition smoothly between their initial direction and the wind direction, which is what you can see happening when they curve in that prototype video.
You're probably saying "Isn't this overkill for a simple effect?" to which I would say "Of course it is... but simple is what is already there, so overkill is the only option.".
There's probably some stuff like the colour variation that is so subtle, it can go unnoticed but when you sit and watch the last video again, you can really see it in action. The important part is that I know it's happening, so that satisfies my quest for chaos.
And of course, as all that colour data is taken from my Helicopter Effects, it will all need slightly adjusting to reflect a more direct interaction with the ground. Non-dusty surfaces need hardening up colour wise but that's all for later on.
That's probably a boring read but as I have nothing new to show, I just thought I would share some behind-the-scenes info.
