[SCRIPT][WIP] Auto-play vehicle spawn and camera preset tool.
So the help screen is in and working... I could have made it pop-up and then pop-off but that's not in my nature. So I opted for the slide-in, slide-out approach, which I like much better. You'll have to forgive it looking stretched, the game wants to draw a 16:9 (1280x720) image but I play in 1920x1200, which is 16:10. There is an aspect-ratio parameter in the
UI.DrawTexture()function, so I'll check that out and see if I can do something with that.
The name shown on the image is probably what I am going to end up calling this mod, unless I can find something that captures the essence in a better way.
I have now also added clockwise and counter-clockwise rotation as mentioned by @Akila_Reigns although it is only in Free-Mode up to now, I have a rotation problem to track down in bone-locked mode.
I added another minor feature last night that allows for a small logo to be overlaid on the screen. It's just something I thought might be useful for anyone taking photos for a mod-group or similar. There will be a default Auto-Snap (now officially the name for this mod) logo included with the mod as a sample image. I will be adding ini file option for corner placement and alpha levels, much like I did for the overlay in the OnFoot camera mod.
I'm also thinking about trying some alternate themes for the help screen, in case my original idea isn't liked by everyone. The layout will be the same, it will just be themed differently. I don't get to do much art these days, so it will give me a nice change of thought-processes. I keep getting the urge to fire Max back up to start building things but I need to get this finished before I do that.
I also had an idea to reinstall my music software to have a go at creating my own music for my videos... they're a bit boring some times without music but it's time consuming, so I might not go that far, not sure yet. It's been a good while since I've written any music of any kind.
So anyway... I digress... on this afternoon's task list...
- Fix the rotation problem in bone-locked mode.
- Incorporate some vehicle validation code to cater for invalid mode names in the vehicle list. Not sure what the result of an invalid name is yet (well, beyond the infinite loading screen that I get at the moment that is. ), so that needs some investigatory work.
- Get the ini file set up and populated.
- If I can get all that done, then I might release a version over the weekend.
I know this has dragged on for a good while now and I know there are skilled/experienced coders probably thinking "Why is this taking so long... it's just a simple camera mod?". As people who have followed my other threads know, coding with an artist's mind has drawbacks... but it also comes with the benefits of attention to detail that I hope make up for it in the long run.
This is a creative tool and as such, that creative workflow has to feel right and that can require lengthy subtle tweaks to get something that does feel right... even if it's for something as simple as a slide-in/out help screen. That's the polish that I believe makes all the difference. Is it too fast, is it too slow, does it decelerate too quickly/slowly etc...
So more updates later in the day... hang in there, it's almost ready.
I am now sure that the problem I am having with rotation in bone-locked mode is a by-product of the
Camera.PointAt()function. If I don't use that, everything tilts and rotates as it should, but the minute I switch that on, everything gets locked horizontally. So what does that mean for this mod? Well basically, if you want to have a tilted view, it has to be done in Free mode... so that's task 1 out of the window.
Task 3 is now completed and the ini file looks like this:
[KEYS] ACTIVATION KEY = F10 GAMEPAD ACTIVATE = TRUE [SETTINGS] SHOW TIME = 3 [OVERLAY] USE OVERLAY = TRUE OVERLAY CORNER = BL OVERLAY ALPHA = 255
I'm not sure how to set an option for the gamepad controls, so I have opted for an option that lets you choose if it does or doesn't work. Default is RB + A, which avoids conflict with any trainers, that seem to prefer RB + X.
SHOW TIME = the number of seconds that the vehicle is shown for. This counts from the moment the screen is fully faded in, to the time it starts to fade out.
OVERLAY CORNER can be either TL, TR, BL or BR, which I think is about as logical as I could make it. If that doesn't seem so obvious, then changing that to Top-Left etc... is easily done.
I think the other 2 Overlay options are fairly self-explanatory. So all this leaves task number 2 on tonight's task list, along with some graphical tinkering.
I really would prefer to have someone try this before I release it if possible, so if anyone's up for that, let me know. The controls are all geared around my preference, which might not be the same as everyone else's, so it would be good to know what I should consider to cater for that.
So this is just another help screen idea I put together tonight... it needs a bit of tweaking but it's an option for the collection.
And in case anyone is wondering... that scale value is correct... based on these presumptions.
I calculated that the main grid squares were 1 inch, the Lambo is therefore 5.5 inches on the paper, the real Aventador is 478cm, which is around 188 inches, making it a theoretical 1:34th drawing scale. Yes, I really can be that anally retentive about details.
Okay... Task 2 is now taken care of and any vehicles that fail to spawn will cause the mod to immediately pull the next one from the list and continue.
Overlay logo seems to be fine in all 4 corners, new help screen looks okay in-game... which does leave me another option. If I could get a few of those help screens, I could store them in a folder with the mod and then choose a random one from the collection each time the mod runs. I'll see how many I can get done before I go down that road.
Shame about the rotation failure but I'll take 2 out of 3 for a reasonably good day's efforts, with a new help screen as well. I suppose I could add some instructional buttons as well, if I learn how to add them that is.
@Frazzlee I need to make a new one with the full feature set in it, I'll try and do that before I finish for the night... I should have already done one, things just seemed to have snowballed all of a sudden.
And out of nowhere, I get a total crash... How on earth can something work, you turn it off to do something else and when you come back, it's broken?
Edit: The worst thing about your memory giving up, is those times when you discover that you did change something (and break something) after all.
@LeeC2202 Happens to me all the time ... Very frustrating sometimes.
@Unknown-Modder Well I'm glad to know I'm not unique in that respect. Honestly, it gets so bad at times, I can make a change, discover a crash that's been caused by it and by the time I get back into the code, I can't remember what the change was. The number of times I have had to scrap several hours work, simply because it's quicker to re-write things than try and find what I changed is unreal.
It's a problem I've always had with coding, it's almost like my fingers type the code but my brain doesn't understand what they're doing. It has made it so hard to learn though because I can't remember what I wrote, never mind what someone else wrote to teach me something.
I think it's because my memory stores images of situations, rather than the details and because code is a constantly changing entity, I can't create those images. Yet I can go back 20 years and remember key stages of artwork I have drawn, or even phone numbers on a page because they're a static image.... strange but unfortunately, very true.
Well last tonight and today are grinding ahead slowly. I had planned on making a new video but that was scuppered last night when I discovered that I hadn't implemented the framerate compensation code into the movement function (despite remembering it previously), so it was moving slowly in my Win 10 install which is locked to 30fps. Trying to add that at 4am last night failed miserably, so the video didn't appear.
Had another go at adding that today and whilst it works better, I'm not happy with it. I think it's going to require a re-write of my movement code. The problem is, each form of input gives back different values and each movement type needs to deal with those values differently. So for example, moving left with a gamepad, is different to a keyboard, which is different to a mouse. Those values also don't translate the same with rotation, so I am modifying values to try and equalise all the inputs. Then you throw the framerate variable into the mix and it gets really messy... or at least, it does in my code.
The underlying cause of all that, is probably my inefficient 3D movement code... that falls into the maths realm, which people already know, isn't my strong subject. By maths I mean calculating rotation angles and movement vectors etc... it turns my brain to mush.
Also fixed a bug with the Motorcycle bone validation and substitution code and added steeringwheel/handlebars into the selectable bone list.
All if this is why I try to spend as much time testing as I do writing. Better that I spend 10 hours testing to find the bugs, than having to respond to them when someone else is unfortunate enough to find them. When I think of how many hours I must have walked round the desert in my onfoot cam, or flying across the desert in my helicopter mod. I've probably racked up more testing hours than most people have playing hours.
Finally managed to get a couple of videos together, I probably should have taken a bit more time with them but I just wanted to get something up and visible. I was also trying to keep them short, whilst trying to show all the features and I still managed to miss some, like the help menu and deleting presets.
The first video shows the camera movement, bone selection, preset creation and time/effect/weather selections and then saving those presets.
The second shows me at a different location, loading the same presets, editing some to better fit the location and then playing them back. They should both give a good overview of how this works and what you can change within it.
While making those videos, I discovered another inconsistency with model bones, this time by R*. A car usually has twin headlights and tail-lights. In my substitution code, if you are showing a motorcycle, it returns what I thought was the one bone they used instead, which was taillight_r... turns out that whilst that works on the Akuma, it doesn't work on the Hexer, so that must be using taillight_l instead.
What that means is that I have to add more code to say "Did we find the taillight_r, if not see if the taillight_l is there instead". Which whilst simple in construction, just adds more code for no other purpose than catering for inconsistent model creation... it's kinda annoying when you know there's no valid reason for it being like that. I'll have to do the same with the headlights, just in case.
It was probably caused by different people doing different models and neither of them communicating with each other... or a producer failing to do what producers are supposed to do... nothing new there then I guess.
@Frazzlee I presume you're talking about the bones... and if so, yes, it can be changed easily but these are vanilla models, so they can't be changed in everyone's game.
I'll just write the code required to deal with it, it's not a problem... just annoying that I have to do it with vanilla content.
So full validation for motorcycles is in now... it caters for wheels, headlights and taillights and other than me chasing my tail because of me forgetting to hit insert when I made some code changes, all seems to work fine.
I do the same thing with ini files... I'll make a change, go into the game, hit insert, notice that nothing is changing, then realise I didn't hit Save in Notepad++ (or I hit F6 to save) to update the ini file.
Seem to have a small bug where the Delete Presets option is staying disabled under certain conditions, so my next task is to chase that down.
All I can do is laugh at myself sometimes... especially when my antics manifest themselves in bizarre bugs. Today's sparkler was caused by my ingenious, yet totally flawed method of dealing with the odd motorcycle bones that have relative offsets. I had the code to check for the X, Y and Z being less than 20... but forgot to add the code to check for them being greater than -20. So I visited a couple of places and had no problems, drove over to Vespucci Beach and my camera was suddenly up in space somewhere. I think my brain was thinking distances and any value less than 20 would work fine... derp!!
Before it suddenly dawned on me, I had made trips along the pier, back to the desert up (and down) several floors of a multi-storey car park... It was only when I switched on the coordinates that I got confirmation of my suspicions.
Good job I can laugh at myself.... along with everyone else probably.
If you're in need for a monkey tester, here's me more than willing...
Sorry, this is just a slightly off-topic post... kind of a bizarre week starter this week. I am beginning to think the house two doors from me is jinxed/cursed or something strange (although the whole estate I live on is allegedly under a gypsy curse... but anyway) Just before my wife died, the guy who used to live there, was found hanging from his loft. Yesterday, the girl who moved in after him was found dead in there and going off the police presence, it seems murder is highly likely. Very odd how one house can attract such events, in what is a relatively short space of time...
But back on-topic...
Sitting here, it occurs to me I have no idea where I am with this mod. This thread has been going two weeks, it's still not released, I'm not happy with the keyboard/mouse input, so I am struggling to find the best solution.
Maybe it's time to throw out a Beta in the thread like I did my helicopter effects mod... does that seem like a reasonable idea?
@ReNNie That would be really useful, I'll put something together for you today. Thank you.
Well it turns out there's a major issue with this in free mode, depending on what kind of terrain you are on when you go into playback mode. Because free-mode is basically just a floating camera with a rotation value applied, there is no guarantee that the vehicle will be in view when you play the preset back. If the camera just happens to end up on a higher patch of ground than the vehicle, it will end up looking straight over the top of the car.
The lock-on modes all work fine, because they have a defined target, so they are always looking at part of the car. So the question is, do I remove free-mode or accept that it has a problem and leave it in? Not sure on that one just yet.
Feeling pretty disillusioned with modding today, so I'm not going anywhere near the code because one false move could result in a shift + delete on the project directory... so it's best left alone for a short while.
@Frazzlee No the ground.
@Frazzlee Yeah... sorry, I had got to the point in the day where I was in intolerant mode and couldn't resist a 3 word reply to your 3 word question. Call it a side-effect of seeing so many "My game is crashing, does anyone know what the problem is?" posts. I think some people think we're mind readers and can tell exactly what they have installed or something.
Yeah, the z-axis is the problem, which as you rightly said, controls vertical height. When I place the camera, I do a ground height check at the location and if the camera would go below the ground, it re-positions the camera a fixed height above the ground. When the camera is locked onto an object, it simply re-points itself to get the vehicle on screen. In free-mode, it can't do that... at the moment.
The main problem, is that in reality, there is nothing forcing the user to point the camera at the vehicle in free-mode, so I can't even say "Is the vehicle visible on screen?" to check anything. I'm not sure what the best solution for this is at the moment. The biggest benefit of this mod is the portability... the biggest downfall of this mod... is portability. That old saying about a rock and a hard-place comes to mind.