Jump to content
  • 0

Optimizare GM


Weif FTW

Question

4 answers to this question

Recommended Posts

  • 1
  • nu crea string-uri mari, doar 128 de caractere pot fi afisate pe 1 rand in chat;
  • for(new x; x < MAX_PLAYERS; i++) - acest loop va face 1000 de iteratii, chiar daca pe server sunt doar 5 jucatori, foloseste foreach-ul in acest caz;
  • incearca sa inlocuiesti array-urile cu variabile normale, ex: new Float:pPos[3] il poti inlocui cu new Float:pPos1, Float:pPos2, Float:pPos3, nu mereu un cod scris mai urapid e mai eficient decat unul scris mai "greu";
  • opreste loop-urile la momentul potrivit, iti voi da un exemplu din gamemode-ul meu:

image.thumb.png.3200441f4e9bf403f542f5a81c25201d.png

Dupa cate vezi, odata ce jucatorul a intrat intr-un HQ, loop-ul a fost oprit, de ce? Pentru ca daca jucatorul va fi la intrarea/iesirea HQ-ului factiunii cu ID-ul 1 insa am in total 20 de factiuni,  s-ar mai face inca 19 iteratii aiurea.

  • nu mai folosi mysql_query, serverul trebuie sa astepte pana cand este executata interogarea, te poti folosi de mysql_tquery/mysql_pquery - cauta informatii legate de diferenta dintre aceste 2 functii;

  • invata sa scrii corect structura unei interogari deoarece au un rol important cand lucrezi cu mai multe date;

image.thumb.png.3494802db438fa33a6cf4911b94da005.png

Cateva chestii de baza ce te vor ajuta la optimizare modului de joc cat si a timpului de lucru in unele cazuri.

 

Edited by L0K3D
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.