1 / 66

Using QuickSilver to mock-up Web 3.0

Using QuickSilver to mock-up Web 3.0. Krzys Ostrowski. Introduction. BAD. BAD. Architecture. Tools. Development Environment. Microsoft Visual Studio 2005 “Express” (supports XNA Framework & Game Studio Express) XNA Project types Implements the “content pipeline”

Download Presentation

Using QuickSilver to mock-up Web 3.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using QuickSilver to mock-up Web 3.0 Krzys Ostrowski

  2. Introduction

  3. BAD

  4. BAD

  5. Architecture

  6. Tools

  7. Development Environment • Microsoft Visual Studio 2005 “Express” (supports XNA Framework & Game Studio Express) • XNA Project types • Implements the “content pipeline” • Microsoft Visual Studio 2005 “Professional” (support only the XNA Framework) • Version control, • Debugging multithreaded applications, etc.

  8. content loading content

  9. Coding

  10. How to access the functionalityprovided by XNA, QMS etc.

  11. Add a pre-build event to manually copy QuickSilver_0.dll, You can also copy over graphical content here

  12. Where to write your own code

  13. namespace MyGameClient { public partial class Form1 : Form { public Form1() { InitializeComponent(); gamethread = new Thread(new ThreadStart(ThreadCallback)); gamethread.Start(); …

  14. public partial class Form1 : Form { … private void ClosingCallback( object sender, FormClosingEventArgs e) { … }

  15. When does your code run?

  16. Threads • Game Thread • Rendering graphics • Respond to mouse/keyboard • Windows Forms Thread • Rendering Forms • Respond to mouse/keyboard • QSM Thread (inside QSM) • Network communication • Your own threads? • Your background processing etc. game = new MyGame(…); game.Run(); Application.Run( new Form1(…)); client = QS.CMS.Framework2.Client.Create(…);

  17. Your Code • Your own threads • Callbacks from Windows Forms (GUI Thread) • Mouse, keyboard etc. • Callbacks from Game (Game Thread) • Update(GameTimegameTime) • Draw(GameTimegameTime) • Callbacks from QSM (QSM Thread) • When packets are received, sent, acked etc. • Must do minimum work and leave!

  18. How to use QSM

  19. Launching QSM “client” using QS.CMS.Framework2; … ClientConfiguration configuration = newClientConfiguration( “192.168.0.0/24”, 10000, “192.168.0.100”); configuration.Verbose = true; … IClient client = Client.Create(configuration); select the NIC port number GMS address

  20. Joining a QSM group IGroup group = client.Open( new QS.CMS.Base3.GroupID(groupid), GroupOptions.FastCallbacks); how QSM interacts with your code numeric identifier

  21. Receiving from a group group.OnReceive += newIncomingCallback(ReceiveCallback); privatevoid ReceiveCallback( QS.CMS.Base3.InstanceID sender, QS.CMS.Base3.ISerializable message) { Message m = (Message) message; … called on receive your class

  22. Sending to a group (1) group.BufferedChannel.Send(newMessage(…)); you can send this way from any thread uses internal buffer to store messages you are sending

  23. Sending to a group (2a)

  24. Sending to a group (2b) group.ScheduleSend( newOutgoingCallback(SendCallback)); private void SendCallback( IChannel channel, uint maxsend, out bool hasmore) { channel.Send(newMessage(…)); hasmore = false; } unbuffered max # messages keep sending?

  25. Serialization • Built-in XML • Flexible, easy to use • Slow • Space-consuming • Built-in “binary” • Useless • QSM • Fast, supports scatter-gather I/O • Takes getting used to…

  26. “traditional” serialization

  27. “scatter-gather” serialization

  28. serialization in QSM

  29. Anatomy of a serializable class (1) (1) [QS.CMS.Base2.ClassID(Message.ClassID)] public sealed class Message : QS.CMS.Base3.ISerializable { public const ushort ClassID = (ushort) (QS.ClassID.UserMin + 100); public Message() { } (3) (2) (4)

  30. Anatomy of a serializable class (2) (6) unsafe QS.CMS.Base3.SerializableInfo QS.CMS.Base3.ISerializable.SerializableInfo { get { return new QS.CMS.Base3.SerializableInfo( ClassID, sizeof(uint) + 2 * sizeof(float)); } } (5) class identifier header size

  31. Anatomy of a serializable class (3) here you can copy unsafe void QS.CMS.Base3.ISerializable.SerializeTo( ref QS.Fx.Base.ConsumableBlock header, ref IList<QS.Fx.Base.Block> data) { fixed (byte* arrayptr = header.Array) { byte* headerptr = arrayptr + header.Offset; *((uint*)headerptr) = playerid; *((float*)(headerptr + sizeof(uint))) = x; *((float*)(headerptr + sizeof(uint) + sizeof(float))) = y; } header.consume(sizeof(uint) + 2 * sizeof(float)); } (7) append your buffers here (8) (9) (10)

More Related