Forum rules - please read before posting.

Starting to get a little worried/disappointed about customising stuff...

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

  • edited May 2018
    You're correct of course about the GetComponent being a no-no.  Rest assured it'll be addressed in the next release.  I apologise for its presence, but when something like this is spotted I do take the necessary steps to remedy it.

    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 very much for the speedy response, I'll stick to using built in stuff for now (theres certainly enough!) and just enjoy constructing some puzzles.. after all thats the idea of buying AC!

    Thanks again for the great support.


  • edited May 2018
    Speaking as a relative newcomer (to the forum, although not to Unity or AC), I'd say you've got very little to be worried and/or disappointed about

    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)
  • Thanks for your input, I do believe AC ranks as one of the best Assets out there, I've tried a fair few as well... and yeah you've got to forgive little mistakes here and there.. as I do. 

    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!






  • I think that depending on what type of game you're trying to create, combining AC with Playmaker and writing an occasional new action for either of the packages when something is missing is a great combination. Much better than writing things from scratch, even if you can. 

    @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).
  • @wmsvga: Direct movement control over the player is optional in first-person - if a Hotspot interaction or ActionList involves moving the player, it'll occur automatically.
  • Chris, how would you go about making this more generic? I mean, I know you can have the player move to objects which have an associated hotspot, but how would you allow for moving down an alley for example?

    Is it possible to retrieve a vector for the click spot, which would allow to retrieve clicks anywhere in a scene?
  • edited May 2018
    You can use the Character: Move to point Action to have the player move to an arbitrary spot, but with custom scripting you can have him go anywhere by calling his MoveToPoint method.

    You can calculate a click spot vector by using raycasting - the same technique that AC uses in PlayerMovement.

    If you switch your Movement method to None, but drop your Player prefab into the scene file so that you can assign his FirstPersonCamera as the scene's default, then you have full control over his position using these techniques.  You also have the ability to implement a totally custom motion controller - see the "Custom motion controllers" chapter of the Manual.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.