BB3D - StarRadon ONLINE (Aktuell: V0.3)
Übersicht

Dragon2000X |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
xaron wie wärs, wenn wir am internet spiel gemeinsam rumknabbern?? ^^ irgendwie kommsch da net weiter | ||
Dragon2000X |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
So jetzt mache ich, aufgrund von Programmierschwierigkeiten mal den Sourcecode von StarRadon Onl!ne öffentlich. Ich würde mich freuen, wenn ihr dabei folgende Regeln beachtet:
- Bitte den Code nicht als eigenes Programmiertes Stück ausgeben. - Es steckt viel Arbeit darin, also wenn ihr was daraus Benutzt, gebt bitte mein Pseudonym in euren Credits an. - Un die Restlichen Dateien zu dem Spiel zu erhalten, müsst ihr euch unter www.starradon.de.vu (Überseht einfach diese Schreibfehler meines Webmasters und werdet nicht neidisch über die Modellierarbeiten meines Modellers) registrieren und dann erst dürft ihr im downloadbereich StarRadon Onl!ne in der Aktuellen Version runterladen. - Möchtet ihr regulär mitarbeiten, so reicht eine PM bei StarRadon.de.vu an mich und ein Thread im Vorstellungstopic. So und nun gebe ich, exklusiv auf blitzforum.de/forum den Sourcecode zum anschuen und ausprobieren frei: Code: [AUSKLAPPEN] AppTitle "StarRadon Online Client"
Global camx#,camy#,camz#,cammove#,camera Include "nb.bb" Global send_freq=5 Global smoothing=5 Global Ping_time Type frachtobj Field obj End Type Type porter Field obj Field ziel Field dauer Field speed End Type Type schuss Field ssch# Field reich Field mesh End Type Type explo Field mesh Field anzahl Field alpha# End Type Type Info Field txt$ End Type Global erde,gate1,gate2,gate3,gate4 Type Sector Field SecID Field SecName$ Field gatenorth Field gatesouth Field gatewest Field gateeast Field planet Field ownerid Field stationtype1 Field times1 Field stationtype2 Field times2 Field stationtype3 Field times3 Field stationtype4 Field times4 Field stationtype5 Field times5 End Type For secid=1 To 30 ;sec.sector=New sector ; sec.secid=secid Next Graphics3D 640,480,32,2 SetBuffer BackBuffer() ip$=GetIP() Print "Internet-IP:"+ip$ Flip loca = 0 host = 1 If host = 0 And loca = 0 ElseIf host = 1 And loca = 0 ip = "" port = 4000 ElseIf host = 1 And loca = 1 ip = "" port = 4000 EndIf Flip Delay 50 Global mainstream = startnbgame(port) If mainstream = 0 Then RuntimeError("Port besetzt") : End ;And check if it exist Global sendport = 0 Global sendip = 0 send_cnt=1 Repeat pname$=Input$( "Login-Name? " ) Until pname$<>"" Graphics3D 1024,768,32,1 SetBuffer BackBuffer() titus=LoadImage("tex\title2.png") DrawImage titus,0,0 Flip gate1=LoadMesh("tex\gate.x") RotateEntity gate1,0,90,0 gate2=LoadMesh("tex\gate.x") RotateEntity gate2,0,-90,0 gate3=LoadMesh("tex\gate.x") gate4=LoadMesh("tex\gate.x") RotateEntity gate4,0,180,0 ;planet.planeten=New planeten ; planet\obj=LoadMesh("tex\earth.x") ; PositionEntity planet\obj,0,0,27200 ; ScaleEntity planet\obj,310,310,310 ; RotateEntity planet\obj,0,90,0 ; planet\speed=0.31 ; planet\rota=360/((2*27200*3.141592654)/planet\speed) bgm=LoadSound("snd\010105.mp3") LoopSound bgm SoundPitch bgm,40000 SoundVolume bgm,.9 PositionEntity gate1,0,0,3000 EntityFX gate1,4 ScaleEntity gate1,70,70,70 PositionEntity gate2,0,0,-3000 EntityFX gate2,4 ScaleEntity gate2,70,70,70 PositionEntity gate3,3000,0,0 EntityFX gate3,4 ScaleEntity gate3,70,70,70 PositionEntity gate4,-3000,0,0 EntityFX gate4,4 ScaleEntity gate4,70,70,70 camera=CreateCamera(entity) CameraFogMode camera,0 ;PositionEntity camera,x#,y#,z# RotateEntity camera,pit#,yaw#,rol# skycube=CreateSphere(6) skytex=LoadTexture("tex\univ01.jpg") ScaleTexture skytex,0.25,0.255 FlipMesh skycube ScaleEntity skycube,150,150,150 EntityOrder skycube,1 EntityTexture skycube,skytex CameraClsColor camera,255,255,255 ;PlaySound bgm CameraClsColor camera,0,0,0 CameraRange camera,1,300000 sunlight=CreateLight(1) sun=LoadImage("tex\sun.png") cock=LoadImage("tex\m5cock.png") kill=LoadImage("tex\killstats.png") radar=LoadImage("tex\radar.png") options=LoadImage("tex\statsmenu.png") ssound=LoadSound("snd\weapon.wav") PositionEntity camera,1500,0,1500 nebulasprite4=LoadSprite("tex\nebula_f.png") PositionEntity nebulasprite4,15000,0,15000 SpriteViewMode nebulasprite4,3 EntityAlpha nebulasprite4,0.55 ScaleSprite nebulasprite4,15000,15000 sonne=LoadMesh("tex\sun.x") ScaleEntity sonne,450,450,450 sonnenlicht=CreateLight(2) EntityFX sonne,1+2+4+8 erde=LoadMesh("tex\earth.x") ScaleEntity erde,10,10,10 PositionEntity erde,-3000,0,3000 korona=LoadSprite("tex\korona.jpg") ScaleSprite korona,1400,1400 EntityAlpha korona,0.25 m5=LoadImage("tex\m5.png") m4=LoadImage("tex\m4.png") m3=LoadImage("tex\m3.png") m2=LoadImage("tex\m2.png") m1=LoadImage("tex\m1.png") m6=LoadImage("tex\m6.png") ts=LoadImage("tex\ts.png") tl=LoadImage("tex\tl.png") tp=LoadImage("tex\tp.png") plani=LoadImage("tex\plani.png") sun=LoadImage("tex\sun.png") north=LoadImage("tex\gn.png") west=LoadImage("tex\gw.png") south=LoadImage("tex\gs.png") east=LoadImage("tex\ge.png") EntityType camera,1 EntityRadius camera,2 AntiAlias enable looptime#=MilliSecs() Global fpsframe = 0,fpstimer = MilliSecs() Global fps = 0 For fracht.frachtobj=Each frachtobj FreeEntity fracht\obj Delete fracht Next For trans.porter=Each porter FreeEntity trans\obj Delete trans Next ;Schiffe Lade For ist = 1 To 2 ;Hier die anzahl der VERSCHIEDENEN schiffe angeben fracht.frachtobj = New frachtobj fracht\obj = LoadMesh("tex\frachter.x") ;("Frachter"+Str(i)+".x") HideEntity fracht\obj anz = ist Next ;Frachter erstellen For ist = 1 To 45 ;Hier die anzahl der Frachter angeben die herumfliegen sollen ind = Rand(1,anz) anz2 = 0 For fracht.frachtobj=Each frachtobj anz2 = anz2 + 1 If anz2 = ind trans.porter = New porter trans\obj = CopyEntity(fracht\obj) EndIf Next HideEntity trans\obj ind = Rand(1,9) ident = GetIdent(ind) PositionEntity trans\obj,EntityX(ident),EntityY(ident),EntityZ(ident) trans\ziel = ident trans\dauer = 0 trans\speed# = 0.9 ; Hier die maximale transporter geschwindigkeit angeben Next While Not KeyHit(1) TurnEntity erde,0.01,0.01,0.01 For trans.porter=Each porter RotateEntity trans\obj,EntityPitch(trans\obj)+DeltaPitch(trans\obj,trans\ziel),EntityYaw(trans\obj)+DeltaYaw(trans\obj,trans\ziel),EntityRoll(trans\obj) MoveEntity trans\obj,0,0,trans\speed# Next If KeyDown(29) If wenergy > 0 If passtime=>10 wenergy = wenergy - 100 neu.schuss=New schuss neu\mesh=LoadSprite("tex\boomfy7.jpg") neu\ssch#=(0.5+camistmove#) neu\reich=0 RotateEntity neu\mesh,EntityPitch(camera),EntityYaw(camera),EntityRoll(camera) PositionEntity neu\mesh,EntityX(camera),EntityY(camera),EntityZ(camera) PlaySound ssound passtime=0 EndIf EndIf EndIf For neu.schuss= Each schuss If neu\reich => 300 FreeEntity neu\mesh Delete neu.schuss EndIf Next For neu.schuss=Each schuss MoveEntity neu\mesh,0,0,(neu\ssch#+camistmove#) neu\reich=neu\reich+1 Next passtime=passtime+1 Collisions 1,2,2,2 Collisions 1,3,2,2 PositionEntity skycube,EntityX(camera),EntityY(camera),EntityZ(camera) If KeyDown(200) If camx# < 1 camx#=camx#+0.01 EndIf EndIf If KeyDown(208) If camx#>-1 camx#=camx#-0.01 EndIf EndIf If KeyDown(203) If camy#<1 camy#=camy#+0.01 EndIf EndIf If KeyDown(205) If camy#>-1 camy#=camy#-0.01 EndIf EndIf If KeyDown(16) camz#=camz#+0.01 EndIf If KeyDown(17) camz#=camz#-0.01 EndIf If KeyDown(44) camsollmove#=camsollmove#-0.001 EndIf If KeyDown(30) camsollmove#=camsollmove#+0.001 EndIf If KeyDown(14) camsollmove#=0 EndIf If KeyHit(31) If stats=0 stats=1 Else stats=0 EndIf EndIf If camistmove# > camsollmove# camistmove#=camistmove#-0.0005 EndIf If camistmove# < camsollmove# camistmove#=camistmove#+0.0005 EndIf If camx# > 15 Then camx# =15 If camy# > 15 Then camy# =15 If camz# > 15 Then camz# =15 If camstrafe# > 0.1 Then camstrafe# =0.1 If camistmove# > 2.4 Then camistmove# =2.4 If camistmove# < 0 Then camistmove# =0 If camsollmove# > 2.4 Then camsollmove# =2.4 If camsollmove# < 0 Then camsollmove# =0 TurnEntity camera,camx#,camy#,camz# MoveEntity camera,0,0,camistmove#*moveconst# UpdateWorld moveconst# RenderWorld For trans.porter=Each porter If trans\dauer = 0 If EntityDistance(trans\obj,trans\ziel) < 15 HideEntity trans\obj trans\dauer = Rand(50,200) ;Hier Wartezeit auf den Planeten Eintragen EndIf Else trans\dauer = trans\dauer - 1 If trans\dauer = 0 Repeat ident = GetIdent(Rand(1,9)) Until ident <> trans\ziel trans\ziel = ident ShowEntity trans\obj EndIf EndIf Next DrawImage cock,0,0 DrawImage radar,412,435 If stats=1 DrawImage options,112,84 Color 250,250,0 Text 143,190,"Name :" Text 243,190,stype$+" - "+sname$ Text 143,210,"Sektor :" Text 243,210,sector$ Text 143,230,"Schilde :" Text 243,230,shity$+"*"+anzshi Text 143,250,"Energie :" Text 243,250,shield+"/"+3000 Text 143,270,"Hülle :" Text 243,270,hull+"/"+1500 Text 143,290,"Waffen :" Text 243,290,waf$+"*"+wafzehl Text 143,310,"Energie :" Text 243,310,wenergy+"/"+1000 Text 143,350,"Willkommen bei StarRadon Online "+nickname$+"!" Text 143,370,"Derzeitiger Rang: "+rang$ Text 143,390,"Kontostand : "+konto+" Cr" Text 143,410,"Frags : "+killed Text 143,430,"Killed : "+skilled Text 143,450,"Logons/Logoffs : "+times Text 143,470,"Sektoren bekannt: "+sect EndIf Color 255,255,255 If stats=0 drawradarobj(gate1,north) drawradarobj(gate2,south) drawradarobj(gate3,east) drawradarobj(gate4,west) drawradarobj(camera,m5) drawradarobj(sonne,sun) drawradarobj(erde,plani) For trans.porter = Each porter drawradarobj(trans\obj,tp) Next EndIf If shield<3000 shield=shield + Rnd(3000/250) EndIf If wenergy<1000 wenergy=wenergy + Rnd((10)) EndIf If hull<1500 hull=hull+1 EndIf Text 100,100,shield+" "+hull+" "+wenergy Color 215,210,0 Rect 24,144,150/0.9*camistmove#,30 Color 255,0,0 Line (150/0.9*camsollmove#)+24,144,(150/0.9*camsollmove#)+24,174 Line (150/0.9*camsollmove#)+24,144,(150/0.9*camsollmove#)+24,174 Color 0,0,215 Rect 854,144,150/3000*shield,30 Color 0,215,0 Rect 854,174,150/1500*hull,30 Color 215,0,0 Rect 24,174,150/1500*wenergy,30 Flip ;Bewegungskonstante errechnen looptime#=MilliSecs()-looptime# moveconst# = 60/(1000/looptime#) looptime#=MilliSecs() Wend deletenbplayer(mainstream) ;Deletes your player Stopnbgame(mainstream);Before you stop the game (and close the stream) End ;Functions Function GetIdent(I) Select I Case 1 Return erde Case 2 Return erde Case 3 Return gate1 Case 4 Return gate4 Case 5 Return gate2 Case 6 Return gate3 Case 7 Return gate1 Case 8 Return gate2 Case 9 Return gate4 End Select Return 0 End Function Function drawradarobj(obj,meshtyp) Origin 512,535 r#=Sqr( (EntityX(camera)-EntityX(obj)) ^2 + (EntityZ(camera)-EntityZ(obj)) ^2) If r# > 655 Then r# = 655 a# = (DeltaYaw(camera,obj))*-1 If a# < 0 a# = a# + 360 EndIf a# = a# - 45 If a# < 0 a# = a# + 360 EndIf x# = r#*Cos(a#)+r#*Sin(a#) z# = r#*Sin(a#)-r#*Cos(a#) x# = x# / 10 z# = z# / 10 DrawImage meshtyp,x#-(ImageHeight(meshtyp))/2,z#-(ImageWidth(meshtyp))/2 Origin 0,0 Text 2,2,"V0.28.3c" End Function Function explod() End Function Function GetIP$() tcp=OpenTCPStream("max.ernys.de",80) If Not tcp Then Return 0 WriteLine tcp,"GET /ip.php HTTP/1.1" ; Script anvisieren WriteLine tcp,"Host:max.ernys.de" WriteLine tcp,"" WriteLine tcp,0 For i=1 To 8 ; evtl. anpassen, je nachdem wieviel Header gesendet wird trash$=ReadLine(tcp) Next ip$=ReadLine(tcp) ; Die eigentliche IP lesen CloseTCPStream(tcp) Return ip$ End Function ClearWorld Anschließen gibt es noch die NB.bb dazu, das ist die Multiplayer lib. Code: [AUSKLAPPEN] ;NetBlitz, The Ultimate Best System Of Easy UDP, using DirectPlay like commands
;Created By David Dawkins, credit would be nice if you use these functions. ;Current Version: 1.3 ;Special Thanks goes to Surreal for helping me figure out that 'localhost' is diff than '' ;Needed for directplay type commands Type nbplayer Field name$,id$ Field host,ip,port End Type Global serverip,nbmessage$,nbname$,serverport,nbuserid$ Function StartNBGame(port=4000) c = CreateUDPStream(port) dport = UDPStreamPort(c) If dport <> port Then CloseUDPStream(c):c = 0 DebugLog "Created New NetBlitz Game" Return c End Function Function CreateNBPlayer$(name$,sip$,udpstream,hosting=0) DebugLog "Created NetBlitz Player: "+name go = CountHostIPs(sip) ip = HostIP(1) nbname = name n.nbplayer = New nbplayer n\name = name:n\port=nbgameport(udpstream) If hosting = 1 serverip = ip:n\host= 1 serverport = nbgameport(udpstream) EndIf If hosting = 0 serverip = ip WriteString(udpstream,"100:"+name) SendUDPMsg(udpstream,ip,80) ;Delay 1000 CheckNBDataBase(udpstream,0) EndIf CountHostIPs("") n\id= converttoid(HostIP(1),nbgameport(udpstream)) n\ip=HostIP(1) nbuserid = converttoid(HostIP(1),nbgameport(udpstream)) Return nbuserid End Function Function DeleteNBPlayer(udpstream) DebugLog "Deleted NetBlitz Player" For i.nbplayer = Each nbplayer If i\id <> nbuserid WriteString(udpstream,"101:") SendUDPMsg(udpstream,i\ip,i\port) EndIf Next End Function Function StopNBGame(udpstream) DebugLog "NetBlitz Game Stopped" CloseUDPStream(udpstream) End Function Function NBPlayerName$(id$) For n.nbplayer= Each nbplayer If n\id = id Then Return n\name Next End Function Function NBPlayerLocal(ip) CountHostIPs("") If HostIP(1) = ip Return 1 Else Return HostIP(1) EndIf End Function Function RecvNBMsg(udpstream,readm=1) g = RecvUDPMsg(udpstream) If g <> 0 DebugLog "Recieved NetBlitz Message" If readm = 1 nbmessage = ReadString(udpstream) EndIf Return 1 EndIf Return 0 End Function Function NBMsgType(udpstream) typ = Left(nbmessage,3) Return typ End Function Function NBMsgFrom$(udpstream) ip = UDPMsgIP(udpstream) port = UDPMsgPort(udpstream) tempid$=converttoid(ip,port) For n.nbplayer = Each nbplayer If n\id = tempid Then Return n\id Next End Function Function NBMsgData$(udpstream) msg$ = nbmessage index=Instr( msg,":" ) msg = Mid(msg$,index+1) Return msg End Function Function SendNBMsg(typ,msg$,idto$,udpstream) If idto = 0 For i.nbplayer = Each nbplayer If i\id <> nbuserid WriteString(udpstream,typ+":"+msg) SendUDPMsg(udpstream,i\ip,i\port) EndIf Next Else For i.nbplayer = Each nbplayer If i\id = idto WriteString(udpstream,typ+":"+msg) SendUDPMsg(udpstream,i\ip,i\port) EndIf Next EndIf DebugLog "Sent Message: "+msg End Function ;Extra NetBlitz Commands To Make The Internet Easier Function NBMsgTimeOut(milliseconds) UDPTimeouts(milliseconds) End Function Function WriteNBString(typ,texts$,udpstream) WriteString(udpstream,typ+":"+texts) End Function Function SendNBPacket(idto$,udpstream) If idto = 0 For i.nbplayer = Each nbplayer If i\id <> nbuserid SendUDPMsg(udpstream,i\ip,i\port) EndIf Next Else For i.nbplayer = Each nbplayer If i\id = idto SendUDPMsg(udpstream,i\ip,i\port) EndIf Next EndIf DebugLog "Sent Message Packet" End Function Function NBCopyPacket(udpstream,deststream,buffer) CopyStream udpstream,deststream,buffer End Function Function CheckNBDatabase(udpstream,msgtype=1) If msgtype = 0 time = MilliSecs() Repeat x = recvnbmsg(udpstream,1) If x > 0 If nbmsgtype(udpstream) <> 102 x = 0 EndIf EndIf If MilliSecs() - time > 10000 RuntimeError "Timeout Error"+Chr(10)+"Could Not Connect To Server" EndIf Until x > 0 If nbmsgtype(udpstream) = 102 serverport = nbmsgport(udpstream) serverip = nbmsgip(udpstream) ;i.nbplayer = New nbplayer ;i\ip = nbmsgfrom(udpstream) ;i\port = nbmsgport(udpstream) ;readnbpacket(udpstream) ;i\name = nbmsgdata(udpstream) ;i\id = Int(Str$(serverip)+Str$(serverport)) serverid$=converttoid(serverip,serverport) n.nbplayer = New nbplayer n\name = nbmsgdata(udpstream) n\ip = ReadInt(udpstream) n\port = ReadInt(udpstream) n\id = converttoid(n\ip,n\port) While Not Eof(udpstream) n.nbplayer = New nbplayer msg$ = ReadString(udpstream) index=Instr( msg,":" ) msg = Mid(msg$,index+1) n\name = msg n\ip = ReadInt(udpstream) n\port = ReadInt(udpstream) n\id = converttoid(n\ip,n\port) Wend For i.nbplayer = Each nbplayer If i\id = serverid Then i\host=1 : Exit Next For n.nbplayer = Each nbplayer If n\host = 0 And n\id <> nbuserid WriteString(udpstream,"100:"+nbname) SendUDPMsg(udpstream,n\ip,n\port) EndIf Next DebugLog countnbplayers()+" Playing" Return 1 EndIf ElseIf msgtype = 1 ;WriteString(udpstream,"102:TempMessage") ;WriteString(udpstream,"102:"+nbplayerlocal()) Experimenting ;WriteString(udpstream,"102:"+nbname) ;WriteString(udpstream,"102:"+nbgameport(udpstream)) For i.nbplayer = Each nbplayer WriteString(udpstream,"102:"+i\name) WriteInt(udpstream,i\ip) WriteInt(udpstream,i\port) Next i.nbplayer = New nbplayer i\name = nbmsgdata(udpstream) i\ip = nbmsgip(udpstream) i\port = nbmsgport(udpstream) i\id = converttoid(i\ip,i\port) sendnbpacket(i\id,udpstream) Return 1 EndIf End Function Function CountNBPlayers() For i.nbplayer = Each nbplayer bcount = bcount + 1 Next Return bcount End Function Function ReadNBPacket(udpstream) nbmessage = ReadString(udpstream) Return nbmessage End Function Function NBGamePort(udpstream) port = UDPStreamPort(udpstream) Return port End Function Function NBMsgPort(udpstream) port = UDPMsgPort(udpstream) Return port End Function Function NBMsgIP(udpstream) ip = UDPMsgIP(udpstream) Return ip End Function Function CheckAvailPorts() For br = 1 To 10000 c = CreateUDPStream(br) If c <> 0 Exit EndIf Next CloseUDPStream(c) Return br End Function Function NBPlayerPort(id$) For i.nbplayer = Each nbplayer If i\id = id Return i\port EndIf Next End Function Function NBPlayerIP(id$) For i.nbplayer = Each nbplayer If i\id = id Return i\ip EndIf Next End Function Function ConvertToID$(ip,port) s$ = Str$(ip)+"-"+Str$(port) Return s End Function Credits: Stalky13 Für das Transporter-Skript Diesem Forum, für die tollen Vorschläge Dem Blitzbasic.de IRC-Chat, für die viele Codinghilfe und NUN! Viel Spaß mit dem code.[/code] |
||
![]() |
Xaron |
![]() Antworten mit Zitat ![]() |
---|---|---|
Uh... Du hast alles in einer Datei? ![]() Wo genau hängst Du denn, bzw. was klappt nicht? Gruß - Xaron |
||
Cerberus X - Monkey X Reloaded! |
Dragon2000X |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ähm... das sind 2 dateien
probds gibbet beim sektorwechsel und dem internatspiel |
||
![]() |
Xaron |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ja, Internatsspiele haben es schon in sich. ![]() Ich würde den Sektorwechsel erstmal beiseite lassen. Was genau funktioniert denn schon von dem Online-Part? Einloggen? Fliegen? Schießen? Gruß - Xaron |
||
Cerberus X - Monkey X Reloaded! |
![]() |
Xaron |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ist das noch aktuell? Deine Seite ist irgendwie nicht mehr erreichbar...
Gruß - Xaron |
||
Cerberus X - Monkey X Reloaded! |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group