0

我是游戏编程的新手,我通常编写企业软件。

我的问题是我需要学习哪些数学才能创建这些游戏

  • 蛇游戏
  • 俄罗斯方块
  • 纸牌游戏之类的纸牌游戏

非常感谢任何可以帮助我创建这个游戏的参考/书籍

非常感谢。

4

3 回答 3

2

如果你知道如何处理一些基本的数据结构,比如列表和“二维”数组,那么这些游戏就不需要太多数学。

编辑:此外,这种游戏逻辑可能只占游戏代码的一小部分。剩下的就是处理用户输入、图形、声音、时间等,而正确地处理这些(在程序中拥有良好的架构)是一项更具挑战性的任务。另一方面,至少其中一些事情可以委托给现成的游戏引擎/框架。

于 2012-08-02T06:30:00.870 回答
0

对于简单的游戏编程,您需要的唯一数学是非常基本的空间推理,以便您可以告诉计算在屏幕上的何处绘制/动画对象。因此,在这种情况下,我不会担心缺乏数学背景。当您编写更复杂的游戏时,您可能需要数学,但我建议您自由探索游戏开发并根据需要进行数学复习:)

由于您特别询问了简单游戏,以下是您必须为您描述的游戏解决的数学问题的一些示例:

  • 假设您正在编写一个单人纸牌游戏,每张纸牌都是w像素宽,水平布局,p每张都由像素分隔。你必须推断出这张牌在位置 ( + ) * n nwp

  • 假设您正在编写俄罗斯方块,您可能希望方块每m毫秒平滑滑行到下一个网格单元。那么你需要[grid cell size] * 1000 / (m * [frames per second])每帧移动每个块像素。

于 2012-08-02T07:01:45.870 回答
0

Just as a general guideline, you probably don't have to worry about "which math do i need to learn" unless you're using programming to solve a math problem.

For stuff like programming simple games, it's much more important to learn your data structures and algorithms well, and to be able to design and implement clean, correct, and maintainable code. Math doesn't usually come into the picture unless you're trying to compare two different implementations, and even then, you really only need enough to have an intuitive sense of what constitutes fast enough for what you need.

于 2012-08-02T06:54:34.890 回答