Author Topic: Working on a pseudo-multiplayer system for Stunts using em-dosbox and WebSockets  (Read 108 times)

HunterBoy344

  • Newbie
  • *
  • Posts: 6
    • View Profile
I had an idea recently to make a multiplayer system for Stunts in the browser. The game itself would be run using em-dosbox, and replay files would be used to make a live leaderboard for a specific track chosen by the server and distributed to clients. The track would rotate every 5 minutes, and whatever user had the best time at the end of that would win the round.

Today I started making it! The biggest challenge thus far has been getting Stunts to work properly in the browser, but as of right now it seems to be working okay. I'm trying to figure out how I can add a custom config file to em-dosbox (for better framerate and possibly sound) but at least at the moment the game runs.

Here is a link to try it out! I haven't added any multiplayer features yet, but the website does load the game. I'll post development updates here as they happen!
https://stuntsthing.hunterboy344.repl.co

HunterBoy344

  • Newbie
  • *
  • Posts: 6
    • View Profile
Development update: The game now runs at full FPS! I figured out how to set up a custom DOSBox config for em-dosbox, though I still unfortunately can't get sound working. My next priority will be to get some actual multiplayer functionality working. Wish me luck!

And yes, if you were wondering, the changes I've made thus far are live on the website.

Cas

  • Highway Horror
  • ****
  • Posts: 1458
  • Think different. That's OK... as long as you think
    • View Profile
    • Dimioca Labs
It does work!  On my computer and browser, it gets to about 4 to 5 frames per second, but it does work. Interestingly, it doesn't skip frames. It just goes slower, which allows for a lot of control.
Earth is my country. Science is my religion.

Daniel3D

  • Highway Horror
  • ****
  • Posts: 1422
  • so many ideas....
    • View Profile
    • Stunts resources.
On my computer DosBox starts but no drive is mounted so there is no stunts.
I did notice the copy protections hints. We have alternative executables that don't have the copy protection anymore.

But i really like this idea. There are definitely uses for it.
Edison once said,
“I have not failed 10,000 times,
I’ve successfully found 10,000 ways that will not work.”
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

Daniel3D

  • Highway Horror
  • ****
  • Posts: 1422
  • so many ideas....
    • View Profile
    • Stunts resources.
It does work!  On my computer and browser, it gets to about 4 to 5 frames per second, but it does work. Interestingly, it doesn't skip frames. It just goes slower, which allows for a lot of control.
Tried again, now it works for me too. But also slower. Exactly at half speed. (I timed it with a stopwatch).
I have no sound and because the speed is so slow my reflexes are off. So very difficult to drive.
Although, if you get used to it, then a slower running game could give you an advantage.

I'm no expert in the technical website stuff. But is the game loaded in memory of the local computer or on the web server?
That would have a lot of impact on the performance.
« Last Edit: June 24, 2022, 09:56:31 AM by Daniel3D »
Edison once said,
“I have not failed 10,000 times,
I’ve successfully found 10,000 ways that will not work.”
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

HunterBoy344

  • Newbie
  • *
  • Posts: 6
    • View Profile
It does work!  On my computer and browser, it gets to about 4 to 5 frames per second, but it does work. Interestingly, it doesn't skip frames. It just goes slower, which allows for a lot of control.

That’s odd… it runs at full speed on my end. Maybe I set the CPU cycles too high? It’s set to 20000 right now. Try running the game and tell me what the title of the tab says; the tab label lists the current CPU cycles among other things.

I'm no expert in the technical website stuff. But is the game loaded in memory of the local computer or on the web server?
That would have a lot of impact on the performance.

The game is run locally in the browser using em-dosbox, meaning that the game is run using the local computer’s resources. This does mean performance varies based on the device running the game.

I’ll try tweaking the DOSBox settings to see if that does anything.

Cas

  • Highway Horror
  • ****
  • Posts: 1458
  • Think different. That's OK... as long as you think
    • View Profile
    • Dimioca Labs
Uhm... something strange happens now. I open the page and DOSBOX displays Z:\>   I wait, but it doesn't automatically load Stunts, so I try to enter C: to then look for Stunts there, but... it's not taking my Shift key, so when I try to type a colon, I get a semicolon instead.
Earth is my country. Science is my religion.

Daniel3D

  • Highway Horror
  • ****
  • Posts: 1422
  • so many ideas....
    • View Profile
    • Stunts resources.
Uhm... something strange happens now. I open the page and DOSBOX displays Z:\>   I wait, but it doesn't automatically load Stunts, so I try to enter C: to then look for Stunts there, but... it's not taking my Shift key, so when I try to type a colon, I get a semicolon instead.
I had that to.
Sometimes it doesn't load well. Doesn't mount the drive or something.
It worked later so maybe a full page reset solves that.
Edison once said,
“I have not failed 10,000 times,
I’ve successfully found 10,000 ways that will not work.”
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

HunterBoy344

  • Newbie
  • *
  • Posts: 6
    • View Profile
Development update again!

I’ve managed to get the game to run at the correct speed on all hardware. As I suspected, the fixed 20000 cycles was too much for most users, so I changed the
Code: [Select]
cycles=20000 to
Code: [Select]
cycles=max to get the best possible cycles depending on hardware.

Hope this helps! I’ve already started working on some multiplayer functions, so expect another progress report soon!

Daniel3D

  • Highway Horror
  • ****
  • Posts: 1422
  • so many ideas....
    • View Profile
    • Stunts resources.
Well. I have a busy race schedule this weekend, and apparently no time to fulfill it. But I'll try to squeeze a test in for you.
Edison once said,
“I have not failed 10,000 times,
I’ve successfully found 10,000 ways that will not work.”
---------
Currently running over 20 separate instances of Stunts or 4D Sports Driving.

alanrotoi

  • Makes love with Stunts
  • ******
  • Posts: 4778
  • Suck my Indy!
    • View Profile
    • Maite Zaitut, La Vengadora Oscura
Also it would be cool a "spectator mode" :)