About Store Forum Documentation Contact



Post Reply 
how can be AI be created in the server
Author Message
1991mirec Offline
Member

Post: #1
how can be AI be created in the server
hello

I would like to ask if it is possible to create AI in the way that everyone who connects to the server will be able to see the exact same position and movements, animations of the AI on their computers. We made it to work for the client but everyone who connects will have his own AI and if I kill it on my computer nobody else can see it beacuse they have their own AIs.

I am the C++ coder for the game exiled dimensions. I am still beginer and i am learning i have some experiences with C++ but very little with esenthel engine.

Thank you.
05-29-2013 09:23 AM
Find all posts by this user Quote this message in a reply
Scarlet Thread Offline
Member

Post: #2
RE: how can be AI be created in the server
I'm assuming by AI you mean NPC..

Well the answer is: the NPCs need to live on the server and not the clients. In fact everything that is not static / constant should live on the server and the server should tell the clients what to do. If the NPC dies on the server the server tells all the clients and it dies on all the clients..

The players should be like this to.. Player does an action -> a request is sent to the server -> the server performs the action for that player (if permitted) -> applies the damage to the NPC -> The server then notifies all the clients... This way everything keeps in sync.

This is an extremely simple overview of the topic. TBH I haven't used the networking capabilities of EE yet and it probably makes all of this easier... but I know from my experience with Networking games that this is how it generally works. Of course there are tricks you need to do to make things smooth and to hide latency issues. I'm assuming EE already has some measures in place for it since it's mmo capable. However, I wouldn't know...
05-29-2013 03:39 PM
Find all posts by this user Quote this message in a reply
TheElk Offline
Member

Post: #3
RE: how can be AI be created in the server
We sure could use some help on this.

and Scarlet yes you are correct on how it should go. but we can't figure out how to place them in the world using the server end.

Thank you
05-29-2013 08:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
RE: how can be AI be created in the server
Have you guys looked at this: http://www.esenthel.com/community/showth...p?tid=5826 ? If it's not compiling, it should be relatively easy to make the adjustments to get it working.
05-29-2013 08:53 PM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #5
RE: how can be AI be created in the server
well i ve seen it and it didn t really helped us.. we tryed tu put in exactly as it was there with some little adjustments to our game and it still didn t work
05-30-2013 10:12 AM
Find all posts by this user Quote this message in a reply
gwald Offline
Member

Post: #6
RE: how can be AI be created in the server
@1991mirec really? Rubeus is right, Did you try Flex's code? you should download TBJoker's projectX and understand it.
"Thank you TB Jokers, this saved me a lot of time and thought. I have made it work with my mod built over Ineisis:"
http://www.esenthel.com/community/showth...1#pid36351
05-30-2013 10:24 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #7
RE: how can be AI be created in the server
i was thinking more if I can create NPCs in the server and the send it to client through the shared folder. or something like that.. so i don t have to create it in the client at all...
06-04-2013 03:04 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #8
RE: how can be AI be created in the server
My example demonstrates how to create Artificial Intelligence on the Server and linking them to the Client so that the Server is in charge of every move. Sending via Shared folder? I have no idea what you mean by that. You can use my example to get an Artificial Intelligence just like in any other game. You have to create the monsters on the client else they just wouldn't show, or they just wouldn't exist.
06-05-2013 12:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #9
RE: how can be AI be created in the server
ok thx... i ll do my best...
06-06-2013 09:54 AM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #10
RE: how can be AI be created in the server
hey i have another question here
when i am creating ai in the server as it is shown in here->

REP(20)ai.New().createAI(i,"Warrior","Obj/Chr/Warrior/0.obj",Vec(RandomF(0,20),RandomF(0,20),RandomF(0,20)),10);

can somebody tell me what is the third think in the function?? is it the path from your computer?? or is that string somewhere in the program and i need to copy and paste that path... if it makes sence at all.. sorry for my language guys i am from slovakia and sometimes it is hard for me to explain some things.. i know that the second thing in function is string for name. and it find from parameters of AIs but what can i put as a third thing. can somebody put me on a right spot here?? please?? thanks in advance
06-10-2013 03:57 PM
Find all posts by this user Quote this message in a reply
Rofar Offline
Member

Post: #11
RE: how can be AI be created in the server
That code would be for version 1. I assume you are working with version 2.0? In version 1, that parameter would be the path relative to your Data path. In 2.0, that would most likely have to be changed to use the asset UID.
(This post was last modified: 06-10-2013 10:51 PM by Rofar.)
06-10-2013 10:50 PM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #12
RE: how can be AI be created in the server
yes i have 2.0 version.and thank you it helped me but now i struggle again.
so what you re saing is that the second parameter should be uid thing so i just have to drag and drop the AI (NPC) in there and then have to set other things for UID. but when i am creating it in client how do i change it please??
in the old one it was string so it was like this:


void AI::spawn(Str name, Str obj, Int id, Vec pos){
Game::ObjParams obje; obje.load(obj); obje.scale(true, scale);
super::create(obje); //Create the object.


and now i done something like this(check below) and i am not sure if it s ok..


void AI::spawn(Str name, UID obj, Int id, Vec pos){
Game::ObjParams obje; obje.type(true, obj); //obje.scale(true, scale);
super::create(obje);

sorry for the basic question. i am trying to do my best.. it wants to creat it when i run game but before it loads it gives me an error something like this "attempting to create a character without Mesh"...
any advice?? thank you in advance
06-13-2013 09:32 PM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #13
RE: how can be AI be created in the server
Hi 1991,

You need to make a few very small changes for the 2.0 to work. I have posted my 2.0 code in the main thread:

http://www.esenthel.com/community/showth...6#pid40696
06-14-2013 08:10 AM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #14
RE: how can be AI be created in the server
hi thank you... it worked and i have them spawned but they always fall through the ground. why is that??
and shouldn t they be created into the world when spawning? because it creates them for me only if there is a move function.. without it it doesn t creat any ai.. do you know why is that?? thank you
06-20-2013 01:00 PM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #15
RE: how can be AI be created in the server
Hi 1991,

Sorry I don't understand your question. They spawn on the server and are pushed to all clients. Not sure what you mean by they spawn only for you. With the falling through the ground thing, maybe the model you are using does not have a physics capsule? You probably have a typo. I would suggest re-reading the main thread and my post and going from there.
06-20-2013 01:51 PM
Find all posts by this user Quote this message in a reply
Post Reply