Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

multiplayer game

All about the StoneScript

multiplayer game

Postby siml » 16 Jun 2012, 14:34

hi everyone.
i want to create a client and server.
in my my server game,in the mainAI,in OnInit event, i wrote this code:
Code: Select all
network.createServer ( network.kDefaultServerPort );
log.message ( "server created" );

and in my clent game in OnInit Event i wrote this code :
Code: Select all
network.searchForServers ( 5354 );
this.seraching ( );

this.searching is a state that in Onloop of this i wrote it:
Code: Select all
if(network.getStatus ( )==network.kStatusSearchFinished) then
    network.setCurrentServer (network.getServerNameAt ( 0 )  )
    log.message ( "Connected" )
end

but why log.message ( "Connected" ) never happened. :(
did i miss something?
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby Cheramu » 16 Jun 2012, 16:39

Maybe it is returning "network.kStatusNone"?

http://www.stonetrip.com/developer/doc/api/network-kStatusNone
Cheramu
Senior Boarder
Senior Boarder
 
Posts: 60

Re: multiplayer game

Postby siml » 16 Jun 2012, 16:50

it's returning network.kStatusPending.
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby Cheramu » 16 Jun 2012, 17:06

Are you running 2 shiva editor instances (server and client) on the same pc?
Cheramu
Senior Boarder
Senior Boarder
 
Posts: 60

Re: multiplayer game

Postby siml » 16 Jun 2012, 17:35

yes. i'm running two shiva on one system.
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby siml » 16 Jun 2012, 17:38

shoud i use PLE server or something?
i dont know how networking work in shiva.
please explain to me
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby Cheramu » 16 Jun 2012, 20:04

I used you're code and i get the message connected.

(created one client game and one server game, started the server and after that the client)
Cheramu
Senior Boarder
Senior Boarder
 
Posts: 60

Re: multiplayer game

Postby siml » 17 Jun 2012, 04:55

i'm confused. :(
do you do anything on PLE?
or did you do anything else?
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby Cheramu » 17 Jun 2012, 09:04

Did not do anything else, if you post you're 2 games exported to ste i can try that.
Cheramu
Senior Boarder
Senior Boarder
 
Posts: 60

Re: multiplayer game

Postby siml » 17 Jun 2012, 15:35

this my simple sample game
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50

Re: multiplayer game

Postby Cheramu » 17 Jun 2012, 17:42

Works for me Shiva Editor Web Edition version 1.9.1. Can't help you further.
Cheramu
Senior Boarder
Senior Boarder
 
Posts: 60

Re: multiplayer game

Postby siml » 17 Jun 2012, 18:31

thanks a lot.
you helped me my dear :)
User avatar
siml
Senior Boarder
Senior Boarder
 
Posts: 50


Return to Game programming