Giter VIP home page Giter VIP logo

Comments (3)

markus-wa avatar markus-wa commented on May 19, 2024

Thanks for the suggestion, but unfortunately I don't understand what you mean.
(The higher goal makes sense but I don't see how your intended solution would look like right now).

Can you rephrase it and/or post the current, slow solution?

from demoinfocs-golang.

quancore avatar quancore commented on May 19, 2024

Aim: As I said, I need to make some game situation checking before or after an event has been occurred (lets named pre/post checking events). Let's say, there is a feature named first kill, which the total number of first kills made by a player each round. In order to a first kill being valid, the killer needs to be survived after 2 seconds of kill event. So, I need to schedule a post checking event 2 seconds after this kill event.
Naive solution: A very naive solution will be a scheduler implementation. There would be a list of pre/post checking events already specified in which ticks they will be executed. On each tickEnd, the scheduler iterates all event list and checks whether an event is needed to be executed. However, the solution will be slow that's because, on each tickEnd, you need to check all listed pre/post checking events.
Proposed solution: What I suggest is that instead, Is there any way to implement these pre/post checking events using generic event you implemented and adding/inserting the parser parsing path. So, when the tick occurs, the parser will dispatch these events just like any other events like kill, death, etc. This will provide enormous flexibility to the user to implement own custom events and these events can be triggered when they are supposed to occur. Another benefit is that the user can use his / her own custom events only registering an event handler (For all ideas, I suppose, I have already known in which tick each pre/post checking event should occur).

from demoinfocs-golang.

markus-wa avatar markus-wa commented on May 19, 2024

I'm not sure if there would really be a too big performance improvement. We could skip the reflection calls needed for TickEnd but that's about it, the rest would be the same implementation as the 'naive' version, just inside the library. It would have the same speed as if you did it yourself.

Or am I missing something?

The lib also used to support custom events in a different way but it wasn't really useful and got removed.

from demoinfocs-golang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.