How to edit source - windows
Moderators: winston, another_commander
-
- Poor
- Posts: 6
- Joined: Sun Feb 03, 2019 2:14 pm
How to edit source - windows
Hi all. Apologies if I'm being incredibly stupid, but need help and I've read in many places how friendly everyone in the oolite community is, so let's put that to the test
I really want to play with the source of oolite a little bit but I'm struggling with how to set it up. I'm only really familiar with the absolute basics of MS Visual Studio as an IDE/code editor. What is the accepted way of playing with the source on Windows?
I've downloaded the dev environment as put together by another_commander in the 'building oolite windows from source' topic, but so far I've had to use notepad++ to edit files individually which makes it difficult (for me) to find all the different references in code. I've searched for about a day but can't find anything helpful on the internet. Can anyone offer any advice with what code editor to use to manage the project?
Sorry for such a basic question :/ Oh and Oolite is looking amazing these days. Kudos to everyone involved.
edit: also, is the IRC channel still in use? I couldn't connect to it just now.
I really want to play with the source of oolite a little bit but I'm struggling with how to set it up. I'm only really familiar with the absolute basics of MS Visual Studio as an IDE/code editor. What is the accepted way of playing with the source on Windows?
I've downloaded the dev environment as put together by another_commander in the 'building oolite windows from source' topic, but so far I've had to use notepad++ to edit files individually which makes it difficult (for me) to find all the different references in code. I've searched for about a day but can't find anything helpful on the internet. Can anyone offer any advice with what code editor to use to manage the project?
Sorry for such a basic question :/ Oh and Oolite is looking amazing these days. Kudos to everyone involved.
edit: also, is the IRC channel still in use? I couldn't connect to it just now.
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: How to edit source - windows
Welcome aboard, Commander! Hopefully, a boffin will be along shortly.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: How to edit source - windows
Welcome aboard, commander!
Re: irc - I believe this is still available, but it's a little under-utilised at the moment. I've been checking into the Oolite Discord channel most days, but I haven't logged into irc for a while (PC was rebuilt and haven't reinstalled the client). The BB is probably your best bet for getting your questions answered quickly.
Re: dev environment. For my purposes I use VS Code, but I've also used Notepad++. I find the VS Code environment more familiar and easier to work with given my Microsoft dev environment background. However, I haven't really explored all the potential in this environment, sticking to doing small edits of individual files. Most of the changes I've pushed into the source have been small, so this has worked well enough for me.
Re: irc - I believe this is still available, but it's a little under-utilised at the moment. I've been checking into the Oolite Discord channel most days, but I haven't logged into irc for a while (PC was rebuilt and haven't reinstalled the client). The BB is probably your best bet for getting your questions answered quickly.
Re: dev environment. For my purposes I use VS Code, but I've also used Notepad++. I find the VS Code environment more familiar and easier to work with given my Microsoft dev environment background. However, I haven't really explored all the potential in this environment, sticking to doing small edits of individual files. Most of the changes I've pushed into the source have been small, so this has worked well enough for me.
-
- Quite Grand Sub-Admiral
- Posts: 6696
- Joined: Wed Feb 28, 2007 7:54 am
Re: How to edit source - windows
Welcome aboard!
Yup, building Oolite on Windows requires the provided Dev Environment and a text editor of your choice. Notepad++ is what most people use these days and is a great tool overall (I use this as well). I usually use the Find and Find in Files capabilities of Notepad++ to find things in the source and the editor can also be used to set up projects in a form similar, albeit much simplified compared to MS Visual Studio. Maybe newer versions of the editor have more advanced capabilities, but I generally work with a relatively old version. I know that newer versions have auto-complete functionality, which is a very helpful thing.
Other editors / IDEs you may want to look at could be Atom, Eclipse and Visual Studio Code. You will have to find the one you feel more comfortable with and go for it.
Yup, building Oolite on Windows requires the provided Dev Environment and a text editor of your choice. Notepad++ is what most people use these days and is a great tool overall (I use this as well). I usually use the Find and Find in Files capabilities of Notepad++ to find things in the source and the editor can also be used to set up projects in a form similar, albeit much simplified compared to MS Visual Studio. Maybe newer versions of the editor have more advanced capabilities, but I generally work with a relatively old version. I know that newer versions have auto-complete functionality, which is a very helpful thing.
Other editors / IDEs you may want to look at could be Atom, Eclipse and Visual Studio Code. You will have to find the one you feel more comfortable with and go for it.
-
- Poor
- Posts: 6
- Joined: Sun Feb 03, 2019 2:14 pm
Re: How to edit source - windows
Thanks everyone, that is a great help and much appreciated.
I'll give VS Code a go i think as i spent quite a while getting used to VS so it may make the transition easier for me (although i didn't even know notepad++ had a search files option - i'll look at that too). So I imagine that to compile and run, after editing the source in whatever text editor, it's basically the 'make' command again in the dev environment another_commander posted? That makes sense.
Sorry for the simple question - I've always found this initial set up to be my biggest hurdle to any experimentation with programming - thank goodness for that easy dev environment pack doing most of the work then.
Thanks again everyone.
I'll give VS Code a go i think as i spent quite a while getting used to VS so it may make the transition easier for me (although i didn't even know notepad++ had a search files option - i'll look at that too). So I imagine that to compile and run, after editing the source in whatever text editor, it's basically the 'make' command again in the dev environment another_commander posted? That makes sense.
Sorry for the simple question - I've always found this initial set up to be my biggest hurdle to any experimentation with programming - thank goodness for that easy dev environment pack doing most of the work then.
Thanks again everyone.
-
- Poor
- Posts: 6
- Joined: Sun Feb 03, 2019 2:14 pm
Re: How to edit source - windows
@phkb and @another_commander. Have you guys got an environment set up to be able to compile the code from your code editor and/or do step-through debugging and breakpoints? I'm basically looking to step through the code to see what it's doing - i'm not familiar with objective C and seeing it in action might help me figure out what it's doing.
-
- Quite Grand Sub-Admiral
- Posts: 6696
- Joined: Wed Feb 28, 2007 7:54 am
Re: How to edit source - windows
I always compile outside of the editor, using 'make debug=no' or 'make debug=yes', depending on how low level debugging is necessary. Stepping through the code and breakpoints are handled with the GNU Debugger (gdb), which is included in the environment. A normal session with gdb goes usually one of two ways:emptyhead41 wrote: ↑Mon Feb 04, 2019 6:34 pm@phkb and @another_commander. Have you guys got an environment set up to be able to compile the code from your code editor and/or do step-through debugging and breakpoints? I'm basically looking to step through the code to see what it's doing - i'm not familiar with objective C and seeing it in action might help me figure out what it's doing.
1) When trying to debug a crash:
- From the DevEnv shell, cd to the folder with the Oolite binary:
cd <rootOolitePath>/oolite.app
- Then, run gdb and tell it to load up the Oolite executable:
gdb oolite.exe
- Run the game:
run
- Get it to the point of crash. Instead of a CTD or the "Application has stopped working and Windows is shutting it down, yo" window, you will see something like "Program received SIGSEGV at 0xdeadb00b" in the shell and see the gdb prompt. At this point, you just type "bt" and you will receive the backtrace leading up to the point of crash.
2) When setting and using a breakpoint:
- First two steps same as above
- Before running the game set a gdb breakpoint using the break command, e.g.
break src/Core/Entities/PlayerEntity.m:500
, which sets a breakpoint at line 500 of the file named PlayerEntity.m.- Run the game:
run
- When the program flow reaches line 500 of PlayerEntity. execution will break. You can then use other gdb commands to set values to variables, step through the code either by line or by function, watch variables as they change, retrieve backgtrace if required etc. Check out resources like this one for more information on how gdb is used and what commands are available.
Be aware that running the game through gdb is painfully slow due to the way memory is tracked during program execution. Load times are extremely long compared to running outside of gdb and frames per second drop by almost one third. Quitting the debugging session is as simple as executing the
quit
command in the gdb prompt.Yes, it is not simple, it requires some studying and is most definitely not as user friendly as Visual Studio. But it works across both Windows and Linux alike. Hopefully this helps and feel free to ask if you get stuck.
-
- Quite Grand Sub-Admiral
- Posts: 6696
- Joined: Wed Feb 28, 2007 7:54 am
Re: How to edit source - windows
I had a mistake in my instructions. Running the game through gdb is achieved by using the run command, not by typing its filename. Fixed above.
-
- Poor
- Posts: 6
- Joined: Sun Feb 03, 2019 2:14 pm
Re: How to edit source - windows
Amazing! Thank you so much! That is a really brilliantly concise and helpful list of info.
Is there somewhere on this forum where people talk about the development they're doing? I see you've been doing some work with shaders for the planets? Or I could be totally wrong - my programming skills haven't really levelled up much from the days of programming some pascal back in the day and some java output to console :p
Can I just say as well, oolite is a very polished bit of work at the moment. I'm immensely impressed by how professional it all is. Coding wise it seems very well organised. The OXPs people have made and what has been made available to scripting in particular is amazing. Everyone involved must be very proud. The trouble is, it's also very fun to play instead of digging around in the source :p
Is there somewhere on this forum where people talk about the development they're doing? I see you've been doing some work with shaders for the planets? Or I could be totally wrong - my programming skills haven't really levelled up much from the days of programming some pascal back in the day and some java output to console :p
Can I just say as well, oolite is a very polished bit of work at the moment. I'm immensely impressed by how professional it all is. Coding wise it seems very well organised. The OXPs people have made and what has been made available to scripting in particular is amazing. Everyone involved must be very proud. The trouble is, it's also very fun to play instead of digging around in the source :p
-
- Quite Grand Sub-Admiral
- Posts: 6696
- Joined: Wed Feb 28, 2007 7:54 am
Re: How to edit source - windows
Thanks for the kind words, really appreciated. Feel free to use Testing and Bug Reports or Discussion for anything development related,depending on whether you are fixing bugs or adding new stuff, there are no strict rules about it. If what you are doing is not cross-platform and works only on Windows, then Oolite-PC would probably be best. Any new features that end up in the official master branch are normally announced in the Progress thread under the Discussion subforum. Oh and yes, there has been some work recently on improving the planet shaders a bit. Right now we are at a point where I feel quite happy with the result. There is always room for even more improvements though.
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: How to edit source - windows
<buffs nails> Not that I had anything to do with it - just a dumb pilot, me!emptyhead41 wrote: ↑Tue Feb 05, 2019 2:51 pmCan I just say as well, oolite is a very polished bit of work at the moment. I'm immensely impressed by how professional it all is.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!