Source Code and Ideas question
Moderators: winston, another_commander
Source Code and Ideas question
Hi All,
Still very much a noob but been making some progress with OXPs but much of what I want to change requires a source code change and for the life of me, I cant figure any of it out. The only file that seems to be the main source code one is called project.pbxproj but all that one seems to is read in a lot of files e.g.
/* Begin PBXBuildFile section */
083325DD09DDBCDE00F5B8E4 /* OOColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 083325DB09DDBCDE00F5B8E4 /* OOColor.h */; };
083325DE09DDBCDE00F5B8E4 /* OOColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 083325DC09DDBCDE00F5B8E4 /* OOColor.m */; };
0865431C06B8447D000CA0AB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
Hence I have no idea where to find the piece of code that limits the maximum amount of gems you can sell to 127g.
Another thing I want to do is change the amount and names of elite rankings (e.g. there might be say 8 from harmless to elite, and I want to have 15) and increase the players legal status from the 3 basic ones (clean - fugitive) to say to say 8 with varying degrees of bounty hunter and police interest. Also want to have a random chance of a players legal status changing from clean to something else, even if the police aren't around. Ie the ship under attack launches a distress signal which might get picked up eventually by police. The police would then question you and depending on your answers, maybe even if your still carrying the cargo you stole (as it would be stamped with the ship's ID you stole it from) your legal status might change. Appreciate this might not be an easy thing to answer but if theres anything I can read up on or a few basic pointers people can give, that would be fantastic.
Still very much a noob but been making some progress with OXPs but much of what I want to change requires a source code change and for the life of me, I cant figure any of it out. The only file that seems to be the main source code one is called project.pbxproj but all that one seems to is read in a lot of files e.g.
/* Begin PBXBuildFile section */
083325DD09DDBCDE00F5B8E4 /* OOColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 083325DB09DDBCDE00F5B8E4 /* OOColor.h */; };
083325DE09DDBCDE00F5B8E4 /* OOColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 083325DC09DDBCDE00F5B8E4 /* OOColor.m */; };
0865431C06B8447D000CA0AB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
Hence I have no idea where to find the piece of code that limits the maximum amount of gems you can sell to 127g.
Another thing I want to do is change the amount and names of elite rankings (e.g. there might be say 8 from harmless to elite, and I want to have 15) and increase the players legal status from the 3 basic ones (clean - fugitive) to say to say 8 with varying degrees of bounty hunter and police interest. Also want to have a random chance of a players legal status changing from clean to something else, even if the police aren't around. Ie the ship under attack launches a distress signal which might get picked up eventually by police. The police would then question you and depending on your answers, maybe even if your still carrying the cargo you stole (as it would be stamped with the ship's ID you stole it from) your legal status might change. Appreciate this might not be an easy thing to answer but if theres anything I can read up on or a few basic pointers people can give, that would be fantastic.
Re: Source Code and Ideas question
You need to look through the .h and .m files in Core folder.
Re: Source Code and Ideas question
hangar18 wrote:Hence I have no idea where to find the piece of code that limits the maximum amount of gems you can sell to 127g.
src/Core/Entities/PlayerEntity.m
in the trySellingCommodity
method, and a few other places in the same file.
The rank levels are defined, in hexadecimal, inhangar18 wrote:Another thing I want to do is change the amount and names of elite rankings (e.g. there might be say 8 from harmless to elite, and I want to have 15)
src/Core/OOConstToString.m
in the OODisplayRatingStringFromKillCount
function. The names of the ranks that function gets from Resources/Config/descriptions.plist
Same as rating, but thehangar18 wrote:and increase the players legal status from the 3 basic ones (clean - fugitive) to say to say 8 with varying degrees of bounty hunter and police interest.
OODisplayStringFromLegalStatus
function.Note that there are already varying degrees of interest - the low end of the offender scale gets much less harsh treatment than the high end, especially in the less safe systems: most police and bounty hunter calculations use the bounty level rather than its name.
That one is OXPable without further source changes. Use worldscript events to track the player doing something illegal and not being directly caught, then run some mission screens to question the player when they next dock and increase their bounty through JS on a "wrong" answer.hangar18 wrote:Also want to have a random chance of a players legal status changing from clean to something else, even if the police aren't around. Ie the ship under attack launches a distress signal which might get picked up eventually by police. The police would then question you and depending on your answers, maybe even if your still carrying the cargo you stole (as it would be stamped with the ship's ID you stole it from) your legal status might change.
EDIT:
project.pbxproj
is the project definition if you're on a Mac and using XCode to build it. Unless you're on a Mac and needing to add entirely new source code files, it doesn't need changing.Re: Source Code and Ideas question
Look at this thread, more specifically at this post by cim:Another thing I want to do is change the amount and names of elite rankings (e.g. there might be say 8 from harmless to elite, and I want to have 15)
If you manage to do it, I will worship you forever, in addition to some more people!Probably the dictionary is a red herring if you're doing it with two separate arrays in description.plist. Instead, assuming that the two arrays remain in ascending order of kills:
1) Iterate over the ratingKills array until you find an index with more kills than the player currently has.
1b) If you don't find any such index in the array, then the player is at maximum rank.
2) Subtract one from that index, and select the string with that number from the ratingNames array.
3) Get DisplayRatingStringFromKillCount to return that string rather than the one it currently does.
Re: Source Code and Ideas question
Many thanks guys, this is really helpful!
Re: Source Code and Ideas question
Next silly question....how do I compile the changes into an executable or even just run them? The help files say I need to uninstall my existing oolite (which is the 1.77.1 package) and the Win32 installer doesn't seem to do anything.
What I want to test is that changing the elite rankings (original below) is simply a case of changing the hexadecimal numbers and inserting a few more to the 9 listed below to get say 15 (naturally also increasing the names in the relevant Plist file too).
NSArray *ratingNames = nil;
const unsigned killThresholds[kRatingCount - 1] =
{
0x0008,
0x0010,
0x0020,
0x0040,
0x0080,
0x0200,
0x0A00,
0x1900
};
unsigned i;
What I want to test is that changing the elite rankings (original below) is simply a case of changing the hexadecimal numbers and inserting a few more to the 9 listed below to get say 15 (naturally also increasing the names in the relevant Plist file too).
NSArray *ratingNames = nil;
const unsigned killThresholds[kRatingCount - 1] =
{
0x0008,
0x0010,
0x0020,
0x0040,
0x0080,
0x0200,
0x0A00,
0x1900
};
unsigned i;
Re: Source Code and Ideas question
If you're on Windows, you'll need to make the build environment first. The easy way is to do this is to download the ready-made one which another_commander has put together - see this thread for instructions. Then keep following the instructions to compile. Once that works, make your source changes, compile it again, and see if it worked.hangar18 wrote:Next silly question....how do I compile the changes into an executable or even just run them?
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Source Code and Ideas question
Here are the instructions you are looking for: https://bb.oolite.space/viewtopic.php?f=8&t=5943.hangar18 wrote:Next silly question....how do I compile the changes into an executable or even just run them? The help files say I need to uninstall my existing oolite (which is the 1.77.1 package) and the Win32 installer doesn't seem to do anything.
Re: Source Code and Ideas question
Many thanks!
Re: Source Code and Ideas question
Thanks guys but after step 2
git clone https://github.com/OoliteProject/oolite.git
it asks for a username and password. I tried my own login/password for this forum but didn't work. Any ideas?
git clone https://github.com/OoliteProject/oolite.git
it asks for a username and password. I tried my own login/password for this forum but didn't work. Any ideas?
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Re: Source Code and Ideas question
You need to sign up for your own free github account here first:
https://github.com/
then use those login details when you pull the source..
https://github.com/
then use those login details when you pull the source..
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Re: Source Code and Ideas question
THanks, presumably the source code that gets pulled from there is the latest ie 1.77.1?
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Re: Source Code and Ideas question
It depends on which branch(es) you pull. "Master" will give you 1.79, which is the current development branch that will one day become 1.80. If you want 1.77.1 you'd have to pull "maintenance/1.77", which is the branch that will one day become 1.78, when the devs decide it has spent enough time in the bugfix finding/fixing zone.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Re: Source Code and Ideas question
Sorry...another silly question -- how do I put either the master 1.79 or Maintenance 1.77.1 into my repository. I've tried searching in the pull request tab both in the Explore and Find a repository but it either returns nothing or 10000s of records.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: Source Code and Ideas question
You do not need a github account to download the source, unless you are one of the developers with commit rights. Many people without github accounts have built from source already, so we know that the instructions do work. hangar18, what is the actual message you are getting? Have you followed the instructions exactly as shown in the first post of the thread we linked you to?
Also, pull requests are not related to downloading the source for casual users, they are requests from people who have made changes to the code in their own external repositories, asking us to pull their changes in. Once you have pulled the entire repository, you can change to any of the existing branches using
Also, pull requests are not related to downloading the source for casual users, they are requests from people who have made changes to the code in their own external repositories, asking us to pull their changes in. Once you have pulled the entire repository, you can change to any of the existing branches using
git checkout <branchname>
.