Tick and update

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Tick and update

      Hi anyone.

      I have implemented a lot of functionality based on the book. but now i find myself lost and going around in circles.

      I have written a decent sized game in XNA in the past and the source was a big steaming pile by the end, because i didn't really have an architecture to follow and I just jumped in. This was partially due to not knowing where to look for help.

      Needless to say since finding this book found a renewed interest in game development because the concepts are exactly what i needed in my original attempt.

      With that said, my issue is with the onupdate() and ontick() calls. I cannot organise it in my brain. To me i thought they were the same thing.
      I can see that Gameapp.onupdate() calls the ticks event manager and then also calls onupdate for logic.

      Is there any difference conceptually??

      And after this i saw the EvtData_Update_Tick event defined with just one data member, delta time. This lead me to the thought that all subsytems with a vtick() function would register a listener for this event and be called via event handling of EvtData_Update_Tick event. Which sounds good to me. Which just brought me back to my original question.

      And this brings up another question, if i were on the right track with the EvtData_Update_Tick event being handled by subsystems with vtick functions, then where can i find where this event is ever created and sent to the event queue.

      Wow, i've never written a novel before and let me tell you, i''m exhausted.

      Thank you in advance.
    • RE: Tick and update

      I can see why you think this is confusing - when I read your question, at first I didn't remember myself!

      There are two primary mechanisims that can send control to different systems in your game: the CProcess class, and Event senders and listeners. CProcess classes overload the VOnUpdate() method, and event based systems listen for the OnTick event.

      They are named differently only so the programmer can tell them apart - in so far as to know how they are getting control.

      Do a quick search for EvtData_Update_Tick and you'll find it being created RealtimeProcess.cpp and TeapotWarsView.cpp.

      And, don't worry so much about your code becoming a little crazy and disorganized by the end of a project - just try to hold that off as long as possible! Game programming is a messy thing.
      Mr.Mike
      Author, Programmer, Brewer, Patriot