Sign in to follow this  

mmorpg server

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

now, i know you receive tons of those and I did read the F.A.Q. first... I know how to make games, but I lack experience with server related abilities. I am pretty sure the guy in my team in charge of the server can make it adapt to the easiest way but what I mainly want to do is pass my local variables (in each clients) so that they're public (at the server instead). I am using Dark Basic Pro and I am therefore wishing to : a ) set up a connection appropriately b ) use the server as the central memory instead of each computer (you might have guessed this because the title of this topic mentions MMORPG) The problem is that I have no clue on how to set up the connection and the language help files aren't so sophisticated about it. According to the help file, it takes a single line to fetch a matching server, but the server *needs* to exist in the first place. Am I supposed to : A) put a certain Dark Basic Pro program on the server and run it from there so that is it considered as the target of connection. B) Use my client to call the server and retrieve files there C (???) thanks for helping me or gearing me to the appropriate ressources because my searches were vain...

Share this post


Link to post
Share on other sites
Dark Basic Pro is not the language of choice for most online games, so I wouldn't count on there being a large community of people who can give answers specific to that environment.

Anyway, I'm not sure you read this link from the Forum FAQ.

If you can read that, and then come back with a clearer and more concise question, someone might be able to answer it.

Share this post


Link to post
Share on other sites
guess I didn't make myself clear huh? Well thanks for not flaming me at least... many communities would've... In fact, I *have* found a good starting basis and, somewhat, Dark Basic Pro is perfectly suited for my game project (though not necessarily really as strong as C would).
I have found how to set up a connection and host connections on a server, therefore, you can count this topic as closable.
On the other hand, if anyone wishes to have any details on how I managed to get the answer, a e-mail is a nice way to ask... I know several people have attempted to make a mmorpg and weren't lucky enough to receive appropriate help. I think gamedev is one place about support, therefore, I'll happily give some tutorials for making it if asked.

Share this post


Link to post
Share on other sites
I didn't say you can't do it in Dark Basic, just that most of us don't seem to use it. If you do, and know how to host and connect in that environment, i e you found the answer to your own question, it would be appropriate to summarize the answer in your thread, so others who search (two years from now) will find it. References to a few specific function names or whatever should be sufficient.

Share this post


Link to post
Share on other sites
perform checklist for net players

for ob=1 to checklist quantity()
load object "FallenMadonnaWithTheBigNose.x",ob
if checklist string$(ob)=localPlayersName$ then player=ob
next ob

if upkey() then move object player,1


--------
Rem Project: MMORPG
Rem Created: 9/29/2002 3:54:01 PM
sync on : sync rate 80 : draw to back
cls rgb(150,40,80)
get image 1,0,0,30,30
cls rgb(150,0,0)
get image 2,0,0,10,100
cls rgb(0,0,150)
get image 3,0,0,10,100
cls rgb(0,0,0)

rem Start net game
PlayerNumber=default net game("gamename","playername",4,1)
if net game exists()=1

rem Show name of player as Window Title
if PlayerNumber=1
set window title "HOST Player "+str$(PlayerNumber)
else
set window title "CLIENT Player "+str$(PlayerNumber)
endif
SET CAMERA VIEW 0, 0, screen width(),screen height()-100
make object cube PlayerNumber,40
position object PlayerNumber,0,6,20
color object PlayerNumber,rgb(150,0,0)
make matrix 1,500,500,10,10
rem Main loop
make memblock 1,8
make memblock 2,8
Health#=100
Magic#=100
sprite 1,0,0,2
sprite 2,30,0,3
text$ = ""
finaltext$ = ""
chatmode = 0
set text opaque
ink rgb(150,0,0),rgb(0,0,0)
do
text 0,screen height()-20,chat$
IF KEYSTATE(63) THEN chatmode = 1
IF KEYSTATE(66) THEN chatmode = 0
IF chatmode = 1
GOSUB CheckInput
TEXT 0,screen height()-90,"Press F8 to exit chat mode"
TEXT 0,screen height()-80,text$+"[]"
ELSE
TEXT 0,0,"Press F5 to enter the chat mode"
ENDIF
gosub CheckInput
gosub handle_player
gosub handle_others
rem Update and/or Quit key

