Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: NPC/AI, How!?  (Read 5774 times)

0 Members and 1 Guest are viewing this topic.

Haikarainen

  • Guest
NPC/AI, How!?
« on: September 12, 2011, 05:40:58 pm »
Hello, I've stumbled across a problem I cant really seem to get my mind around. I'm working on this multiplayer game, It's a sidescroller, with a lot of different maps merging into one world map, where players on one map can only see other players on that same map etc. and they can go to other maps by doors/side edges,  You get the point.

Now this game will have both enemies and NPC's (AI-controlled ofc), wich will interact with the maps regarding collisions etc as well as other players. I get that the server probably is the best "client" for these AI-controlled guys, but that would mean that I'd have to check collisions etc on every friggin map on the server, for every npc/enemy, as well as actually load the maps into memory on the server(wich I do not do atm). That would be very performance-costly and I can't seem to wrap my head around on how to fix this.

Do anyone have an idea on how to fix this? [/quote]

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
NPC/AI, How!?
« Reply #1 on: September 12, 2011, 06:30:21 pm »
Dont know how you would do this but have you created a thread for this game or anything?
It sounds really cool, would like to have a look at what it ill look like

Haikarainen

  • Guest
NPC/AI, How!?
« Reply #2 on: September 12, 2011, 07:19:06 pm »
Quote from: "Richy19"
Dont know how you would do this but have you created a thread for this game or anything?
It sounds really cool, would like to have a look at what it ill look like


Might create a development thread for this since there is interest :) The game when released however will be available for like €5-€10 @ Steam

luiscubal

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
NPC/AI, How!?
« Reply #3 on: September 12, 2011, 08:20:26 pm »
Quote
get that the server probably is the best "client" for these AI-controlled guys, but that would mean that I'd have to check collisions etc on every friggin map on the server, for every npc/enemy, as well as actually load the maps into memory on the server(wich I do not do atm). That would be very performance-costly and I can't seem to wrap my head around on how to fix this.

While I understand that this might be a significant problem in terms of performance, it is generally considered that - at least in other types of programs - one should assume that the client can not be trusted. Otherwise, the games might become too easy to hack(e.g. to have better scores).
I know it might be problematic and I didn't really suggest any solutions, but I thought this is the kind of stuff that needs to be said.

If this risk is O.K. for you(if having a bunch of people artificially inflate their records is no big deal), then go ahead with client-side checks and just perform the minimum required server-side stuff(to avoid SQL injections and friends)

Richy19

  • Full Member
  • ***
  • Posts: 190
    • View Profile
NPC/AI, How!?
« Reply #4 on: September 12, 2011, 08:32:27 pm »
Well if you do make a thread, link it here.
In the mean time do you have any screenshots?

Haikarainen

  • Guest
NPC/AI, How!?
« Reply #5 on: September 12, 2011, 10:42:52 pm »
Quote from: "luiscubal"
text


Yes, i am very aware of that, hence my confusion :P

Haikarainen

  • Guest
NPC/AI, How!?
« Reply #6 on: September 12, 2011, 10:50:22 pm »
Quote from: "Richy19"
Well if you do make a thread, link it here.
In the mean time do you have any screenshots?


Yes, Here:https://legacy.sfmluploads.org/cache/pics/119_noname-test.PNG

Very work in progress.
The brown midgets are going to be replaced(they're just props). Minimap-design is going to be replaced, parallax backgrounds are on their way. etcetcetcetc

Haikarainen

  • Guest
NPC/AI, How!?
« Reply #7 on: September 13, 2011, 04:27:37 pm »
Had an Idea tonight; What if I create a special client that identifies with the server in a special way, and have to have a local connection to it, wich manages all moving AI-controlled parts? On every map that has a player in it,  either threaded(what is a good number for max threads? thinking of limiting playersize to either 16, 32 or 64) it checks for collisions etc.

That way the primary server wont be harrased with pixel-perfect-collisionchecks(i do generate 2dvectors of bools for this though, so its not too heavy), but instead be splitted up into 2 different servers.

Any thoughts on this?