ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Announcements and Showcase
forum topic indicator I'm Working On A Multiplayer FPS Shooter Need Help About Networking
person icon
verybigooooooof
Registered User
Quote
2024-08-23 22:58:02

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!

person icon
o139
Registered User
Quote
2024-08-25 10:13:05

dont we all :D

person icon
okeoke
Registered User
Quote
2024-08-25 10:53:21

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

person icon
verybigooooooof
Registered User
Quote
2024-08-25 16:17:40

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

person icon
verybigooooooof
Registered User
Quote
2024-08-25 18:10:41

I Got Your Example Working But I Was Wondering If there Was Any Way To Run The Same Thing In .exe instead of html

person icon
okeoke
Registered User
Quote
2024-08-25 18:23:28

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

person icon
verybigooooooof
Registered User
Quote
2024-08-25 18:45:58

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!

person icon
okeoke
Registered User
Quote
2024-08-25 18:48:54

Sure, feel free to use it any way you want. Attribution is not required.

person icon
verybigooooooof
Registered User
Quote
2024-08-25 20:13:23

Thank You!
You Are A Life Saver!!

person icon
verybigooooooof
Registered User
Quote
2024-08-26 18:55:00

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?

person icon
okeoke
Registered User
Quote
2024-08-26 20:58:52

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...

person icon
verybigooooooof
Registered User
Quote
2024-08-26 22:46:21

thank you ill keep informing you about the progress


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |