Jump to content

Creating online games in Leadwerks


Eiken
 Share

Recommended Posts

It's very simple actually. You can use a normal Apache PHP server, and send HTTP requests to the server.

For sending HTTP request, you can use for example libcurl ( http://curl.haxx.se/ ), which is very easy to use, for example:

 

/* A multi-threaded example that uses pthreads extensively to fetch

* X remote files at once */

 

#include <stdio.h>

#include <pthread.h>

#include <curl/curl.h>

 

#define NUMT 4

 

/*

List of URLs to fetch.

 

If you intend to use a SSL-based protocol here you MUST setup the OpenSSL

callback functions as described here:

 

http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION

 

*/

const char * const urls[NUMT]= {

"http://curl.haxx.se/",

"ftp://cool.haxx.se/",

"http://www.contactor.se/",

"www.haxx.se"

};

 

static void *pull_one_url(void *url)

{

CURL *curl;

 

curl = curl_easy_init();

curl_easy_setopt(curl, CURLOPT_URL, url);

curl_easy_perform(curl); /* ignores error */

curl_easy_cleanup(curl);

 

return NULL;

}

 

 

/*

int pthread_create(pthread_t *new_thread_ID,

const pthread_attr_t *attr,

void * (*start_func)(void *), void *arg);

*/

 

int main(int argc, char **argv)

{

pthread_t tid[NUMT];

int i;

int error;

 

/* Must initialize libcurl before any threads are started */

curl_global_init(CURL_GLOBAL_ALL);

 

for(i=0; i< NUMT; i++) {

error = pthread_create(&tid,

NULL, /* default attributes please */

pull_one_url,

(void *)urls);

if(0 != error)

fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);

else

fprintf(stderr, "Thread %d, gets %s\n", i, urls);

}

 

/* now wait for all threads to terminate */

for(i=0; i< NUMT; i++) {

error = pthread_join(tid, NULL);

fprintf(stderr, "Thread %d terminated\n", i);

}

 

return 0;

}

 

This example is also multi-threaded, so it doesn't stop your LE main thread while sending/getting HTTP data from the web server.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

What kind of online game were you thinking of making?

 

Also is this your first game or have you made some before? If it is your first I would recommend staying away from online until you have more experience.

 

Also "It's very simple actually." is not actually true. It is actually relatively complex. Not necessarily difficult to send data over a network but making that data work nicely for you is another story.

 

For online games take a single player game and multiply the difficulty by 10 and that will give you an idea..... if by online you mean mmo then multiply that difficulty by 100 instead.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Guest Red Ocktober

i agree... the complexity of the multiplayer logic will definitely depend on what type of game you are making...

 

an online game like words with friends, chess, or checkers will not require the same level of complexity as an online FPS...

 

logic will have to be included to sync the fast paced action across the wires... animation, collisions, smooth movements, etc are issues that will all have to be addressed for shooters and the like that will not be necessary in the latter...

 

the basics of establishing the connection will soon become trivial as the requirements of the simulation increase...

 

my opinion... if you intend to develop a multiplayer game, you should include multiplayer logic into your engine from the very beginning... even if your first versions will be single player only...

 

i also feel that you should determine from the start the structure (where the interactions are going to take place, server only or distributed) as this will affect everything that follows...

 

one final thing... forget the code right now... the code is usually the last thing i do... write out the logic in plain language first... go thru the logic for possible faults... then lay down the code to correspond with the logic that you've come up with... i've found that code that is based on sound logic will usually work, and is easier to understand and debug...

 

--Mike

Link to comment
Share on other sites

We are making MMORPG game.

So, is any programme for server needed? If it is, which one?

And is a lot of programming skill needed to set a server connection? Are there any special server tools in Leadwerks Engine? Which ones?

And which language is the most suitable language for making a MMORPG in Leadwerks?

Thank you all for your help.

Link to comment
Share on other sites

Guest Red Ocktober

sorry... that's beyond my capabilities at the moment... but i think there are a few devs online here that can give you some solid info...

 

good luck...

 

--Mike

Link to comment
Share on other sites

I agree with Rick, no one currently capable of making an MMORPG would be asking such questions. Scale your ambitions right down and learn the basics by developing something far simpler! You will find that challenging enough but can then apply what you've learnt to something more ambitious.

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

We are making MMORPG game.

So, is any programme for server needed? If it is, which one?

And is a lot of programming skill needed to set a server connection? Are there any special server tools in Leadwerks Engine? Which ones?

And which language is the most suitable language for making a MMORPG in Leadwerks?

Thank you all for your help.

Try to make a simple game on this engine. After that you will have no such issues and possible desires, too.

smile.png

низамарачивайся этим двишком...

Link to comment
Share on other sites

It's up to you to combine LE2 and RakNet in a way that suits your needs. Both of them are accessible from C++.

I don't mean to be rude, but not knowing that doesn't put you in a place where you are able to make a MMORPG.

(Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI)

Link to comment
Share on other sites

Thank you!

Is it compatible with Leadwerks Engine?

 

Raknet allows you to send data/receive data over a network. Data is abstract. It's whatever you want to send. If you want to send a position of an LE model then you would get the LE model position and send it's values over the network via Raknet. You aren't sending anything LE specific, just numbers and strings. You have to make the connection between these numbers and strings and how it translates to/from LE.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...