Porting to C++ Request (Please read)

Information, contacts and source code for ports to Linux, Windows, etc.

Moderators: another_commander, winston

Post Reply
User avatar
CMDR_JohnJameson
Average
Average
Posts: 8
Joined: Thu Feb 18, 2021 8:07 pm

Porting to C++ Request (Please read)

Post by CMDR_JohnJameson »

Hello! I LOVE Elite and Oolite and I am trying to learn C++ and want to make a space game like Oolite!
I am a beginner (and a kid) and know nothing about porting a game or anything.
I would like if someone can make Oolite only in C++ and make a video tutorial explaining EVERYTHING like the code so I can learn how make a space game in C++ myself and change small parts to make it my own special game! (with proper credit to Oolite) I do not plan to do anything with this program but play it on my own computer.

Sorry if I don't make any sense, I am a stup*d kid that knows nothing trying to learn how to code C++ for a good job and to impress my other space game loving friends.
If you have any questions I will try to look when I am not in class.
User avatar
tsoj
Dangerous
Dangerous
Posts: 97
Joined: Wed May 18, 2016 8:19 pm
Location: Berlin
Contact:

Re: Porting to C++ Request (Please read)

Post by tsoj »

Porting Objective-C (which is the language Oolite is mainly written in) to C++ is not a trivial task. That starts with the issue that C++ has not 100% the same functionality as Objective-C.

Even if it doesn't seem like at the first glance, Oolite has quite a lot of code. So the C++ porting project would take really long (for a single person at least).

If you want to modify a C++ space game you could take a look at Pioneerspacesim. However, if you're just learning how to code in C++ I would suggest you start by writing your own projects, because understanding the code that other people wrote is arguably the hardest part of mastering a programming language.

If you want to write your own 3D space game it might be easier to use a game engine, so that you don't have to write your own graphics stuff. Because if you start from scratch with writing your own graphics engine in OpenGL or DirectX you only can start programming your actual game in a year. For example, I also once wanted to write my own space game, but I wanted to do everything by myself, including graphics. Well, I didn't get much further than displaying simple 3D objects with simple lightning.
A popular game engine would be Unity for example, or if you want to use an open-source engine, you can take a look at Godot.

If you want to modify Oolite you can create a mod/addon/OXP. This way you can use javascript to change many parts of the game.
Last edited by tsoj on Thu Feb 18, 2021 10:26 pm, edited 2 times in total.
User avatar
phkb
Commodore
Commodore
Posts: 2746
Joined: Tue Jan 21, 2014 10:37 pm
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...

Re: Porting to C++ Request (Please read)

Post by phkb »

G'day, CMDR_JohnJameson, and welcome to the boards.

I also grew up wanting to write my own space game, with Elite as the prime source material.

Porting a game to another language is not a trivial task, and writing a space game as your entry point into the world of C++ programming is quite ambitious. I do programming as part of my day job, and I can say, with some experience, that setting yourself such a tall goal to aim for will inevitably end in failure. To learn programming you need a lot of smaller goals, and easier projects.

And as one of the developers on the Oolite team, I can say that our time is pretty limited. A project to rewrite Oolite in C++, coupled with video tutorials of how everything is done, is not something any of us is up for. I, for one, don't know C++ myself (I normally code in C# and JS), so it would be a tough learning curve to start with. Leaving aside the intricacies of the Obj-C code-base, there is the matter of all those OXP's that players would want to include. Rewriting Oolite into any other language (not just C++) would most likely mean many OXP's would not be compatible (most likely because a rewrite would mean using more recent JS engines, which will likely break a lot of OXP JS code).

I don't want to dampen your obvious enthusiasm, or to put you off doing a C++ port. But for the current dev team, this isn't something we'll be able to take on.
User avatar
CMDR_JohnJameson
Average
Average
Posts: 8
Joined: Thu Feb 18, 2021 8:07 pm

Re: Porting to C++ Request (Please read)

Post by CMDR_JohnJameson »

Porting Objective-C (which is the language Oolite is mainly written in) to C++ is not a trivial task. That starts with the issue that C++ has not 100% the same functionality as Objective-C.

