到目前为止,我已经使用 WebSocket++ 将实时数据从 C++ 虚拟世界服务器推送到浏览器,以便通过画布进行渲染,目前我正在开发一个 C++ 热扩散模拟器,该模拟器将在配套的 javascript 应用程序中显示模拟的实时可视化效果。如果您正在考虑全 C++ 路线,请随时在 GitHub 上联系我。
If you have access to the simulation source and want to build a WebSocket server component directly into it I have written a stand alone C++ WebSocket library (WebSocket++, https://github.com/zaphoyd/websocketpp/, BSD licensed) for doing exactly this sort of thing. WebSocket++ provides all of the components necessary to expose your C++ application's output via a self-contained WebSocket server. On the other hand, if you only need to expose stdout via a WebSocket node.js/socket.io or the Autobahn WebSocket library (python) might be simpler to set up.
So far I have used WebSocket++ for pushing live data from a C++ virtual world server to the browser for rendering via canvas and am currently working on a C++ heat diffusion simulator that will display live visualizations of the simulation in a companion javascript app. If you are thinking about the all C++ route feel free to ping me on GitHub.
发布评论
评论(2)
如果您有权访问模拟源并希望直接在其中构建 WebSocket 服务器组件,我已经编写了一个独立的 C++ WebSocket 库(WebSocket++,https://github.com/zaphoyd/websocketpp/,BSD 许可)用于执行此类操作。 WebSocket++ 提供了通过独立的 WebSocket 服务器公开 C++ 应用程序输出所需的所有组件。另一方面,如果您只需要通过 WebSocket node.js/socket.io 公开 stdout 或 Autobahn WebSocket 库 (python) 可能更容易设置。
到目前为止,我已经使用 WebSocket++ 将实时数据从 C++ 虚拟世界服务器推送到浏览器,以便通过画布进行渲染,目前我正在开发一个 C++ 热扩散模拟器,该模拟器将在配套的 javascript 应用程序中显示模拟的实时可视化效果。如果您正在考虑全 C++ 路线,请随时在 GitHub 上联系我。
If you have access to the simulation source and want to build a WebSocket server component directly into it I have written a stand alone C++ WebSocket library (WebSocket++, https://github.com/zaphoyd/websocketpp/, BSD licensed) for doing exactly this sort of thing. WebSocket++ provides all of the components necessary to expose your C++ application's output via a self-contained WebSocket server. On the other hand, if you only need to expose stdout via a WebSocket node.js/socket.io or the Autobahn WebSocket library (python) might be simpler to set up.
So far I have used WebSocket++ for pushing live data from a C++ virtual world server to the browser for rendering via canvas and am currently working on a C++ heat diffusion simulator that will display live visualizations of the simulation in a companion javascript app. If you are thinking about the all C++ route feel free to ping me on GitHub.
1)如果你想从互联网访问任何外部数据,你就无法避免运行服务器。
我假设您将运行 simulator.exe 并以文本模式捕获其输出。
如果这个模拟器是
windows
应用程序,我推荐C++
如果它是
linux
,我会尝试node.js
>您期望每秒更新多少次
< 5
使用AJAX> 5
使用 WebSockets2) Canvas API 本身使用起来非常简单,因此您可能不需要任何库来处理它。
关于动画的注释 - 只需及时在新旧数据之间进行插值 - 我的意思是:
如果您决定使用节点来执行此操作,这可能会帮助您 使用 Node.JS 构建的多人 JavaScript 游戏 - 分离玩家
1) You cannot avoid running a server if you want to access any external data from the internet.
I assume you are going to run
simulator.exe
and catch its output in text mode.If this simulator is
windows
application I recommendC++
If it's for
linux
i'd give a try tonode.js
How many updates per second do you expect
< 5
use AJAX> 5
go for WebSockets2) Canvas API itself is really simple to use so you probably don't need any library to deal with it.
And the note about animation - just interpolate between old and new data in time - what i mean:
If you decide to do it with node this may help you Multiplayer JavaScript game built with Node.JS - Separating players