Teapong – A two-player game for fans of Pong and the Utah teapot

栏目: IT技术 · 发布时间: 4年前

内容简介:A two-player game for fans of Pong and the

Teapong – A two-player game for fans of Pong and the Utah teapot

Teapong

A two-player game for fans of Pong and the Utah teapot !

Teapong – A two-player game for fans of Pong and the Utah teapot Click on the image above to see a two minute demo of Teapong!

Technical details

This is the first game that I ever make! :blush:

It was written using C++ and OpenGL, and it is currently supported on macOS and Windows.

The external libraries it uses and their purposes are the following:

  • GLFW is used to interact with the windowing system and to receive inputs.
  • GLAD is used to load pointers to OpenGL functions.
  • GLM is used to perform 3D math.
  • Assimp is used to load 3D models.
  • stb_image is used to load textures.
  • irrKlang is used to play sounds.

The sources of the assets it uses are the following:

  • The 3D models were created using 3ds Max .
  • The textures were created procedurally using 3ds Max and the Open Shading Language .
  • The sound effects can be found here .
  • The background music is Filaments by Podington Bear, and it can be found here .

For a more detailed description of this project's code, see this presentation.

Rules and controls

The rules are simple: the first player to score three points wins!

The controls are as follows:

  • Press Esc to close the game.
  • Press F to toggle between the full screen and the windowed modes. When in the windowed mode, you can manually resize the window using the mouse.
  • Press 1 , 2 , 4 or 8 to set the number of samples used for anti-aliasing. By default, the game starts with 1 sample. The higher the number of samples, the better the game looks.
  • When in the menu, press Space to start a game.
  • When ready to play, press Space to launch a teapot.
  • The left paddle is controled with G and B , while the right paddle is controlled with Up and Down .
  • Press P to pause the game.
  • Press C to toggle between the fixed and free camera modes. When the camera is free, you can position it using W , A , S , D and the mouse. You can also zoom in and out using the scroll wheel.
  • Press R to reset the camera to its original position.

Running the game without building it

macOS

To run Teapong on macOS, you must follow these steps:

  • Download or clone this repository and open a Terminal window in its root.
  • Execute the following command to install GLFW, GLM and Assimp:
$ brew install cmake assimp glm glfw
  • Execute the following commands to install GLAD:
$ cp dependencies/mac/inc/glad/glad.h /usr/local/include/
$ cp dependencies/mac/inc/KHR/khrplatform.h /usr/local/include/
  • Execute the following commands to install irrKlang:
$ cp -r dependencies/mac/inc/irrklang /usr/local/include/
$ cp -R dependencies/mac/lib/ /usr/local/lib/
  • Download Teapong_macOS.zip from release 1.0.0 , open a Terminal in its root directory and execute the following command to launch the game:
$ ./Teapong

Windows

To run Teapong on Windows, simply download Teapong_Windows.zip from release 1.0.0 and double click Teapong.exe .

Building the game

macOS

To build Teapong on macOS, you must follow the same steps listed in the " Running the game without building it " section, except for the last one, which you must replace with the following:

  • Execute the following command to build the game:
$ make Teapong

Thanks to Daniel Macario for writing the Makefile!

Windows

To build Teapong on Windows, simply download or clone this repository and use the Visual Studio 2019 solution file that is stored in the VS2019_solution directory.

Learning resources

The following sources of information are the ones that helped me the most while working on this game:

  • The external libraries I used are presented with excellent clarity in this page.
  • The design pattern I used for game state management was inspired by this article.
  • The classes I wrote for resource management were inspired by this code.

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

失控的真相

失控的真相

[美] 迈克尔·帕特里克·林奇 / 赵亚男 / 中信出版社 / 2017-6 / 42.00元

编辑推荐 在信息泛滥的时代,知识变得无处不在。鼠标轻轻一点,我们就坐拥一座巨型图书馆。然而,我们并没有因此就离真相更近。相反,互联网的普及使人们早已习惯于凡事问搜索引擎,并形成了一种“搜索即相信”的认知模式。当社交网络把数字人类带入一个个彼此隔绝的线上群体中,我们清楚地看到,真相与谎言在互联网中交织,知识与观念混为一谈,情绪宣泄掩盖了事实分析。联网的世界让我们更容易看到彼此的观点,但同时也制......一起来看看 《失控的真相》 这本书的介绍吧!

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具