Even if it doesn't seem like at the first glance, Oolite has quite a lot of code. So the C++ porting project would take really long (for a single person at least).
Hmmm, I knew it would be hard to 'code for code' translate Obj-C to C++ but I will look at tutorials and try.
I do programming as part of my day job, and I can say, with some experience, that setting yourself such a tall goal to aim for will inevitably end in failure
I should try to set smaller goals as it probably will end in failure.
If you want to modify a C++ space game you could take a look at Pioneerspacesim. However, if you're just learning how to code in C++ I would suggest you start by writing your own projects, because understanding the code that other people wrote is arguably the hardest part of mastering a programming language
I don't want to modify a game (I do like Pioneer Space Sim!) I want to make my own using some of Oolite's code for my friends and I to play.
I have made some small C++ (and C#) console programs and am looking for new things to make, I have used Unity recently and am now looking at Unreal Engine, Unreal uses C++ and has amazing graphics, so I think I will look up some Unreal Engine tutorials and try to make my own Oolite that way.

Also, when I look at the Github nothing makes sense, for example, where is the main .c program? Main as in the file called program.cs that says stuff like

Code: Select all

Console.WriteLine("Hello World!");
Console.Write("How are you?: ");
Answer = Console.ReadLine();
that you compile? (Sorry if I am annoying) :(


Thank you for responding and really nice to talk to a developer of Oolite! o7! If you know of any tutorials or resources I can use, please let me know!

EDIT: Oops, I mean the .c program, idk why I have C# in my head..
o7 is a salute, o is the head, 7 is the arm!
o7 Cmdrs! See you in the black!

What I do: coding coding, blah blah blah, Done! Oh, it failed...
What others do: coding coding, wand-wave wand-wave, compile - no errors! yay!
Commander_X
---- E L I T E ----
---- E L I T E ----
Posts: 455
Joined: Sat Aug 09, 2014 4:16 pm

Re: Porting to C++ Request (Please read)

Post by Commander_X »

CMDR_JohnJameson wrote: Thu Feb 18, 2021 10:57 pm [...] Also, when I look at the Github nothing makes sense, for example, where is the main .c program? [...]
I know this, let me: you won't find a "main .c" program, because Objective-C has a "main.m" program :twisted: For Oolite you'll find it in src/Core/SDL folder of the source code.

Welcome to the boards!
User avatar
CMDR_JohnJameson
Average
Average
Posts: 8
Joined: Thu Feb 18, 2021 8:07 pm

Re: Porting to C++ Request (Please read)

Post by CMDR_JohnJameson »

Commander_X wrote: Fri Feb 19, 2021 2:46 am
CMDR_JohnJameson wrote: Thu Feb 18, 2021 10:57 pm [...] Also, when I look at the Github nothing makes sense, for example, where is the main .c program? [...]
I know this, let me: you won't find a "main .c" program, because Objective-C has a "main.m" program :twisted: For Oolite you'll find it in src/Core/SDL folder of the source code.

Welcome to the boards!
Ah! Thank you so much! :D
o7 is a salute, o is the head, 7 is the arm!
o7 Cmdrs! See you in the black!

What I do: coding coding, blah blah blah, Done! Oh, it failed...
What others do: coding coding, wand-wave wand-wave, compile - no errors! yay!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5869
Joined: Wed Feb 28, 2007 7:54 am

Re: Porting to C++ Request (Please read)

Post by another_commander »

@CMDR_JohnJameson: If you are interested in the source code's documentation, you can obtain it using the Doxygen program. It reads through the source and generates a very detailed description for it, including flow diagrams showing how every function and class is related to everything else. The generated documentation weighs around 650 MB and is in HTML format, i.e. viewable using a standard web browser. I have the documentation corresponding to what we had at around 2018 here and can make it available for you (or anyone else who might be interested) to have a look next week if you want.

And a minor correction, the game's entry point main function is in main.m which is in src/SDL (not src/Core/SDL).
User avatar
CMDR_JohnJameson
Average
Average
Posts: 8
Joined: Thu Feb 18, 2021 8:07 pm

Re: Porting to C++ Request (Please read)

Post by CMDR_JohnJameson »

Ah! Thank you! This will really help!
When I went in to the src I saw a Core and SDK and looked in both, found a main.m in the SDK one but still good to know that I am looking in the right one. Thanks everyone! :o
o7 is a salute, o is the head, 7 is the arm!
o7 Cmdrs! See you in the black!

What I do: coding coding, blah blah blah, Done! Oh, it failed...
What others do: coding coding, wand-wave wand-wave, compile - no errors! yay!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 5869
Joined: Wed Feb 28, 2007 7:54 am

Re: Porting to C++ Request (Please read)

Post by another_commander »

I managed to get me a few moments to set this up, so here is the download link for the Widows port source code documentation:

http://wiki.alioth.net/img_auth.php/8/8 ... Source.oxz

Once you download it, just change the file extension from .oxz to .zip, then unzip the contents in any folder you want. You can launch the documentation by running the file index.html found inside the html folder.

While I was there, I added this information to the wiki as well (page: Developing Oolite, Documentation section) for future reference.

Hope this helps.
User avatar
CMDR_JohnJameson
Average
Average
Posts: 8
Joined: Thu Feb 18, 2021 8:07 pm

Re: Porting to C++ Request (Please read)

Post by CMDR_JohnJameson »

Thank you so much!
o7 is a salute, o is the head, 7 is the arm!
o7 Cmdrs! See you in the black!

What I do: coding coding, blah blah blah, Done! Oh, it failed...
What others do: coding coding, wand-wave wand-wave, compile - no errors! yay!
Post Reply