|
Post by Wayne Rayner on May 3, 2009 6:43:44 GMT -5
Ok I have finally decided and I hope I can maybe create a virtual chat room sort of thing like habbo. I mean noting like the size of habbo but similar way, where u create rooms and add objects. Anyways would this project be eaiser than a 3D game?
If it is going to be easier i'm going to make it just for me and other people who wants to play it.
Also this next question is a little more difficult to be answered but I hope someone can answer it.
Can u use Adobe Shockwave or something like that with B4Gl?
Thanks to everyone in advance for any help Wayne Rayner
|
|
|
Post by matthew on May 3, 2009 6:57:38 GMT -5
A chat client would probably be easier to create than a 3D game, adding some simple graphics wouldn't be that difficult either.
I doubt very much if you could use Shockwave with Basic4GL as it's a Commercial application but there might be an Open Source alternative that you could use through a Plugin.
|
|
|
Post by Wayne Rayner on May 3, 2009 7:02:08 GMT -5
Ok then I will make a 2D Virtual chat client.
Can u use a program similar to shockwave like as a network engine or something like that, hopefully u know what I mean
Also I will have simple graphics for hair and stuff, but I don't know what program could make these sorts of graphics and I don't feel like using a modeller and I don't really want to use photoshop or equivelents, can anyone help me on this?
|
|
|
Post by matthew on May 3, 2009 7:41:13 GMT -5
I doubt it, you'll need to write the code in Basic4GL. As for the graphics, crazynate has a sprite wiki here. Maybe you could get him to design some sprites for you?
|
|
|
Post by UNDISCLOSED on May 3, 2009 9:57:52 GMT -5
I am thinking about making a DLL that downloads files off the internet but this could take a while (for me anyways ) I will post a link to it here if it helps you at all.
|
|
|
Post by Darkjester on May 3, 2009 11:49:14 GMT -5
start just writing code! and develop from that, or right down all your ideas on paper and break down a large program into simple things that you think you can code and go from there. -darkjester
|
|
|
Post by crazynate on May 3, 2009 15:10:47 GMT -5
i could help with making custom graphics, smileys, etc ill try making a simple program where the user can create an avatar
|
|
|
Post by crazynate on May 3, 2009 19:36:59 GMT -5
|
|
|
Post by dw817 on May 4, 2009 7:05:17 GMT -5
Hi CrazyNate: * Tried out your Avatar Creator. Really interesting ! You could also use that to create Anime Persona for RPGs (where it shows the face in the left-hand corner of the text when they are talking). Can you add some female attributes like lips, hair, eyes, etc since not all charas in a RPG or Avatar are male. Additionally, tried out your PixelStudio. Noticed you used an interesting way to turn OFF the mouse-cursor: mouse_xd() , no DLL needed ! Matthew: * Can you write a Chat Client w/source in current B4GL ? I think others would be interested to see that.
|
|
|
Post by James :) (aka Madcow) on May 4, 2009 10:20:23 GMT -5
you can write a chat client, an example of one is myb4messanger it isn't completed yet but it so far supports mutiple users and messages from the server (i.e "user x has joined the chat"), its open source which you can grab here: **'//////////////////////////////////////// '|| B4Messenger v1.0 by Madcow || '/////////////////////////////////////// '======== Setup ======== Dim Server 'Server Variable Dim Name$ 'Name of User Dim &Connection() 'Variable to Hold Connections Dim Guest 'Variable to say if Messenger is Guest. Dim Connected 'True if Connected to another messenger. Dim &UserInfo$()()'Array for User Info Dim i 'Variable for "for..next" loops dim userinput$ 'variable for input dim location,x 'cursor location '======== End ======== '======== Subs ======== Sub CheckForConnections() 'connection checking routine Dim &temp() ' Temp array to store connections in. Dim &temp2$()() ' Temp array to store cuser info in. Dim Msg 'Message Variable Dim j if ConnectionPending (server) then 'check for pending connections if arraymax(connection)>-1 then alloc temp, arraymax(connection)+1 'Store connections in temp array for j=0 to arraymax(connection) temp(j) = connection(j) next alloc temp2$, arraymax(connection)+1,1 'Store users in temp array for j=0 to arraymax(UserInfo$) temp2$(j)(0) = UserInfo$(j)(0) temp2$(j)(1) = UserInfo$(j)(1) next alloc UserInfo$,arraymax(connection)+1,1 'Increase array length by 1 UserInfo$ = temp2$ alloc connection,arraymax(connection)+1 'Increase array length by 1 connection = temp 'Get connections from temp array and put it into connection array else alloc connection,arraymax(connection)+1 'Increase array length by 1 alloc UserInfo$,arraymax(connection)+1,1 endif connection(arraymax(connection)) = AcceptConnection (server) 'Add connection to connection array Msg = SendMessage (connection(arraymax(connection)),false,false,false) ' Create a message to send down connection WriteLine (Msg, Name$) ' Write some text if arraymax(UserInfo$) > 0 then for i=0 to arraymax(connection) WriteLine (Msg, UserInfo$(i)(0)) ' Write some text waittimer(50) next endif CloseFile (Msg) while not messagepending(connection(arraymax(connection))):wend Msg = ReceiveMessage(connection(arraymax(connection))) UserInfo$(arraymax(connection))(0) = ReadLine(Msg) CloseFile (Msg) for i=0 to arraymax(connection)-1 Msg = SendMessage (connection(i),false,false,false) ' Create a message to send down connection WriteLine (Msg, "?Join") ' Write some text WriteLine (Msg, UserInfo$(arraymax(connection))(0)) ' Write some text CloseFile(Msg) waittimer(50) next printr "*"+UserInfo$(arraymax(connection))(0)+" has Joined the Chat*" endif EndSub Sub PrepareHandshake() while ConnectionConnected (connection(0)) and ConnectionHandshaking (connection(0)): wend if ConnectionConnected (connection(0)) then printr "Handshake succeeded" else printr "Handshake failed. Messenger Exited!" end endif endsub sub sendtext(text$) dim msg if not Guest then for i=0 to arraymax(connection) Msg = SendMessage (connection(i),false,false,false) WriteLine (Msg, "?Message")' Create a message to send down connection WriteLine (Msg, name$) WriteLine (Msg, text$) ' Write some text CloseFile(Msg) next else Msg = SendMessage (connection(0),false,false,false) ' Create a message to send down connection WriteLine (Msg, "?Message") WriteLine (Msg, text$) ' Write some text CloseFile(Msg) endif endsub sub sendname() dim msg Msg = SendMessage (connection(0),false,false,false) WriteLine (Msg, name$)' Create a message to send down connection CloseFile(Msg) endsub sub CheckForServerCommands() dim msg dim actiontype$ if messagepending(connection(0)) then Msg = ReceiveMessage(connection(0)) actiontype$ = readline(msg) if actiontype$ = "?Join" then printr "*"+readline(msg)+" has Joined the Chat*" elseif actiontype$ = "?Left" then printr "*"+readline(msg)+" has Left the Chat*" elseif actiontype$ = "?Info" then printr readline(msg) elseif actiontype$ = "?Message" then printr readline(msg)+" Says:" printr readline(msg) endif closefile(msg) endif if not ConnectionConnected (connection(0)) and not ConnectionHandshaking (connection(0)) then printr "The Chat has been ended." endif endsub sub ManageConnections() dim msg,actiontype$,user$,text$ dim msg2,j dim &temp() dim &temp2$()() for i=0 to arraymax(connection) if messagepending(connection(i)) then Msg = ReceiveMessage(connection(i)) actiontype$ = readline(msg) if actiontype$ = "?Message" then text$ = readline(msg) printr UserInfo$(i)(0)+" Says:" printr text$ for j=0 to arraymax(connection) if j<>i then msg2 = sendMessage(connection(j),false,false,false) writeline(msg2, "?Message") writeline(msg2, UserInfo$(i)(0)) writeline(msg2, text$) closefile(msg2) waittimer(50) endif next endif closefile(msg) elseif not ConnectionConnected (connection(i)) then for j=0 to arraymax(connection) if j<>i then msg = sendMessage(connection(j),false,false,false) writeline(msg2, "?Left") writeline(msg2, UserInfo$(i)(0)) closefile(msg2) printr "*"+UserInfo$(i)(0)+" Left the chat*" waittimer(50) endif next if arraymax(connection)>0 then printr "*Theirs nobody in this Chat*" endif if arraymax(connection)>0 then alloc temp,arraymax(connection) alloc temp2$,arraymax(connection),1 for j=0 to arraymax(connection) temp(j) = connection(j) next for j=0 to arraymax(connection) temp2$(j)(0) = userinfo$(j)(0) temp2$(j)(1) = userinfo$(j)(1) next alloc UserInfo$,arraymax(connection)-1,1 'decrease array length by 1 for j=0 to arraymax(connection) if j<>i then UserInfo$(j)(0) = temp2$(j)(0) endif next alloc connection,arraymax(connection)-1 'decrease array length by 1 for j=0 to arraymax(connection) if j<>i then connection(j) = temp(j) endif next endif endif next endsub sub TextEntering() dim key$ if location<x then x=x-1 elseif location-x > 19 then x=x+1 endif if inscankey()<>0 then if scankeydown(vk_return) then SetTextScroll (true) locate 0,30 clearline() printr "You Say:" printr left$(userinput$,location)+right$(userinput$,len(userinput$)-location) sendtext(userinput$) userinput$="" location=len(userinput$) elseif scankeydown(vk_left) then if location>0 then location=location-1 endif elseif scankeydown(vk_right) then if location<>len(userinput$) then location=location+1 endif elseif scankeydown(vk_delete)or scankeydown(vk_back)then if len(userinput$)>0 then userinput$ = left$(userinput$,location-1)+right$(userinput$,len(userinput$)-location) location=location-1 endif elseif scankeydown(vk_space) then userinput$ =left$(userinput$,location)+" "+right$(userinput$,len(userinput$)-location) location=location+1 else key$=inkey$() if key$ <>"" and key$<>" " then userinput$ =left$(userinput$,location)+key$+right$(userinput$,len(userinput$)-location) location=location+1 endif endif ClearKeys () locate 0,50 clearline() print mid$(left$(userinput$,location)+"|"+right$(userinput$,len(userinput$)-location),x,23) endif endsub sub GetNames() Dim Msg Dim j Dim &temp$ ()() alloc UserInfo$,0,1 alloc temp$,0,1 Msg = ReceiveMessage(connection(0)) while not Endoffile(Msg) UserInfo$(i)(0) = ReadLine(Msg) printr UserInfo$(i)(0) i=i+1 alloc temp$,arraymax(UserInfo$)+1,1 for j=0 to arraymax(UserInfo$) temp$(j)(0) = UserInfo$(j)(0) next alloc UserInfo$,arraymax(UserInfo$)+1,1 UserInfo$ = temp$ wend CloseFile (Msg) endsub '======== End ======== '======== Main Program ======== printr "B4 Messanger v1.0 Beta 3" input "Name?", name$ input "Guest? (1=true, 0=false)", Guest if not Guest then Server = NewServer(8000)'Set Up New Server printr "Waiting for Connections..." else alloc connection,0 connection(0) = NewConnection ("Localhost", 8000) printr "Connecting to Server..." endif while arraymax(connection) = -1 and not Connected if not Guest then CheckForConnections() endif if arraymax(connection)>-1 land ConnectionConnected (connection(0)) then Connected = true endif waittimer(50) wend if not Guest then printr "Connected!" else printr "Preparing to Handshake!" PrepareHandShake() printr "Retriving Users..." printr "Users:" printr "" GetNames() SendName() endif sleep(300) textmode(text_buffered) cls printr "B4 Messanger 1.0 Beta 3" while true locate 0,30 SetTextScroll (true) if not Guest then CheckForConnections() ManageConnections() else CheckForServerCommands() endif TextEntering() waittimer(50) drawtext() wend '======== End ========**
|
|
|
Post by dw817 on May 4, 2009 12:26:30 GMT -5
Hi MadCow: * Phew ! That's a lot of code ! I ran it: Name? David Guest? (1=TRUE, 2=FALSE) 1 Connecting To Server... Preparing To Handshake! Handshake Failed. Messenger Exited!How do you use it ?
|
|
|
Post by James :) (aka Madcow) on May 4, 2009 15:51:52 GMT -5
you gotta have 2 instances running
1 as a guest and one not as a guest
|
|
|
Post by crazynate on May 4, 2009 15:57:17 GMT -5
my plans for making the avatar creator networked invovles storing the appearence data in an array {face#,Hair#,etc...} and sending that data to client/server and on their end the data is then used to load the correct images that are stored in each program.
note: ive noticed on the png images on this and other programs of mine, that there is an outline of color which should have been taken away when i added transparency. How could i get rid of this outline. also is there a command that tells you your ip address
|
|
|
Post by Wayne Rayner on May 4, 2009 19:43:35 GMT -5
you can write a chat client, an example of one is myb4messanger it isn't completed yet but it so far supports mutiple users and messages from the server (i.e "user x has joined the chat"), its open source which you can grab here: **'//////////////////////////////////////// '|| B4Messenger v1.0 by Madcow || '/////////////////////////////////////// '======== Setup ======== Dim Server 'Server Variable Dim Name$ 'Name of User Dim &Connection() 'Variable to Hold Connections Dim Guest 'Variable to say if Messenger is Guest. Dim Connected 'True if Connected to another messenger. Dim &UserInfo$()()'Array for User Info Dim i 'Variable for "for..next" loops dim userinput$ 'variable for input dim location,x 'cursor location '======== End ======== '======== Subs ======== Sub CheckForConnections() 'connection checking routine Dim &temp() ' Temp array to store connections in. Dim &temp2$()() ' Temp array to store cuser info in. Dim Msg 'Message Variable Dim j if ConnectionPending (server) then 'check for pending connections if arraymax(connection)>-1 then alloc temp, arraymax(connection)+1 'Store connections in temp array for j=0 to arraymax(connection) temp(j) = connection(j) next alloc temp2$, arraymax(connection)+1,1 'Store users in temp array for j=0 to arraymax(UserInfo$) temp2$(j)(0) = UserInfo$(j)(0) temp2$(j)(1) = UserInfo$(j)(1) next alloc UserInfo$,arraymax(connection)+1,1 'Increase array length by 1 UserInfo$ = temp2$ alloc connection,arraymax(connection)+1 'Increase array length by 1 connection = temp 'Get connections from temp array and put it into connection array else alloc connection,arraymax(connection)+1 'Increase array length by 1 alloc UserInfo$,arraymax(connection)+1,1 endif connection(arraymax(connection)) = AcceptConnection (server) 'Add connection to connection array Msg = SendMessage (connection(arraymax(connection)),false,false,false) ' Create a message to send down connection WriteLine (Msg, Name$) ' Write some text if arraymax(UserInfo$) > 0 then for i=0 to arraymax(connection) WriteLine (Msg, UserInfo$(i)(0)) ' Write some text waittimer(50) next endif CloseFile (Msg) while not messagepending(connection(arraymax(connection))):wend Msg = ReceiveMessage(connection(arraymax(connection))) UserInfo$(arraymax(connection))(0) = ReadLine(Msg) CloseFile (Msg) for i=0 to arraymax(connection)-1 Msg = SendMessage (connection(i),false,false,false) ' Create a message to send down connection WriteLine (Msg, "?Join") ' Write some text WriteLine (Msg, UserInfo$(arraymax(connection))(0)) ' Write some text CloseFile(Msg) waittimer(50) next printr "*"+UserInfo$(arraymax(connection))(0)+" has Joined the Chat*" endif EndSub Sub PrepareHandshake() while ConnectionConnected (connection(0)) and ConnectionHandshaking (connection(0)): wend if ConnectionConnected (connection(0)) then printr "Handshake succeeded" else printr "Handshake failed. Messenger Exited!" end endif endsub sub sendtext(text$) dim msg if not Guest then for i=0 to arraymax(connection) Msg = SendMessage (connection(i),false,false,false) WriteLine (Msg, "?Message")' Create a message to send down connection WriteLine (Msg, name$) WriteLine (Msg, text$) ' Write some text CloseFile(Msg) next else Msg = SendMessage (connection(0),false,false,false) ' Create a message to send down connection WriteLine (Msg, "?Message") WriteLine (Msg, text$) ' Write some text CloseFile(Msg) endif endsub sub sendname() dim msg Msg = SendMessage (connection(0),false,false,false) WriteLine (Msg, name$)' Create a message to send down connection CloseFile(Msg) endsub sub CheckForServerCommands() dim msg dim actiontype$ if messagepending(connection(0)) then Msg = ReceiveMessage(connection(0)) actiontype$ = readline(msg) if actiontype$ = "?Join" then printr "*"+readline(msg)+" has Joined the Chat*" elseif actiontype$ = "?Left" then printr "*"+readline(msg)+" has Left the Chat*" elseif actiontype$ = "?Info" then printr readline(msg) elseif actiontype$ = "?Message" then printr readline(msg)+" Says:" printr readline(msg) endif closefile(msg) endif if not ConnectionConnected (connection(0)) and not ConnectionHandshaking (connection(0)) then printr "The Chat has been ended." endif endsub sub ManageConnections() dim msg,actiontype$,user$,text$ dim msg2,j dim &temp() dim &temp2$()() for i=0 to arraymax(connection) if messagepending(connection(i)) then Msg = ReceiveMessage(connection(i)) actiontype$ = readline(msg) if actiontype$ = "?Message" then text$ = readline(msg) printr UserInfo$(i)(0)+" Says:" printr text$ for j=0 to arraymax(connection) if j<>i then msg2 = sendMessage(connection(j),false,false,false) writeline(msg2, "?Message") writeline(msg2, UserInfo$(i)(0)) writeline(msg2, text$) closefile(msg2) waittimer(50) endif next endif closefile(msg) elseif not ConnectionConnected (connection(i)) then for j=0 to arraymax(connection) if j<>i then msg = sendMessage(connection(j),false,false,false) writeline(msg2, "?Left") writeline(msg2, UserInfo$(i)(0)) closefile(msg2) printr "*"+UserInfo$(i)(0)+" Left the chat*" waittimer(50) endif next if arraymax(connection)>0 then printr "*Theirs nobody in this Chat*" endif if arraymax(connection)>0 then alloc temp,arraymax(connection) alloc temp2$,arraymax(connection),1 for j=0 to arraymax(connection) temp(j) = connection(j) next for j=0 to arraymax(connection) temp2$(j)(0) = userinfo$(j)(0) temp2$(j)(1) = userinfo$(j)(1) next alloc UserInfo$,arraymax(connection)-1,1 'decrease array length by 1 for j=0 to arraymax(connection) if j<>i then UserInfo$(j)(0) = temp2$(j)(0) endif next alloc connection,arraymax(connection)-1 'decrease array length by 1 for j=0 to arraymax(connection) if j<>i then connection(j) = temp(j) endif next endif endif next endsub sub TextEntering() dim key$ if location<x then x=x-1 elseif location-x > 19 then x=x+1 endif if inscankey()<>0 then if scankeydown(vk_return) then SetTextScroll (true) locate 0,30 clearline() printr "You Say:" printr left$(userinput$,location)+right$(userinput$,len(userinput$)-location) sendtext(userinput$) userinput$="" location=len(userinput$) elseif scankeydown(vk_left) then if location>0 then location=location-1 endif elseif scankeydown(vk_right) then if location<>len(userinput$) then location=location+1 endif elseif scankeydown(vk_delete)or scankeydown(vk_back)then if len(userinput$)>0 then userinput$ = left$(userinput$,location-1)+right$(userinput$,len(userinput$)-location) location=location-1 endif elseif scankeydown(vk_space) then userinput$ =left$(userinput$,location)+" "+right$(userinput$,len(userinput$)-location) location=location+1 else key$=inkey$() if key$ <>"" and key$<>" " then userinput$ =left$(userinput$,location)+key$+right$(userinput$,len(userinput$)-location) location=location+1 endif endif ClearKeys () locate 0,50 clearline() print mid$(left$(userinput$,location)+"|"+right$(userinput$,len(userinput$)-location),x,23) endif endsub sub GetNames() Dim Msg Dim j Dim &temp$ ()() alloc UserInfo$,0,1 alloc temp$,0,1 Msg = ReceiveMessage(connection(0)) while not Endoffile(Msg) UserInfo$(i)(0) = ReadLine(Msg) printr UserInfo$(i)(0) i=i+1 alloc temp$,arraymax(UserInfo$)+1,1 for j=0 to arraymax(UserInfo$) temp$(j)(0) = UserInfo$(j)(0) next alloc UserInfo$,arraymax(UserInfo$)+1,1 UserInfo$ = temp$ wend CloseFile (Msg) endsub '======== End ======== '======== Main Program ======== printr "B4 Messanger v1.0 Beta 3" input "Name?", name$ input "Guest? (1=true, 0=false)", Guest if not Guest then Server = NewServer(8000)'Set Up New Server printr "Waiting for Connections..." else alloc connection,0 connection(0) = NewConnection ("Localhost", 8000) printr "Connecting to Server..." endif while arraymax(connection) = -1 and not Connected if not Guest then CheckForConnections() endif if arraymax(connection)>-1 land ConnectionConnected (connection(0)) then Connected = true endif waittimer(50) wend if not Guest then printr "Connected!" else printr "Preparing to Handshake!" PrepareHandShake() printr "Retriving Users..." printr "Users:" printr "" GetNames() SendName() endif sleep(300) textmode(text_buffered) cls printr "B4 Messanger 1.0 Beta 3" while true locate 0,30 SetTextScroll (true) if not Guest then CheckForConnections() ManageConnections() else CheckForServerCommands() endif TextEntering() waittimer(50) drawtext() wend '======== End ========** Thanks Madcow saves me a lot of work. I will add credits in the virtual chatroom client (this goes for anyone who helped me). Also can I edit it so the server is say running on my computer and the client is running on other computers. I hope I can complete this project and get it up and running. Tom or anyone else who can answer this question. How many people could the basic4GL networking engine support? I personally feel that it isn't very much maybe 12 to 20 people, I wish it could have capacity to fit 100 - 500 though could any one help me on this. Thanks Wayne Rayner
|
|
|
Post by crazynate on May 4, 2009 22:22:34 GMT -5
the real question is how many client connections can there be without affecting the programs performance. and also if the admin/host logged off everyone else would lose connection. i say go for smaller chat rooms hosted by users and have it set where friends can log into there friends chats
|
|