Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: Tauti on June 15, 2015, 09:57:01 PM

Title: Server AI
Post by: Tauti on June 15, 2015, 09:57:01 PM
Hi all, how to organize the logic of AI on the server. For example, every 10 minutes the server sends a message to all "Hello world."
Title: Re: Server AI
Post by: devomage on June 15, 2015, 11:00:20 PM
look at this code within ServerMain.cs:

add a custom packet and send desired data to a channel.

  1. // Save periodically
  2. mSaveThread = new Thread(delegate(object obj)
  3. {
  4.         for (; ; )
  5.         {
  6.                 Thread.Sleep(120000);
  7.                 if (mGameServer != null) mGameServer.SaveTo(mFilename);
  8.         }
  9. });
  10. mSaveThread.Start();
  11.