Behaviors Vs Custom

This forum is currently in read-only mode.
From the Asset Store
Vikings VS Skeletons
$10.80 USD
40% off
Side-Scrolling Game "Vikings VS Skeletons" with complete Source-Code (.c3p) + HTML5 Exported.
  • How much faster are the plug-in behaviors? I've been using nothing but behaviors because of the statement "they're optimized in C++", but that's really vague. Even though I choose to do that because I'm in no rush to finish anything, that statement alone could of made me waste a lot of time on them depending on the speed difference. So is there a good speed comparison for say -- A game/cap with 1000 events only custom movement and exact same game with behaviors? Anything above 1.2x-1.5x difference is worth it. Don't have to be a cap, anything hypothetical from someone that knows real speed/code difference is ok.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Probably no difference whatsoever. It's almost certain your application will spend more time rendering than running behaviors or events. Read this (especially CPU/GPU parallelism).

  • I'm going to trust your word on this, but I have to be absolutely sure so I have to point out that this isn't a quick prototype and will take years to complete. I'm getting mixed signal by some of the people having slowed down gameplay due to events (loops). Are you absolutely sure even something large and professional will not lag due to events EVER (besides ridiculous nested loops of course)? It's hard to believe, but I'll trust your word for now.

    Thanks you.

  • If the time of the events being processed is less than the graphics being rendered, the events don't affect the performance at all. In some situations the processing time of events may exceed the rendering time; one of these situations are, as you mentioned, heavy nested loops. However, I'm pretty sure you won't be needing hardcore loops in custom behaviors. Or if you need, the behavior you want is propably so peculiar it isn't implemented in c++ behavior anyway. So, it doesn't really matter, does it?

    Edit: Btw. I recently made a .cap where I replaced the Physics behaviour with my custom physics. It actually improved the performance. (http://www.scirra.com/phpBB3/viewtopic.php?f=16&t=2075)

  • Drasa is right; if your game happens to be really light on rendering, and really heavy on events, then the events will determine the performance of the game. However, I'm sure this is rare, and that most games spend more time on display. You're suffering from premature optimisation though. It's impossible to tell which your game will be until you make it, in which case trying to determine the fastest way is utterly futile. Make your game whichever way suits you best; if it's slow, find out why, and speed that part up (and that will probably be the renderer). You can't usually pre-empt that process.

  • When it comes to keeping your game running smoothly it helps to not go overboard on shaders and other effects.

    If you can make your effects before-hand, you should. Like blurring a sprite in Photoshop before putting it into Construct, rather than using the Blur effect or something. Or using plain old color filters instead of Tint Plus when you can get away with it. Obviously you can't always do this, but just be on the lookout for any place you can cut down on GPU time.

    Plus, while shaders are nice, a lot of people tend to overuse them anyway. Stacking five shaders on a sprite and topping things off with motion blur doesn't necessarily look good. Keep things slim, keep them subtle. A humble looking, yet good playing game is ten times better than a showcase of shader effects that runs really choppy.

    Just my two cents, though.

  • and my two cents: i had an app which would download an array through the http object to a text object. the array was like:

    1,test,100,200;2,test2,200,200;3,test3,250,200;...........;4000,test4000,200,200[/code:3946rl99]
    and after setting the text to a http.response run a loop 4000 times, creating 4000 objects with private variables from the tokenized string (the "1","test","100" and "200" these private variables). This loop lasted about 10 seconds, hanging the game and this was not the http's fault. I'm pretty sure it was the loop's speed.
  • and my two cents: i had an app which would download an array through the http object to a text object. the array was like:

    and after setting the text to a http.response run a loop 4000 times, creating 4000 objects with private variables from the tokenized string (the "1","test","100" and "200" these private variables). This loop lasted about 10 seconds, hanging the game and this was not the http's fault. I'm pretty sure it was the loop's speed.

    Creating the objects would probably be what was hanging it up there. You can create a program to do 10,000 loops upon a key press, but you'll never notice that it did anything.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)