Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

How about some super laser?

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

Commander Learner wrote:
mitchelln wrote:
Anyway, got the source code and built a version with a mining laser that seems about par with what I'm used to. Oh the joys of open source :) Tempting to spec into super laser territory, but that would just spoil the fun.
What does he mean by build a laser?
He modified the source code so the mining laser behaved more like he remembered, and compiled it to create a new executable.. Voila! a new Oolite with a higher-powered, faster-cycling mining laser!
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
User avatar
Commander Learner
Dangerous
Dangerous
Posts: 123
Joined: Thu Aug 20, 2009 12:08 pm
Location: Somewheeeeeere over the rainbooooooooooow~

Post by Commander Learner »

:shock: :?: :?:
How is the source code modified to recompile and create a new laser?

:!: I am still a beginner so this might sound stupid, hence my name-Learner :!:
Shooting polygons since 2001
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

That's ok.. we all had to learn from somewhere..

Hmm.. big topic.. let's see now..

Step one: Download the source-code.. there was a link earlier in this thread..

Step two: Find the file dealing with the lasers.. (there are hundreds of files and hundreds of thousands of lines of code, so this may take a while - but it's not so bad once you get the hang of what's what - the file-names usually give a clue as to what they're about)

Step three: Locate the code that specifies the parameters for the mining laser. Basically this entails reading the code, even if you don't understand much, until you spot what you're looking for... comments inserted by the programmers can help here, as do sensibly named parameters.

Step four: Change the parameters to something more like what you have in mind. (this can be a process of trial and error to get it right)

Step five: Compile the code to produce a new executable program and copy it to the correct location in your Oolite directory. Compiling is a big topic in its own right and there are a number of threads detailing this, which ones you should read depends on your operating system.

Step six: Test the new Oolite to see if it works the way you want.. rinse and repeat until satisfied.


ok.. that's the short version.. :lol: any questions? 8) 8)
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
User avatar
Commander Learner
Dangerous
Dangerous
Posts: 123
Joined: Thu Aug 20, 2009 12:08 pm
Location: Somewheeeeeere over the rainbooooooooooow~

Post by Commander Learner »

Not yet Professor! :P Will go searching for threads about compiling for Windows.
Shooting polygons since 2001
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

For windows, this is the definitive guide.. At the Oolite Wiki http://wiki.alioth.net/index.php/Runnin ... rom_source

Then there's another_commanders easier method https://bb.oolite.space/viewtopic.php?t=5943
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
User avatar
Commander Learner
Dangerous
Dangerous
Posts: 123
Joined: Thu Aug 20, 2009 12:08 pm
Location: Somewheeeeeere over the rainbooooooooooow~

Post by Commander Learner »

Whew, can´t even find the file dealing with lasers....wonder what did mitchelln do.
Shooting polygons since 2001
Screet
---- E L I T E ----
---- E L I T E ----
Posts: 1883
Joined: Wed Dec 10, 2008 3:02 am
Location: Bremen, Germany

Post by Screet »

Commander Learner wrote:
Whew, can´t even find the file dealing with lasers....wonder what did mitchelln do.
Use an editor like notpad++ which has find in files.

Then do a find in files for "WEAPON_MINING_LASER" and you will come up with some files. If you look at their names, you probably decide to begin with "PlayerEntity.m" but also want to modify "ShipEntity.m" accordingly so that the player does not differ too much from NPC ;)

Screet
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Commander Learner: You need to open ShipEntity.m and locate this method:

Code: Select all

- (void) setWeaponDataFromType: (OOWeaponType) weapon_type
{
	switch (weapon_type)
	{
		case WEAPON_PLASMA_CANNON:
			weapon_energy =			6.0;
			weapon_recharge_rate =	0.25;
			weaponRange =			5000;
			break;
		case WEAPON_PULSE_LASER:
			weapon_energy =			15.0;
			weapon_recharge_rate =	0.33;
			weaponRange =			12500;
			break;
		case WEAPON_BEAM_LASER:
			weapon_energy =			15.0;
			weapon_recharge_rate =	0.25;
			weaponRange =			15000;
			break;
		case WEAPON_MINING_LASER:
			weapon_energy =			50.0;
			weapon_recharge_rate =	0.5;
			weaponRange =			12500;
			break;
		case WEAPON_THARGOID_LASER:		// omni directional lasers FRIGHTENING!
			weapon_energy =			12.5;
			weapon_recharge_rate =	0.5;
			weaponRange =			17500;
			break;
		case WEAPON_MILITARY_LASER:
			weapon_energy =			23.0;
			weapon_recharge_rate =	0.20;
			weaponRange =			30000;
			break;
		case WEAPON_NONE:
		case WEAPON_UNDEFINED:
			weapon_energy =			0.0;	// indicating no weapon!
			weapon_recharge_rate =	0.20;	// maximum rate
			weaponRange =			32000;
			break;
	}
}
The part that is of interest to you is:

