skip to Main Content

I am currently in the planning stages of a game for google app engine, but cannot wrap my head around how I am going to handle AI. I intend to have persistant NPCs that will move about the map, but short of writing a program that generates the same XML requests I use to control player actions, than run it on another server I am stuck on how to do it. I have looked at the Task Queue feature, but due to long running processes not being an option on the App engine, I am a little stuck.

I intend to run multiple server instances with 200+ persistant NPC entities that I will need to update. Most action is slowly roaming around based on player movements/concentrations, and attacking close range players…(you can probably guess the type of game im developing)

3

Answers


  1. Will your game be turn based or real time?

    Either way, I think you have 2 options to look into. One is to use the Cron feature so you can schedule NPC updates at regular intervals, the other is to stick a “update NPCs” task into the Task Queue every time a human player moves.

    Login or Signup to reply.
  2. If the game is turn based then it would probably be best to avoid the Cron task and just update the NPCs every time the player moves. I’m not sure how big of a map you are planning on but you may consider even having the player object find the NPCs that are close to it and call their AI routine. That way NPCs that are out of range of a player wouldn’t move at all which may save on resources. Not sure if that matter though.

    Login or Signup to reply.
  3. Bear in mind that you can also break up your updates into multiple requests (internally): do a bit of work, redirect to the same handler but different state; do more work; etc. (I’m failing somehow to comment on Peter Recore’s answer, which is where this really belongs.)

    I see that the free service only allows 100k task queue calls/day, so 1 task/NPC would probably use up your resources way too fast. Cron job to do some work/create task queues to update NPCs in appropriately-sized groups?

    Anyway, just some thoughts; good luck.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search