Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
Hello Dear CCB Community I Decided That I'll Be Pushing the Coppercube's and my Limits By Challenging Myself On this Project; I'm Not New Around Here Been Using The Coppercube For A While Now, I Made Many Multiplayer Games Using different Engines and Built-In Plugins! But I Cannot understand The Coppercube's Mechanism When It Comes To Making A Multiplayer Game... So I Need You Guys' Help If You Could Share Your Knowledge about networking In CCB or Share any Plugins about Networking That Would Work On An Executable(.exe) file I'd be so thankful! Hope To See Someone Help Me Out! |
||||
|
dont we all :D |
||||
|
In short, ccb only had built in rest client. It only supports http get request. So: For server side part, there is no built in stuff you can use at all. So you can code a game server using tool of your choice. I prefer using node js + express/fastify. But basically anything, that can handle http should do. Also, I believe, someone posted node js ccb bindings here. I never tried those, but potentially it can allow loading ccb scene in headless mode, so you don't have to code game logic from scratch, if you decide to handle it server side. In the simplest scenario, you can use your server as "exchange point" for data from multiple clients, which is much simpler. For client side you have 2 options: 1. Use built-in http client. The obvious limitation, is that you can only use get calls, so all data should be sent with query strings. It's not that bad as people think though. Not obvious limitation is that it seems like it doesn't really work asynchronously as you can expect, and it blocks thread execution until the response is received. So you want really be able to run a game at 60 fps unless you use 10-20 hz server. 2. Use another rest client and either write received data to file system, and than read it from ccb using read file content API function. Or you can try to use JIC's 6.7 runner which allows to return output from system command execution, which I unfortunately, also didn't tried yet. There are also other issues, like data serialization for example, which could be fixed by using JSON object polyfil. Also if you don't host server yourself and just distribute your server along with the client, players most likely want be able to figure out how to set up IPs, port forwarding and related networking stuff, so I don't recommend it. Http multiplayer example: https://zeicmann.itch.io/ccb-various Another one: https://www.ambiera.com/forum.php?t=12776 My mmorpg youtube vids: https://m.youtube.com/watch?v=I3aM4xr_DeE&list=PLqZBDmGo9pqx-xByAw8UBe1dly5iB5LT8&pp=gAQBiAQB |
||||
|
Thank You For Sharing You Knowledge With Me! I Did Some Research Myself And Decided To Use node.js Which I'm Familiar With, If I Succes On The Project I Wil Keep Posting The Updates On This Post |
||||
|
I Got Your Example Working But I Was Wondering If there Was Any Way To Run The Same Thing In .exe instead of html |
||||
|
Yes, both example I provided target window. If you're talking about this one https://zeicmann.itch.io/ccb-various, go to client folder, open host.txt and update ip to localhost, or any other IP your computer uses. Then start client.exe |
||||
|
Okay Soo I Had To Make Some Fixes To Get The Game And The Server Working On my Pc Succesfully, Is It Okay If I Use Your code For My Game's Networking? I Will Credit You! |
||||
|
Sure, feel free to use it any way you want. Attribution is not required. |
||||
|
Thank You! You Are A Life Saver!! |
||||
|
I Have A Problem With The Code It Works Perfectly We Tested It With My Friend Bu I Can't Add Any Custom Functions On My Own I changed The Code A Lot Bu Still I Wasn't Able To Can You Help Me Out? |
||||
|
If changing code doesn't affect server behavior, restart the server, stop and run "node index.js" again, or use tools which restart it automatically, like nodemon: https://www.npmjs.com/package/no... For client, try removing .exe file before starting the game from editor. It sometimes hangs, so coppercube doesn't able to rewrite the .exe. You can force kill it using cmd for example, or special tools. https://stackoverflow.com/questi... |
||||
|
thank you ill keep informing you about the progress |
|