The big picture and mentoring
Moderator: OpenTTD Developers
The big picture and mentoring
I hope that somebody can be kind enough to point me to the information that describes the running of the game on the general level.
I am looking for something that would give me the big picture of the code so I could have a starting point to thread into the code base.
Perhaps somebody is also willing to do some mentoring to help to get going.
I am looking for something that would give me the big picture of the code so I could have a starting point to thread into the code base.
Perhaps somebody is also willing to do some mentoring to help to get going.
Re: The big picture and mentoring
not sure what you're aiming for here. you won't find a person who has read every single piece of the code.
if your aim is to "get your feet wet", then maybe look at the github category for "good first issue". otherwise, you get a "big picture" usually by getting lots of smaller pictures, e.g. by looking up what other people have done.
if your aim is to "get your feet wet", then maybe look at the github category for "good first issue". otherwise, you get a "big picture" usually by getting lots of smaller pictures, e.g. by looking up what other people have done.
Re: The big picture and mentoring
Mainly the big picture = broad architecture of the game, how things come together.Eddi wrote:not sure what you're aiming for here. you won't find a person who has read every single piece of the code.
For example where is the main game cycle defined (that runs through all the items and makes them do what they should do)? Or there appears to be a naming convention like _cmd, _gui, _func etc, what is the function of such files? And so on.
This is exactly what I am trying to avoid to do. I do not want reverse engineer the the game architecture. It would take me unreasonable amount of time (that I do not have much to spend).Eddi wrote:otherwise, you get a "big picture" usually by getting lots of smaller pictures, e.g. by looking up what other people have done.
Knowing the architecture would give tremendous help for figuring out the small parts.
Re: The big picture and mentoring
luxtram wrote:
This is exactly what I am trying to avoid to do. I do not want reverse engineer the the game architecture. It would take me unreasonable amount of time (that I do not have much to spend).
No it doesn't take unreasonable amount of time. Been there, done that. And knowing broad architecture doesn't help you find where you need to make the change anyway, because the game is huge.
Just read it, really. OpenTTD, especially vanilla, has a very good structure as much as C++ allow it to be.
Also, I don't even know where the game main loop is, and I have written patch as well as making my own modification fine without it.
Btw, _gui is, well, where GUI for the game is defined. _cmd is for command. Any changes make to game need to be done through command, usually defined in file end with _cmd, so that the multiplayer work. (This is a very common pattern in multi-player game/networked application)
Not really, no.luxtram wrote: Knowing the architecture would give tremendous help for figuring out the small parts.
EDIT: And OpenTTD follow most common pattern use in game/network programming anyway. Unless you are totally new to this kind of program (which I assume you don't since you know what main loop is), then you shouldn't have any problem.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: The big picture and mentoring
In order to add what was said:
the main loop is - big surprise - in openttd.cpp. Yet looking at that loop never has helped my with anything really; it is so abstract that it usually is not helpful to look at. Maybe there's one exception: when I was trying to understand where the (OSX) screendriver hooked into the system... but even then it's far from that.
Generally: If you look for anything in particular: use a search tool to search the whole code base for whatever might be a good starting point. You look for NewGRF stuff? 'newgrf' will be in the filename. Fiddling with cargo amount? Grep for 'CARGO'. Etc etc.
the main loop is - big surprise - in openttd.cpp. Yet looking at that loop never has helped my with anything really; it is so abstract that it usually is not helpful to look at. Maybe there's one exception: when I was trying to understand where the (OSX) screendriver hooked into the system... but even then it's far from that.
Generally: If you look for anything in particular: use a search tool to search the whole code base for whatever might be a good starting point. You look for NewGRF stuff? 'newgrf' will be in the filename. Fiddling with cargo amount? Grep for 'CARGO'. Etc etc.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: The big picture and mentoring
I jumped into the code about a year ago or a little less, and while there's still large chunks I've barely looked at, I've learned a bunch in that time.
What helped me learn was first and foremost, having a clear goal in mind for a change I wanted to make. To help me get that done I used the code exploration tools in the Visual Studio IDE, to find related code and definitions to what I was looking at.
In other worse, I started "inside-out", until I got to the point where I could look at the code "outside-in". There's still lots of black boxes for me.
Anyway, the _cmd files contain most of the core game logic. The _gui files contain most of the core interaction logic. The video drivers contain most of the OS-specific input and graphics output stuff, including controlling game loop timing.
OTTD is a large code base, focus on the parts of it that you find interesting, that's the best way to learn it in my experience.
What helped me learn was first and foremost, having a clear goal in mind for a change I wanted to make. To help me get that done I used the code exploration tools in the Visual Studio IDE, to find related code and definitions to what I was looking at.
In other worse, I started "inside-out", until I got to the point where I could look at the code "outside-in". There's still lots of black boxes for me.
Anyway, the _cmd files contain most of the core game logic. The _gui files contain most of the core interaction logic. The video drivers contain most of the OS-specific input and graphics output stuff, including controlling game loop timing.
OTTD is a large code base, focus on the parts of it that you find interesting, that's the best way to learn it in my experience.
- This is my name
- Director
- Posts: 515
- Joined: 17 Sep 2008 01:36
- Location: SOMEWHERE IN LINGGI
- Contact:
Re: The big picture and mentoring
Peace be upon you.
From what is here, the game came to be from stitching one parcel after another?
Peace be upon you.
From what is here, the game came to be from stitching one parcel after another?
Peace be upon you.
usecubes.com 3-D Pixel Design Software
Re: The big picture and mentoring
I just came across this: http://www.maizure.org/projects/decoded ... index.html
It's an extremely well written article that covers a surprising amount of the codebase and how it all fits together
It's an extremely well written article that covers a surprising amount of the codebase and how it all fits together
AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
- orudge
- Administrator
- Posts: 25138
- Joined: 26 Jan 2001 20:18
- Skype: orudge
- Location: Banchory, UK
- Contact:
Re: The big picture and mentoring
Very interesting, a fascinating and very well written article indeed.
- Simons Mith
- Transport Coordinator
- Posts: 326
- Joined: 14 Jan 2010 23:45
Re: The big picture and mentoring
This is the first time in my life I have ever seen someone ask, 'Can I get a comprehensive overview of a game?' and then get something even remotely close to what they asked for.
Statistically I don't expect to see it happen twice.
Statistically I don't expect to see it happen twice.
Re: The big picture and mentoring
Funny, I believe he asked for something else.Simons Mith wrote:This is the first time in my life I have ever seen someone ask, 'Can I get a comprehensive overview of a game?' and then get something even remotely close to what they asked for.
Statistically I don't expect to see it happen twice.
Who is online
Users browsing this forum: No registered users and 48 guests