让自己熟悉项目

发布于 2024-08-16 16:23:07 字数 1431 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

画尸师 2024-08-23 16:23:07

OpenTTD 来源的文档: http://docs.openttd.org/ ,它们会很有帮助。

另外,开发维基: http://wiki.openttd.org/Development

怎样才能熟悉呢?

首先,尝试编译。将其编译到您的平台并确保其正确运行。

然后,从待办事项列表中找出一个错误或某些内容并尝试实现它,或者只是玩游戏并考虑添加/更改一些简单的内容。当然,您可能会失败并想要更改您的任务,但每次尝试都将是理解项目结构的一步。


对我来说,编译部分是最烦人的部分。我想这是因为我在Windows上:-)我几乎从来没有设法从头开始编译一些东西而不需要几天的思考和垃圾邮件等。但我很快就习惯了许多不需要编译的项目,比如用 PHP、Python 或 JavaScript 编写。

我只是用代码做了一些事情。更改了一些重要的常量:-) 编写插件。任何。有一天我明白了,如果我从问题跟踪器中选择几乎任何任务,我将至少能够找出问题所在。

如果您只是阅读代码,您不会很好地了解它!即使是(好的)小说书也不能仅通过一遍又一遍地阅读来完全理解。

Docs for the source of OpenTTD: http://docs.openttd.org/ , they will be helpful.

Also, dev wiki: http://wiki.openttd.org/Development .

How to get familiar?

First, try compiling. Compile it to your platform and make sure it's running correctly.

Then, pick up a bug or something from to-do list and try to implement it, or just play the game and think about adding/changing something simple. Of course you can fail and want to change your task, but every try will be a step into understanding a structure of a project.


For me, the compiling part is most annoying part. I think it's because I'm on Windows :-) I've hardly ever managed to compile something from scratch without days of thinking and spamming people etc. But I quickly get used to many projects which aren't needed to be compiled, such as written in PHP or Python or JavaScript.

I just did something with the code. Changed some important constants :-) Writing plugins. Whatever. And one day I understood that now, If I choose almost any task from issue tracker, I'll be able to find out at least where the problem located.

If you're just reading code, you aren't gonna know it well! Even (good) fiction books can't be understood fully only by reading them again and again.

绳情 2024-08-23 16:23:07
  1. 下载代码。

  2. 在您最喜欢的 IDE 中设置它,以便它构建和运行。

  3. 在 main() 开头设置断点

  4. 花一些时间在调试器中单步执行:)

让您很好地了解事物是如何组合在一起的、依赖项在哪里以及在应用程序中执行操作时会发生什么。

  1. Download the code.

  2. Set it up in your favorite IDE so that it builds and runs.

  3. Set a breakpoint at the beginning of main()

  4. Spend some quality time stepping through in the debugger :)

Gives you a good feel for how things are put together, where the dependencies are, and what happens when you do things in the app.

溺渁∝ 2024-08-23 16:23:07

另一个好的策略是从您使用的某个软件开始,甚至是您依赖的软件。然后找到最烦人的错误并修复它。

Another good strategy is to start from some piece of software that you use, even one you rely on. Then find the most annoying bug, and fix it.

温柔女人霸气范 2024-08-23 16:23:07

很多时候,拥有大量草稿纸或某种形式的快速绘图工具会有所帮助 - 当您遇到事物时,勾勒出它们之间的关系。随着时间的推移,您将了解事物的布局方式以及事物之间的相互作用,有点像临时类图(但形式更加自由)。

选择一个您可以识别的起点:也许这是用户输入处理,也许这是程序的初始化序列 - 并从那里跟踪执行流程以了解事情是如何发生的。

希望源代码有有用的注释 - 甚至在 OpenTTD 的情况下,可能是 doxygen 风格的注释,这样你就可以获得一个不错的 其文档集

A lot of times it helps to have a lot of scratch paper, or some form of rapid diagramming tool - as you come across things, sketch out how they relate to each other. Over time you'll get a sense of how things are laid out and what interacts with what, sort of like an ad-hoc class diagram (but much more freeform).

Pick a starting point that is somewhere you can identify: maybe this is the user input processing, maybe it's the initialization sequence for the program - and trace the flow of execution from there to get an idea of how things happen.

Hopefully, the source code had helpful comments - maybe even, in OpenTTD's case, doxygen-style comments, so you can get a nice set of docs for it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文