sync : if escapekey()=1 then exit

loop

rem End net game
free net game

else
do : cls 0 : center text 160,113,"COULD NOT CREATE NET GAME" : sync : loop
endif

handle_player:
`CONTROLS
if leftkey()=1 then position object PlayerNumber,Object Position x(PlayerNumber)-1,6,object position z(PlayerNumber)
if rightkey()=1 then position object PlayerNumber,Object Position x(PlayerNumber)+1,6,object position z(PlayerNumber)
if upkey()=1 then position object PlayerNumber,Object Position x(PlayerNumber),6,object position z(PlayerNumber)+1
if downkey()=1 then position object PlayerNumber,Object Position x(PlayerNumber),6,object position z(PlayerNumber)-1
write memblock word 1,0,object position x(PlayerNumber)
write memblock word 1,2,object position z(PlayerNumber)
Combined#=MEMBLOCK DWORD(1,0)
send net message integer 0,Combined#
position camera object position x(PlayerNumber),40,object position z(PlayerNumber)-70
point camera object position x(PlayerNumber),6,object position z(PlayerNumber)
`STATS
scale sprite 1,Health#
scale sprite 2,Magic#
return

handle_others:
rem Draw Others
get net message
while net message exists()=1
PositionValue=net message integer()
OtherNumber=net message player from()
write memblock dword 2,0,PositionValue
OtherX#=memblock word(2,0)
OtherZ#=memblock word(2,2)
if object exist(OtherNumber)=0 then make object cube OtherNumber,40
color object OtherNumber,rgb(0,0,150)
position object OtherNumber,OtherX#,6,OtherZ#
get net message
endwhile
return


CheckInput:
oldkey$ = newkey$
newkey$ = INKEY$()
IF KEYSTATE(14)
IF LEN(text$) > 0 THEN text$ = LEFT$(text$,LEN(text$)-1)
ELSE
IF RETURNKEY()
IF text$ <> "" THEN finaltext$ = text$ : text$ = ""
send net message string 0,finaltext$
ELSE
IF newkey$ <> oldkey$ THEN text$ = text$ + newkey$
ENDIF
ENDIF
get net message
chat$=net message string$()
if chat$<>""
text 0,screen height()-20,chat$
m#=len(chat$)
get image 4,0,screen height()-20,m#*8,screen height()-5
sprite 3,0,screen height()-30,4
endif
RETURN
--------

server:

Quote: "rem this command connects you to your own computer with a tcp/ip connection
rem "127.0.0.1" is the address to connect to your self
rem the number 3 is a tcp/ip connection
set net connection 3,"127.0.0.1"

rem this create's a network game and you are the host computer
rem "game1"=name of game
rem "host"=Name of player
rem 2 means a client host game that means it sends information to a server which
rem which then sends it to all the clients
create net game "game1","host",2

rem for fun this prints connected when you connect.
print "connected"

rem start a simple loop
do

rem this is an input command so you can send information over the net
input "type: ",txt$

rem this command sends a some text information across the net connection
send net message string 0,txt$

rem this command is collecting any information that may have been sent to the computer
get net message

rem this command makes text$ have the same value as the string sent over the net
text$=net message string$()

rem this command reads the text$ to make sure it has some text in
if text$>""

rem this command prints the text$'s text.
print text$

rem this ends the if command
endif

rem this ends the loop
loop"
Client:

Quote: "rem ---------------------------
rem This makes a net connection.
rem number 3 means tcp/ip connection.
rem the "127.0.0.1" is an ip address which connects you to your own computer
set net connection 3,"127.0.0.1"

rem the next command allows you to join the game one the net connection
join net game 1,"client"

rem for fun this will tell you that you are connected after it has connected
print "connected"

rem a simple loop
do

rem this is an input command so you can send information over the net
input "type: ",txt$

rem this command sends a some text information across the net connection
send net message string 0,txt$

rem this command is collecting any information that may have been sent to the computer
get net message

