Main Menu

ORPG early stages

Started by Makeii Runoru, August 19, 2008, 01:26:11 AM

Previous topic - Next topic

Makeii Runoru

This is the beginning work of an ORPG my group and I are trying to make. We've come up with a few things and right now we're working on how the character should move. I think Jumping is the coolest feature we added so far.

We plan on working with PB and the MultiSync library to send and recieve from Clients<->Server. We'll find a way. Should turn out to be a cool game once it's in beta stages.
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

Adaz

I use Ostrosoft's Winsock component (http://www.ostrosoft.com/oswinsck.asp), and it works perfectly with PB. It supports udp and tcp/ip too. I wrote a simple telnet server, so my clients send simple ascii text messages. Then I expanded it to understand special commands and to send the corresponding responses.
It's an activex component, so it uses PB's activex library. I can send you working PB sample codes if you're interested.

Ádáz

Hungary

Makeii Runoru

Quote from: Adaz on August 19, 2008, 02:37:26 AM
I use Ostrosoft's Winsock component (http://www.ostrosoft.com/oswinsck.asp), and it works perfectly with PB. It supports udp and tcp/ip too. I wrote a simple telnet server, so my clients send simple ascii text messages. Then I expanded it to understand special commands and to send the corresponding responses.
It's an activex component, so it uses PB's activex library. I can send you working PB sample codes if you're interested.
Hmmm...

Well I don't think I have any experience using ActiveX, and I don't think any of my groupmates do either. If it appears MultiSync won't cut the job for us, we can try that. From what I learned, MultiSync is compatable with TCP/IP as well.
This signature is boring, and could be improved. However, the user of this signature doesn't need a fancy signature because he or she doesn't really care for one.

Green7

#3
woot, sorry for hijacking your thread makeii, looks like a solid start btw. but care for a working online client-server code soon, it would ruin your work and ideas if it does not work, as it seems the base for any online game.

@Adaz: can you offer your samble anyway, i'm interested for maybe some upcoming projects, thx!

Adaz

#4
Here it is:



#Include "ActiveX.pba"

Constant cr$ = Chr$(13)+Chr$(10)
Constant crlf$ = Chr$(13)+Chr$(10)

Constant sckClosed = 0 ;connection closed
Constant sckOpen = 1 ;open
Constant sckListening = 2 ;listening for incoming connections
Constant sckConnectionPending = 3 ;connection pending
Constant sckResolvingHost = 4 ;resolving remote host name
Constant sckHostResolved = 5 ;remote host name successfully resolved
Constant sckConnecting = 6 ;connecting to remote host
Constant sckConnected = 7 ;connected to remote host
Constant sckClosing = 8 ;connection is closing
Constant sckError = 9 ;error occured

global objSocket

initsocket()

connectserver()

repeat
  receive()
  ;your game code
  ;your game code
  if something: send("Move 9,4"): endif
  ;your game code
  ;your game code
  ;your game code
  if otherthing: send("Attack Joe"): endif
  ;your game code
  ;your game code
  ;your game code
  ;your game code
  sync
  connected=GetAxIntVar(objSocket,"State")
  If (connected<>sckConnected) And (connected<>sckConnecting)
       ;we are disconnected from server
       CallAxFunc(objSocket,"CloseWinsock")
       ;insert a module here to try to reconnect
  Endif
until leftmousebutton() ;or anything else




psub initsocket()
If RegisterAxDll("oswinsck.dll") = 0
Print "Cannot register oswinsck.dll!"
Sync
WaitKey
End
EndIf
objSocket = NewAx("OSWINSCK.Winsock")
endpsub

Psub connectserver()
ClearAxParams(objSocket)
AddAxStringParam(objSocket,"SERVER IP ADDRESS")
AddAxIntParam(objSocket,PORTNUMBER)
CallAxFunc(objSocket,"Connect")
ClearAxParams(objSocket)
EndPsub


Psub send(s$)
AddAxStringParam(objSocket,s$+crlf$)
CallAxFunc(objSocket,"SendData")
ClearAxParams(objSocket)
EndPsub


Psub receive()
Local s$
Local command$
Local lineend
s$=CallAxStringFunc(objSocket,"GetDataBuffer")
ClearAxParams(objSocket)

If s$="": Return: EndIf

If InString(s$,cr$,1,0)<>(Len(s$)-1)
;carriage return character is not at the end of the line so we received more than one lines in one line
Do
lineend=InString(s$,cr$,1,0)
command$=Left$(s$,lineend-1)
processline(command$)
s$=Right$(s$,Len(s$)-lineend-1)
If s$="": ExitDo: EndIf
Loop
Else
s$=Left$(s$,Len(s$)-2)
processline(s$)
EndIf
EndPsub


Psub processline(s$)
If Left$(s$,15)="Welcome to game"
    ;process response
    Return
EndIf
If Left$(s$,9)="Username?"
  send("Username "+username$)
    Return
EndIf
If Left$(s$,9)="Password?"
  send("Password "+password$)
    Return
EndIf
If Left$(s$,12)="Bad username"
;process response
    Return
EndIf
If Left$(s$,12)="Bad password"
;process response
    Return
EndIf
If Left$(s$,7)="You won"
;process response
    Return
EndIf

;etc
;etc
;etc

cls 0: ink rgb(255,255,255): print s$: sync: waitkey: waitnokey  ;in normal cases this line in not processed
EndPsub

Ádáz

Hungary

LemonWizard

Lol WUT? OMG


Well.. it says "Could not find activex.pba"

strange... I'd like to use this .