Being playing with some first person stuff today as part of getting to know AC inside and out..
Looking into incorporating my own first person controller and camera rig.
The code seems to be not originally written to be extended... No interfaces anywhere.. and I'd have thought I could have extended and overridden methods in FirstPersonCamera.sc to do my own stuff..
then I found this:
private void UpdateTilt ()
{
if (fpCam && fpCam.GetComponent <FirstPersonCamera>())
{
fpCam.GetComponent <FirstPersonCamera>().SetPitch (actualTilt); <<<<<<<< EEEEEKKKKK!!!!!
}
}
I dont know if during a Unity update this GetComponent was injected automatically and was not cleaned up afterwards...
but it means as it stands a "GetComponent" is being performed every frame! We all know this is a 101 no no. What else is lurking in this code base?
And Char.cs is over 3000 lines long! While I have full respect for what has been achieved here, I worry about how long it can continue with out exploding in on its self...
so, anyway, I got my stuff to work by choosing "Movement method: None". But I'm wondering how many features will now be broke..
Just wondering about other peoples thoughts concerning trying to extend stuff. I get the feeling we shouldn't be trying to extend any of AC's code - we should write our own self contained whatevers and communicate to AC through bridges...
Probably should just put my artist hat firmly back on, pretend I didn't look under the hood...
Comments
It is not, however, called every frame - only when overriding the head tilt using the Character: Face object Action.
AC is designed to be extended non-invasively, through custom events, Actions, overrides, bridge scripts, and by disabling AC systems in favour of your own. Integrating your own player controller by setting the Movement method to None is absolutely the correct way to go about it. Please see the "Integrating new code" chapter of the Manual for more on how to merge your own scripts with AC.
Thanks again for the great support.
AC is a well-established, stable product, with an extensive tutorial system and a committed dev who (as you've already seen) is responsive to bug reports, and who is also open to feature requests so long as they enhance AC as an Adventure Engine and don't lead to feature creep
My personal experience, as very much a sunday afternoon programmer, is that the adopted architecture makes it very easy to extend the system without adversely impacting on its core functionality
As the dude from CinemaSins says, no film is without sin, and no complex computer application is without sin either, so, there will always be some bugs, some non-optimal code, some things that don't quite work how you'd like them to, or haven't been written in the same way that you'd write them yourself, but that's life really
I've got quite a few "roll your own [insert gametype here]" products from the Unity store, and I'd rank this as easily one of the top few, both to use, and also to extend (sometimes in ways that push it way beyond the classic Adventure genre)
I think the best signs of AC being trustworthy is how long its been around, how often its updated and the brilliant support. (and Milk Maid was made with it)
I also do understand what a pain it must be for Asset developers to keep up with Unity's new features.. and keep support for old obsolete ones as well.. VERY draining on resources and moral!
I've been a professional developer for about 30 years.. I do get the feeling most Assets on the store are aimed for the hobbyist who dreams of creating their first game.. nothing wrong with that. I've just been burn't too many times with assets claiming to be of a professional standard - and are no where near.
I am NOT saying that about AC!! I think its one of the best!
@stustk : If you do rewrite the first person stuff and can share things, please do so. I would love to combine AC's first person mechanics with the ability to click on an object and have the Player walk towards it. I must get around to writing this sometime, but if anyone has already done something like this and would share it would be great.
In fact, I suspect Chris could even add this as a new player mode to AC, as I suspect it could be useful to other people also (the current move the head with the mouse and move the player's body with the keyboard arrows is slightly cumbersome for game players).
Is it possible to retrieve a vector for the click spot, which would allow to retrieve clicks anywhere in a scene?