套接字编程(赛车) [英] socket programming(car race)

查看:129
本文介绍了套接字编程(赛车)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我想编写一个使用套接字编程的程序.
我编写汽车模拟,我的项目包括3层(UI,业务和数据层).我有一个可以选择新游戏或查看日志文件的主窗体.当您选择新游戏时,您可以看到显示简单道路的新窗体,汽车,速度表等.现在我想使用套接字编程,因为2个播放器可以同时进行我的汽车模拟和比赛.
意味着您可以拥有自己的表格,也可以在表格中查看其他玩家的车.
我的汽车模拟非常样本化和二维化;
请给我建议c#中的任何想法或代码.
感谢

hi every body
i want to write a program that use socket programming.
i write a car simulation,my project include 3 layers(UI,Business and Data layer).i have a main form that can select new game or view log file.when you select new game you can see a new form that show simple road,car,speed gauge and so on.now i want to use socket programming as 2 player can play my car simulation and race together.
means you can have your form and also see other player''s car in your form.
my car simulation is very sample and 2d;
please suggest me any idea or code in c#.
thanks

推荐答案

此站点上有一个示例.
C#套接字和序列化 [ Lidgren网络库 [
希望对我有帮助,如果我给您的示例不是您所需要的,请告诉我,我会尝试更多.
There''s an example on this site.
C# Sockets and Serialization[^]

You might want to take a look at this library.
Lidgren networking library[^]


The problem with a multiplayer racing game is that things go fast. You might get desync issue or cars that warp everywhere.

Multiplayer games usually implements algorithm that will interpolate player position with the "last received state".

I hope it helps, if the example I gave you aren''t what you need, just tell me, I''ll try more.


这篇关于套接字编程(赛车)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