Author Topic: Server AI  (Read 8318 times)

Tauti

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Server AI
« 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."

devomage

  • Sr. Member
  • ****
  • Thank You
  • -Given: 7
  • -Receive: 67
  • Posts: 250
    • View Profile
Re: Server AI
« Reply #1 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.