Musings about stuff that I could do to the source code...

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Musings about stuff that I could do to the source code..

Post by Thargoid »

To clarify a few of the earlier posts - TCAT doesn't let you fly any kind of Thargoid ship, and if you want player-launchable Thargons, get Armoury.oxp and some Captured Thargons therein...
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

I managed to create a playble Thargoid Warship last night, using Griff's version as a template. The View points and weapons positions probably need some adjusting but it works and can dock/launch from the station. I have still not yet been able to decypher why the Thargoid Laser will not cause any damage when using it on a player ship, there is nothing in the code to suggest why this is happening either. I have copared the firemainweapon code between PlayerEntity.m and ShipEntity.m and there is nothing in there either to suggest this. Even the firedirectshot code in ShipEntity.m looks fine so I am at a total loss to explain this.

I also tried playing around with an idea pagroove had about making aqua space - but I could not figure out how I would make space blue! So no Frontier/FFE space backgrounds any time soon... :lol: Must be possible though as when you fly near a planet into its atmosphere space turns blue then white so must be possible but couldn't find code that made this happen.
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Musings about stuff that I could do to the source code..

Post by Switeck »

General food-for-thought about the value of "nosing around in" the source code:
http://www.codinghorror.com/blog/2012/0 ... -luke.html
http://news.ycombinator.com/item?id=3769446
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6667
Joined: Wed Feb 28, 2007 7:54 am

Re: Musings about stuff that I could do to the source code..

Post by another_commander »

