Distance Formulas or Tracking Objects?
Too many fastloops cause slowdown, right?
As well as fastloops within fastloops? At least it seems so in my experience; I might be doing something wrong.
I'm trying to come up with the best, resource-efficient way to define a bunch of "zones" for many different objects that'll determine their attack ranges and sight ranges and the like, and was wondering if it would be better to use a lot of distance formula equations (which seems to be causing the slowdown), or make a lot of oval-shaped, invisible objects to set the range (which will result in more objects in a frame, and with a lot of enemies, that could quickly multiply).
So, the question is, which feature should I use? Or is there a third way to define these RTS type things?
Re: Distance Formulas or Tracking Objects?
Fastloops are fine, just keep them in their own closed group, and open the group when you need it.
Re: Distance Formulas or Tracking Objects?
It's more of like an always occuring thing though. Like when an enemy enters a range of another within 200 pixels or so, and it'll have to choose the closest enemy. What would be a good way of making the group work to be enabled and disabled though?
Re: Distance Formulas or Tracking Objects?
Yep. Fast looping still causes considerable slowdown. Not sure how to go about putting them in activating and deactivating groups.
Re: Distance Formulas or Tracking Objects?
When MMF2 executes a fastloop, it looks for all other On Loop events. Not just the on loop "Current Loop" events. If you have lots of separate loops, even if they aren't occurring, then you get slowdown. If you close the group with the On Loop events, then MMF2 doesn't see it. You shouldn't get much slowdown if you have only the loops you are running at the time activated.
Re: Distance Formulas or Tracking Objects?
Hmm. Yeah, there's definitely a bunch of fast loops, which I've been using to have MMF2 select individual enemies so they'll behave separately instead of as one big group and create erroneous behaviors.
Having removed a good amount of fastloops that I felt were unnecessary, the game runs somewhat smoother. Although I've noticed that the more enemies that are on screen, the slower it goes. I don't mean a large amount of enemies, however. Ten of them, and it works fine. With twenty, things start getting slow. And they're not big enemies either--a little smaller than a desktop icon.
Re: Distance Formulas or Tracking Objects?
You are probably doing too many processes per loop.
Perhaps you can look into LUA and try coding some stuff in there if you want, or ease off on the calculations. I have played with RTS stuff in MMF for ages and deemed it not possible to make a decent RTS game with many units because of the slowdown.
I am looking into SDL which does it no problem, but cbf making a game from scratch at the moment lol
Re: Distance Formulas or Tracking Objects?
May I ask what is SDL in brain leakage terms.
Thanks
Marv
Re: Distance Formulas or Tracking Objects?
It's just a library which c/c++ devs can use to handle most of the drawing and inputs etc. Its also cross platform so you can build apps that work on windows, *nix and mac
Re: Distance Formulas or Tracking Objects?
Re: Distance Formulas or Tracking Objects?
What's LUA?
And yeah, it's looking like that. =( The code is doing exactly what I want it to, but yeah. More than fifteen units anywhere in the frame, and the game slows down drastically... It doesn't even help if I make the object inactive when out of the frame dimensions.
Re: Distance Formulas or Tracking Objects?
I think you should look into both Google and the extension development boards for info on how to learn LUA and what the Object in MMF2 is. ;)
Re: Distance Formulas or Tracking Objects?
Re: Distance Formulas or Tracking Objects?
Maybe check Machine Independent Speed in the properties. This could make the display lag a bit, but the code and workings of it will run fine. It just puts the code priority over the display.
Re: Distance Formulas or Tracking Objects?
Yep. Definitely had that checked.