Code: Select all

case WEAPON_MINING_LASER:
			weapon_energy =			50.0;
			weapon_recharge_rate =	0.5;
			weaponRange =			12500;
You can try to play with the three numbers for weapon_energy, weapon_recharge_rate and weaponRange if you want to suit the mining laser to your needs.

Random irrelevant note: See how the beam laser has exactly the same oomph as the pulse one, only it shoots faster and further.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

@ Commander Learner: You should be aware, though, that from the moment on when you implement changes to the source code, you have changed your game. You don't play the same game anymore than everybody else. Which is not a problem as such, because we are all free. But if you start modifying other parts of the source code on your computer, at some point your game won't be Oolite anymore, but something like "NeOlite" instead.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

I made a beginner's mistake earlier: The method Commander Learner needs to tweak for the player mining laser is -fireMainWeapon in PlayerEntity.m, around line 3200, where the following is contained:

Code: Select all

- (BOOL) fireMainWeapon
{
	int weapon_to_be_fired = [self weaponForView: currentWeaponFacing];

	if (weapon_temp / PLAYER_MAX_WEAPON_TEMP >= 0.85)
	{
		[self playWeaponOverheated];
		[UNIVERSE addMessage:DESC(@"weapon-overheat") forCount:3.0];
		return NO;
	}

	if (weapon_to_be_fired == WEAPON_NONE)
		return NO;

	switch (weapon_to_be_fired)
	{
		case WEAPON_PLASMA_CANNON :
			weapon_energy =						6.0f;
			weapon_energy_per_shot =			6.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				0.25f;
			weaponRange = 5000;
			break;
		case WEAPON_PULSE_LASER :
			weapon_energy =						15.0f;
			weapon_energy_per_shot =			1.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				0.5f;
			weaponRange = 12500;
			break;
		case WEAPON_BEAM_LASER :
			weapon_energy =						15.0f;
			weapon_energy_per_shot =			1.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				0.1f;
			weaponRange = 15000;
			break;
		case WEAPON_MINING_LASER :
			weapon_energy =						50.0f;
			weapon_energy_per_shot =			1.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				2.5f;
			weaponRange = 12500;
			break;
		case WEAPON_THARGOID_LASER :
		case WEAPON_MILITARY_LASER :
			weapon_energy =						23.0f;
			weapon_energy_per_shot =			1.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				0.1f;
			weaponRange = 30000;
			break;
	} ... (more stuff follows)
The part of interest is of course

Code: Select all

case WEAPON_MINING_LASER :
			weapon_energy =						50.0f;
			weapon_energy_per_shot =			1.0f;
			weapon_heat_increment_per_shot =	8.0f;
			weapon_reload_time =				2.5f;
			weaponRange = 12500;
			break;
These are the numbers to be tweaked. The previous instructions would only change the NPC stats.
User avatar
Commander Learner
Dangerous
Dangerous
Posts: 123
Joined: Thu Aug 20, 2009 12:08 pm
Location: Somewheeeeeere over the rainbooooooooooow~

Post by Commander Learner »

:!: Off topic question.

another_commander, what is your local time when you posted this? Mine shows 7.07 pm. :D
Shooting polygons since 2001
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6570
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Off topic answer: 13:07.
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Post by Diziet Sma »

Commander Learner wrote:
:!: Off topic question.

another_commander, what is your local time when you posted this? Mine shows 7.07 pm. :D
Still OT. So would that put you in timezone GMT+8, Commander Learner? Perth, Aust. perhaps?
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
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Instead of a super laser you could also try a super missile.
User avatar
Commander Learner
Dangerous
Dangerous
Posts: 123
Joined: Thu Aug 20, 2009 12:08 pm
Location: Somewheeeeeere over the rainbooooooooooow~

Post by Commander Learner »

That missile is oh so cheating and frivolous, there won't be any point in Oolite if you use those!!
Shooting polygons since 2001
Post Reply