Electrical Engineering
Use System Modeler to construct and study electrical circuits, power electronics, and electrical machinery. Combine electrical and mechanical components to build complete system models. Perform analysis tasks and measure performance.
Pong Game
This example will demonstrate how you can use Model Plug to create your own Pong game, played with external controllers. This is a very playful example, but it highlights how easy the connection to external hardware becomes when using the Model Plug library.
The Setup
To create a Pong game using System Modeler, you will need a Pong model created in Wolfram System Modeler, the Model Plug library, and some external hardware that will act as paddles in the game.
The Model
The System Modeler model consists of connections to external hardware connected to a model of a Pong game. This game, or model, contains mechanical equations of a bouncing ball. When the ball hits either one of the walls or one of the paddles, the ball will bounce, and if a player manages to score, the score will be updated, and the ball will reinitialize to the middle of the board.
Playing the Game
Connect External Hardware
Expanding the Model
To make the model more interesting and increase the difficulty for the players, you can expand the model to be in two dimensions. That means that you can control the paddle in two directions: vertically as well as horizontally, which makes the game considerably more difficult.
To interact with the 2D simulation model, you need one more slider for one of the players. This means that one player will control the paddle with two sliders, and the other player will use the joystick. This is now a great starting platform to experiment with implementing some real physics in a simple game. Would it be possible to implement equations to make the ball curve using the Magnus force? How about creating a curved paddle and setting up equations for interacting with the ball with these paddles?
Wolfram System Modeler
Try
Buy
System Modeler is available in English
and Japanese
on Windows, macOS & Linux »
Questions? Comments? Contact a Wolfram expert »