Pleb wrote:
I have still not yet been able to decypher why the Thargoid Laser will not cause any damage when using it on a player ship, there is nothing in the code to suggest why this is happening either. I have copared the firemainweapon code between PlayerEntity.m and ShipEntity.m and there is nothing in there either to suggest this. Even the firedirectshot code in ShipEntity.m looks fine so I am at a total loss to explain this.
Haven't tried it to confim it works, but moving the case WEAPON_THARGOID_LASER: at line 4136, -fireMainWeapon method in PlayerEntity.m about four lines up, right after the case WEAPON_MILITARY_LASER: should allow it to execute the fireLaserShotInDirection: method, which contains the code for dealing weapon damage.
I also tried playing around with an idea pagroove had about making aqua space - but I could not figure out how I would make space blue! So no Frontier/FFE space backgrounds any time soon... :lol: Must be possible though as when you fly near a planet into its atmosphere space turns blue then white so must be possible but couldn't find code that made this happen.
The sky color is set in various places, but I think (again, haven't cross-checked, could be wrong) that the first place to look at for setting the sky color when in space (i.e. 99% of the time) should be in Universe.m, method -setUpSpace, around line 913:

Code: Select all

[self setSkyColorRed:0.0f
      green:0.0f
	   blue:0.0f
	   alpha:0.0f];
Hope this helps.
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

another_commander wrote:
Haven't tried it to confim it works, but moving the case WEAPON_THARGOID_LASER: at line 4136, -fireMainWeapon method in PlayerEntity.m about four lines up, right after the case WEAPON_MILITARY_LASER: should allow it to execute the fireLaserShotInDirection: method, which contains the code for dealing weapon damage.
I already tried this, actually was the first thing I did! For some reason, it will fire a shot at a targeted ship, but will not register that the shot in fact hit the ship. Without a target though, the laser will increase the weapon temperature but not be drawn on the screen. Thank you though for suggesting this, I'm glad you thought the same thing I did!
another_commander wrote:
The sky color is set in various places, but I think (again, haven't cross-checked, could be wrong) that the first place to look at for setting the sky color when in space (i.e. 99% of the time) should be in Universe.m, method -setUpSpace, around line 913:

Code: Select all

[self setSkyColorRed:0.0f
      green:0.0f
	   blue:0.0f
	   alpha:0.0f];
Hope this helps.
I tried messing with this as well, but again the sky remains black. It must be, as you said, referenced in a few places and I would obviously need to find all references to the sky being defined as black. Seems we have the same ideas! Shame, I wanted to post a screenshot of an Imperial Courier in blue space in the screenshots thread to see if anyone got the reference. :D
Switeck wrote:
General food-for-thought about the value of "nosing around in" the source code:
http://www.codinghorror.com/blog/2012/0 ... -luke.html
http://news.ycombinator.com/item?id=3769446
Read the source, Luke! Haha thanks for that Switeck. :lol:
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Musings about stuff that I could do to the source code..

Post by Eric Walch »

Pleb wrote:
I also tried playing around with an idea pagroove had about making aqua space - but I could not figure out how I would make space blue!
.....Must be possible though as when you fly near a planet into its atmosphere space turns blue then white so must be possible but couldn't find code that made this happen.
The specific atmosphere colors are set in.. planetEntity. I think this updating makes that it keeps black.

In trunk with the new planets (OOplanetEntity.m), the sky is only blue on the sunside of the planet. When traveling to the dark side, you even get a twilight zone. :lol:
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

Eric Walch wrote:
The specific atmosphere colors are set in.. planetEntity. I think this updating makes that it keeps black.

In trunk with the new planets (OOplanetEntity.m), the sky is only blue on the sunside of the planet. When traveling to the dark side, you even get a twilight zone. :lol:
Ah thanks for that Eric! To be honest I've hardly looked in the trunk as when I first started playing with the source I encountered a bug so I started using the 1.76.1 code. Perhaps I would be better exploring the trunk code instead in order to keep up with more recent developments.
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6667
Joined: Wed Feb 28, 2007 7:54 am

Re: Musings about stuff that I could do to the source code..

Post by another_commander »

Sky color is controlled by Universe -update: method, here (approx. line 5300 in current trunk):

Code: Select all

skyClearColor[0] = 0.0;
skyClearColor[1] = 0.0;
skyClearColor[2] = 0.0;    // changed this to 0.2 for below screenie
skyClearColor[3] = 0.0;
Image


At least we can scratch that from the list ;-)
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

Haha! Wow thanks for that, makes it seem eerilly like Frontier now. Except for the evil newtronian physics, I will certainly not be trying to implement that into Oolite lol what a headache... I'm guessing that with some tweaking this 'might' be configuable from the planetinfo.plist as that would make for interesting space settings where you could change the colour of the space background. I will have to explore this prospect later when I get home though. Thank you again for finding that out A_C, I obviously wasn't trying hard enough last night. (Although it was gone midnight!)
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

Another thing I was playing around with last night was the Twin Plasma Cannon. I'd always seen it in equipment.plist and assumed it was broken so I modified its entry and fitted it to my ship - now I see why it wasn't included in the release! Actually trying to hit a ship with it is so hard, and it drains the energy banks so that I ended up being destroyed by the police I was trying to destroy. Having the plasma cannon fitted onto just turrets is much better. An interesting idea I had with the weapons though was if you could have them referenced in a plist rather than coded into the game would possibly allow for extra weapons to be added via OXPs. However, from what I can tell this would require a serious reworking of the current code and I'm not even sure it would be possible. Still, would be good to have new weapon types...
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6667
Joined: Wed Feb 28, 2007 7:54 am

Re: Musings about stuff that I could do to the source code..

Post by another_commander »

Pleb wrote:
[...] this would require a serious reworking of the current code and I'm not even sure it would be possible.
The Source is Power. Once you gain access to it, there is nothing that cannot be done, given sufficient time and persistence.
User avatar
Pleb
---- E L I T E ----
---- E L I T E ----
Posts: 908
Joined: Sun Apr 29, 2012 2:23 pm
Location: United Kingdom

Re: Musings about stuff that I could do to the source code..

Post by Pleb »

another_commander wrote:
The Source is Power. Once you gain access to it, there is nothing that cannot be done, given sufficient time and persistence.
Haha this is true, would be good if I could figure it out. I can now create new plist files and get the code to reference them in the game, so I know I could write a plist with data entries for weapons its just how to go about it all... I'm still in the process of perfecting loading different save games at the start of the game so maybe when I've cracked that the weapons will seem a lot easier. I can get the game to load a specified start game at the beginning, essentially overriding the start game settings by loading a saved game in a specified folder. Now I need to figure out a way of presenting a list of other start games to the player. One idea I had was to replicate the Load Commander GUI, but I would prefer it if this looked a bit different. Still its coming along, when I have something presentable I will share with all! :mrgreen:
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3

Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2481
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Re: Musings about stuff that I could do to the source code..

Post by Griff »

Good luck with your code experiments Pleb! I must admit i do love reading through these 'Oolite DVD commentary' threads that pop up every now and again when the devs discuss some new programming stuff and you get lots of posts filled with

Code: Select all

a = 10
f = 15
crazy programming voodo
:D
User avatar
Tricky
---- E L I T E ----
---- E L I T E ----
Posts: 821
Joined: Sun May 13, 2012 11:12 pm
Location: Bradford, UK. (Anarchic)

Re: Musings about stuff that I could do to the source code..

Post by Tricky »

Griff wrote:
Good luck with your code experiments Pleb! I must admit i do love reading through these 'Oolite DVD commentary' threads that pop up every now and again when the devs discuss some new programming stuff and you get lots of posts filled with

Code: Select all

a = 10
f = 15
crazy programming voodo
:D
You ought to see some of my code. I managed to code an IRC client in LPC
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Re: Musings about stuff that I could do to the source code..

Post by pagroove »

I like what you've done with the space colors. Is that feature easy to implement for oxp-makers? Could you even make it yellow/red/green?
Then you could simulate that the planet in question lies within a nebula.

I like to see nebula's included one day in Oolite. A game that does nebula's well is Freelancer. But I recon that nebula's in that way is difficult. But just being able to set the space color along with a good background can increase immersion immensely. :D
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
Post Reply