freezes in game

Started by lafouine88, Sat 30/03/2024 23:44:49

Previous topic - Next topic

eri0o

Sure, my repositories are in here: https://github.com/ericoporto?tab=repositories&q=&type=&language=ags+script&sort=

I have to tell I have a lot of difficulties with my own code when it's old. You can't see because I hid but I have a little graveyard of abandoned prototypes that went nowhere and the code is pure nonsense.

Now the ones that I do like of those are probably

https://github.com/ericoporto/dont-give-up-the-cat
https://github.com/ericoporto/galleys
https://github.com/ericoporto/manamatch
https://github.com/VacaRoxa/dogfromhell

If you want to share the sources I could read and maybe try to suggest something

Matti

Quote from: Khris on Mon 01/04/2024 11:29:54The second variant will take even longer.

True, I didn't think straight!  :X

lafouine88

Quote from: eri0o on Mon 01/04/2024 22:07:37If you want to share the sources I could read and maybe try to suggest something

Hi. I tried to reduce the script to the module that seems to be problematic. I marked it so it is easier for you to understand but don't struggle too much on it. Just by looking at the structure of your games I can tell that I'm far from being clean on my architecture and I guess it's going to be a hell to understand :/

Thanks again for all your help and thanks for sharing your games, it's really very helpful oO

Here is the wetransfer link (just a notepad from the selected module) :

https://we.tl/t-S1AI22B5hu

Khris

Here's a pastebin: https://pastebin.com/GcVVzD1U
(wetransfer links only last a week)

lafouine88

Hi guys
It seems I found something. The problem was too many characters were doing the idle/patrolling function :

Code: ags
  for (int i = 0; i < 30; i++) ///30 character ennemies
  {
    if (Region.GetAtRoomXY(character[i].x, character[i].y - ennemis[i].base) == Region.GetAtRoomXY(player.x, player.y - blancplayer)) ////to not waste memory on distant ennemies
    {
      Patrol(i);
      Agro(i);
//...

i reduced a bit my regions but more important the amount of ennemies on it to around 10,and set them all to note solide(which I forgot to do on some of them) and it is now very fluid.
I Guess I underestimated the accumulation of fonctions and should not be too greedy with the memory in the future. I will try to keep it to the minimum.
Thanks again to everybody:)

SMF spam blocked by CleanTalk