rem this command makes text$ have the same value as the string sent over the net
text$=net message string$()

rem this command reads the text$ to make sure it has some text in
if text$>""

rem this command prints the text$'s text.
print text$

rem this ends the if command
endif

rem this ends the loop
loop"

------

hide mouse

print "SEARCHING FOR NET CONNECTIONS..."

rem Get a list of net connections
perform checklist for net connections
cls

rem **Print a list of all possible connections
rem **and let the user choose one
print "[ ",checklist quantity()," ]NET CONNECTIONS FOUND"
for x=1 to checklist quantity()
print x,". ",checklist string$(x)
next x
print checklist quantity()+1,". EXIT"
input connection

rem **If the choice is greater than the number
rem **of choices than end the program
if connection=checklist quantity()+1 then end

print ""
print "Enter additional connection info"
print "such as IP address of phone number"
print ""
print "(Leave blank if not needed)"
input info$
cls

print "SETTING CONNECTION..."

rem set net connection
if info$="" then set net connection connection
if info$>"" then set net connection connection,info$
cls

print "SEARCHING FOR NET SESSIONS..."

rem check for any current chat rooms
perform checklist for net sessions
cls

rem **Print a list of all current chat rooms
rem **and let the user choose one or create one.
print "[ ",checklist quantity()," ]CHAT ROOMS FOUND"
for x=1 to checklist quantity()
print x,". ",checklist string$(x)
next x
print ""
print "1. Join"
print "2. Create"
print "3. EXIT"
input choice

if choice=3 then end
print ""

if choice=1
input "Join which chat room: ",room
input "Type in a name: ",name$
join net game room,name$
endif

if choice=2
input "MAX number of people allowed: ",num
input "Session name: ",sname$
input "Enter a name: ",name$
create net game sname$,name$,num,1
endif

rem **set the title of the window to
rem **the users name
set window title name$

dim messages$(15)

ink rgb(15,100,255),rgb(15,100,255) : m$="^"+name$+" has joined the conversation."
messages$(1)=m$
m=1
send net message string 0,m$
m$=""
bm$=""

clear entry buffer

do
cls
ink rgb(255,255,255),rgb(255,255,255)
perform checklist for net players
for x=1 to checklist quantity()
text 500,x*10,checklist string$(x)
next x


get net message
message$=net message string$()
if message$>""
m=m+1
if m>15
for x=1 to 14
messages$(x)=messages$(x+1)
next x
m=15
endif
messages$(m)=message$

endif

m$=entry$()
text 10,400,m$
if returnkey()=1
c$=left$(m$,1)
if (c$="^" or c$="|" or c$="%")
me$=c$+name$+": "+m$
else
me$=name$+": "+m$
endif
m$=""
m=m+1
if m>15
for x=1 to 14
messages$(x)=messages$(x+1)
next x
m=15
endif
messages$(m)=me$
send net message string 0,me$
clear entry buffer
repeat
until returnkey()=0
endif

for x=1 to m
a=0
m$=left$(messages$(x),1)
if m$="^" then ink rgb(15,100,255),rgb(15,100,255) : a=1
if m$="|" then ink rgb(15,255,100),rgb(15,255,100) : a=1
if m$="%" then ink rgb(255,60,60),rgb(255,60,60) : a=1
if (m$="^" or m$="|" or m$="%")=0 then ink rgb(255,255,255),rgb(255,255,255) : a=0
if a=1
c$=right$(messages$(x),len(messages$(x))-1)
text 10,x*20,c$
else
text 10,x*20,messages$(x)
endif
next x

m$="^"+name$+" has left the conversation."
if escapekey()=1 then send net message string 0,m$

loop


That's a condensed code snippet to read from. If you get around each line, you understood the basics of a server related app in Dark Basic pro and can make something froma chatroom to a mmorpg server, even including how to make a rotative server when you don't want to make the app for the server (in which case you take a random plyer to act as the temporary host, or permanent if he never leaves and acts like a bot).

Share this post


Link to post
Share on other sites

This topic is 4726 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this