About Store Forum Documentation Contact



Post Reply 
Creating MMO
Author Message
Babulesnik Offline
Member

Post: #1
Creating MMO
My plan is to create a bowling MMO.For these purposes, study client / server architecture using TCP.Understanding the code Esenthel MMO's tough for me and it made me a couple of questions.

For a start I need to write client and server on the structure:
1)The client sends a text message entered into TextLine from the server.
2)The server receives and displays the message and sends it to all connected clients.

========Server=======
#include "stdafx.h"
#include "resource.h"
Str incoming_text,test;
SockAddr my_adress;
Connection Server;
/******************************************************************************/
void InitPre()
{
App.name("Server");
App.icon=(Char*)IDI_ICON1;
App.flag=APP_NO_FX;
Paks.add("../data/engine.pak");
D.sync(true);
}
/******************************************************************************/
Bool Init()
{
return true;
}
/******************************************************************************/
void Shut()
{
}
/******************************************************************************/
Bool Update()
{
Gui.update();
Server.data.getStr(incoming_text);
if(Kb.bp(KB_ESC))return false;
return true;
}
/******************************************************************************/
void Render()
{
switch(Renderer())
{
case RM_PREPARE:
{

}
break;
}
}
void Draw()
{
Renderer(Render);
D.clear(TURQ);
D.text (0, 0.1f,S+incoming_text);
Gui.draw();
}
===============================

==========Client==================
#include "stdafx.h"
#include "resource.h"
SockAddr my_adress,Serv_Adress;
Socket sock;
Connection Server;
GuiObjs Menu_Gui;
/******************************************************************************/
void InitPre()
{
App.name("Client");
App.icon=(Char*)IDI_ICON1;
App.flag=APP_NO_FX;
Paks.add("../data/engine.pak");
D.sync(true);
}
/******************************************************************************/
Bool Init()
{
Menu_Gui.load("../Data/Gui/Obj/test_gui.gobj"); Gui+=Menu_Gui;
Serv_Adress.fromText("95.111.152.18:65535");
Server.clientConnectToServer(Serv_Adress);
return true;
}
/******************************************************************************/
void Shut()
{

}
/******************************************************************************/
Bool Update()
{
Gui.update();
if(Kb.bp(KB_ENTER))Server.data.putStr(Menu_Gui.getTextLine("text_line")());
if(Kb.bp(KB_ESC))return false;
return true;
}
/******************************************************************************/
void Render()
{
switch(Renderer())
{
case RM_PREPARE:
{
}
break;
}
}
void Draw()
{
Renderer(Render);
D.clear(TURQ);
D.text (0, 0.1f,S+incoming_text);
Gui.draw();
}

What you need to do to the server to send and receive text messages?
02-21-2011 09:58 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Creating MMO
Hello,

Please don't request support via PM

In the attachment sample tutorial for Connection+ConnectionServer (will be also in next SDK)


Attached File(s)
.rar  Net.rar (Size: 1.45 KB / Downloads: 58)
02-22-2011 09:47 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #3
RE: Creating MMO
(02-22-2011 09:47 PM)Esenthel Wrote:  Hello,

Please don't request support via PM

In the attachment sample tutorial for Connection+ConnectionServer (will be also in next SDK)

Thank you very much and sorry for the post of PM.This sample tutorial really help me.
02-23-2011 02:57 PM
Find all posts by this user Quote this message in a reply
Post Reply