The Dark Side
"Modding" or tweaking and writing OXPs - and eventually maybe even tampering with the Vanilla game code if you get to be good enough!
The Perils of the Dark Side
From the Tales from the spacelanes... thread (2014):
Bugger this game is taking over my life!! The funny thing is that between wings3d, photoshop, reading 500 wiki pages about the JS commands for plists and now thoughts of a cockpit console.. well I realised that its been almost a week since i actually played the game as a game instead of test flying the model I'm trying to get working.. lol spud42
Beware the attraction of the darkside - it will consume you! Cody
And now you know why we call it "The Dark Side".. :twisted: :lol: :mrgreen: Diziet Sma/Dizzy
“Inquisitiveness is the path to the dark side. Inquisitiveness leads to tweaking. Tweaking leads to modelling. Modelling leads to publishing and updating the OXP list...” - Commander Yoda "Can not run out of time, there is infinite time. You are finite. Oolite is finite. This... is wrong tool. No. No. Not good. No. No. Never use this." - Commander Zathras :D Commander Ranthe
Understanding what really goes on
So I'm on my way to Erlaza, I decide to fly in along the main route and see what I can pick up along the way and the first thing I meet is a Boa with four escorts. Now it strikes me that if I join them I might see a bit more action but at the same time I wouldn't have to deal with it entirely on my own. Sure enough, within minutes there's a Fer-de-Lance shooting at us. Erm... did I say us? I'm a Python in formation with a Boa and four escourts and he's completely ignoring the others and has locked on to me. What's more, when I turn to deal with him, what to the others do? They go on their own sweet way leaving me to deal with him on my own. B*****ds! The Fer-de-Lance suffered the consequences and having picked up the ton of luxuries that he left me in his will, I'm following the Boa back to the space station. I'm wondering whether to rejoin them and give them an energy bomb as a token of thanks for their assistance when one of the escorts breaks formation and heads off at 11 o'clock. The others soon follow and I realise that they are under attack from a Python and a couple of smaller ships. The next thing I know, the Boa is on the radio asking for help! Yeah. Right. Count the fingers mate. ("AndySlater", 2006)
Spoiler (why what happened made sense and how the game programmes it)---->
Pirates use a "scanForNearestMerchantmen" (traders, miners and the player), they then use a "Oddsgood" / "Oddseven" / "Oddsbad" to decide if they attack and who. The pirates are "smart" enough to "know" that a ship with the role "escort" will defend its mother. To put it in plain English:- That fer-de-lance considered attacking all the ships it saw, but it knew that if it attacked the convoy it would have to deal with the the Traders escorts as well as the Trader if it attacked him. When it scanned you, it knew you were without escorts and so chose to attack the easier prey (ie you!).
If he had a few wing-men, he might have decided that his side was well enough equipped to make attacking the convoy (bigger risk but better rewards) worth it! (done with random numbers against an Odds risk)
If he had missed his intended target (you!) and hit the Trader, then the trader would have responded. He consults his own AI to decide how to respond, but having cowardly TraderAI he might have decided to run for the planet rather than returning fire or he might have returned fire on the fer-de-lance. The Escorts would probably have attacked the fer-de-lance (as their AI is pretty brave - Someone attacking our mothership - Get Him, even if Mum runs away!). Had there been some cargo pods lying about the Fer-de-lance would probably not have attacked at all and scooped the free cargo, rather than risk a fight (as his AI also includes a scanForLoot, found = setstate to scooploot). Equally had his hold been full, he would have gone to the Station to sell his ill-gotten gains, as he "knows" that there is no point blowing up a trader if you can't scoop his stuff! (done in code by a simple HOLD_FULL = switchAI to route1traderAI)
Obviously it's Giles's code that does all this, but us players can write AIs that the code will follow. You then assign this to a new ship you have built to make it behave as you want. If you want your ship to be a typical pirate / policeship / miner / escort etc, then you just give it one of the native AIs. Fiddling with Oolite is almost as much fun as playing it!
- See The Embrace of the Dark Side in the Applied Theology section on the page for the Church of Giles the Creator
- Forgot to play? Programming vs Playing (2015)
- How many of you OXP authors are programmers? (2016+)
Am I the only person who finds the js sections almost impossible to navigate? Is there an index page or something I've missed? (Smivs, 2011)
- Category:Oolite scripting
- And Commander McLane's post (taken from here (2011))
Smivs was asking for help:
For an OXP idea I'm working on, I have an asteroid as a sub-entity of a ship - the idea is it's a space wreck and the asteroid has hit the ship at low speed and the ship is now 'crunched' onto the asteroid. So far so good. However I want to be able to salvage stuff from the ship by destroying it. Again so far so good. The problem is that sometimes the asteroid breaks into boulders during this and sometimes it doesn't. I would like to guarantee that the asteroid breaks into about 4-5 boulders every time. The weird thing is, I tried increasing the 'likely cargo' to 100 to generate boulders on the destruction of the asteroid, and this works very well... except the 100 boulders appear about 10 000Km from the original asteroid.
McLane posted this response:
- What "can" be changed without re-compiling? (2010-date) - for what oxp's cannot do see the 2021-2 posts
- Getting Started with Programming by Shamus Young (died June 2022) - a broad introduction to the issues.
- if (player.ship.dockedStation.isMainStation) - major discussion on a single line of code (2012)