Author Topic: Netplay... ideas and questions.  (Read 1675 times)

0 Members and 1 Guest are viewing this topic.

Offline Witten

  • PJ64 Dever
  • Newbie
  • *****
  • Posts: 5
  • Karma: +0/-0
  • SuperFly Deving Guy
Netplay... ideas and questions.
« on: December 31, 2011, 09:26:55 am »
Smart clients: each client runs pj64 with emulated core, pi input is sent in both directions
-each client is different... how to sync the cores? ProgramCounter difference too high, pause CPU?
-how to deal with ramdom generated numbers?

Dumb clients variant 1: client receives dlists and alists to process, pi input is sent to the server
-synced using vi and ai events?
-bandwidth limitations? how much data?
-do dlists and alists need RDRAM?

Dumb clients variant 2: audio and/or video streaming, pi input is sent to the server
-bandwidth limitations? resolution limited?
-how much power is needed on the server side?

Please share your insight and remarks on this topic!
« Last Edit: January 07, 2012, 01:23:32 pm by Gent »

Offline Gent

  • PJ64 Dever
  • Hero Member
  • *****
  • Posts: 505
  • Karma: +100/-0
  • SuperFly Deving Guy
    • Project64 Website
Re: Netplay... ideas and questions.
« Reply #1 on: December 31, 2011, 11:27:09 am »
straight away i will ask are we talking UDP or TCP here? afaik kaillera uses UDP and is the incredibly crap, so any netplay port primarily should be looking towards TCP imo.

Next comment is whoa Wit, you have been sleeping on this a bit and milling it over, i like it.

System 1 Specs:

OS:Windows 7 Professional 64Bit
CPU:Intel® Core™2 Quad Processor Q8400, 2.66 GHz, 1333 MHz FSB
System RAM:8GB Ddr2 Ram
Video:ATI Radeon HD 7470 PCI-E Graphics Card 1Gb
Sound:Creative Labs SB0460 X-fi Fatality Sound Blaster

System 2 Specs:

OS:Windows 7 Professional 64Bit
CPU:AMD Intel Quad Core i7 860 @ 2.80GHz Lynnfield 45nm Technology
System RAM:16.0GB Dual-Channel DDR3 @ 664MHz (9-9-9-24)
Video Card:512MB NVIDIA GeForce 310 Graphics
Sound Card:Realtek High Definition Audio

System 3 Specs:

OS:Windows 7 Professional 64Bit
CPU:AMD Essentials E1-2100 Accelerated Processor clock speed : 1.0 GHz
System RAM:Crucial 16GB  DDR3 RAM (1,333 MHz)
Video Card:AMD E1-2100 APU with AMD Radeon™ HD 8210 Graphics
Sound Card:Realtek ALC269Q-VB5-GR

Offline Jabo

  • PJ64 Dever
  • Newbie
  • *****
  • Posts: 16
  • Karma: +1/-0
  • Mr J
Re: Netplay... ideas and questions.
« Reply #2 on: December 31, 2011, 05:51:05 pm »
i would get in touch with the guy who made that netplay plugin we have been using he has this nicely done

that being said technically speaking the way I've always implemented netplay is purely sending input (for N64 this would be the PIF command results) back and forth over the wire.

trying to synchronize the actual emulated states will probably not work, it's too much data and since the timing of Project64 is so inaccurate there's the chance each side might have slightly different timing.

another challenge is going to be keeping things consistent ... with timing so inaccurate you have to come up with a way to make sure that you are sending/receiving in a consistent way. One way for the N64 I did this was just doing it simply on every PIF read... but I can't really decide if that's all the criteria that should be considered.
« Last Edit: December 31, 2011, 05:54:29 pm by Jabo »

Offline azimer

  • Apollo64 Dever
  • Newbie
  • *****
  • Posts: 13
  • Karma: +0/-0
Re: Netplay... ideas and questions.
« Reply #3 on: January 03, 2012, 04:43:20 pm »
Hi Jabo!  Happy new year old friend!

If you are looking for the most successful netplay, you need to control all the variances from external sources: plugins, controller reads, core config settings, etc.  If both emulators are identical and start in the exact same state, you will never go out of sync as long as the input stays in sync.  I hope that gives you something to chew on.

graphics and audio use rdram->imem and imem->rdram DMA extensively.  Personally I would do delayed input reads on vsync, lockdown the settings, and emulate all the exceptions within the core instead of the plugins.  You now have the same environment regardless of which plugins the end user chooses.

Offline Hacktarux

  • N64 Dever
  • Newbie
  • *****
  • Posts: 1
  • Karma: +0/-0
Re: Netplay... ideas and questions.
« Reply #4 on: February 06, 2012, 02:16:23 pm »
I totally agree with azimer. If i had to start somewhere, i would look at the audio interrupts. If i remember right, in pj64, it was generated by the audio plugin and based on the host pc time. Obviously it is totally wrong. You must estimate the amount of emulated cpu opcodes required to play the buffer and generate the interrupt within the core.

There are potentially other sources of variances but this is probably the most obvious.

Offline icepir8

  • TR64 Dever
  • Newbie
  • *****
  • Posts: 4
  • Karma: +1/-0
    • True Reality 64 Dev
Re: Netplay... ideas and questions.
« Reply #5 on: February 23, 2012, 08:41:08 pm »
My idea is to use a client/server setup.
Server would run the core emulation and send the graphics/audio commands to the client.
the client would do the rendering and audio playback
the client would send the controller infromation to the server.
The client should cache the textures and vertex data.
The client can requests textures/vertexes from the server.
Azimer sugested that it probably would be best to process the Audio List at the server and stream the audio to the client.
I think that the connections could be UPD and just ignore incomplete frames.
I would have a seperate port for each graphics, audio and controller, and a set for each of the players.
When connecting the client would request the next availible controller and connect to the assigned ports.
also the server could support connections to let non-player clients connect to the server so that game play could be watched and recorded by other persons.
The existing plugin system could be used but a new plugin interface could be defined for an all in one plugin instead of multiple plugins.