[Script] Litcube's Bounce V1.7: Player Owned Autopilot Fix

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Requiemfang wrote:good to see the release... only thing I don't like... is that you changed it from a AL to manual activation
It was a step I figured was necessary. My buddies applauded the decision.

The wasted cycles of checking for ships in space just got to me. I could release an AL version again if folks wanted it back.
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

I'm so stoked that you included a method for generating Wall files, because now I can tear it apart and see how it's done! I've been taking notes on how to import certain data from T files into a script-accessible form, which would solve some issues for a lot of mods. Among others, I was designing a method of generating a rough bounding box for any object to use with attack and navigation scripts, which I suspect is similar to your method since it has to happen in-sector (collision detection, right?).

edit: I'm not specifically requesting this, just brainstorming, but could you make a small AL plugin that would automatically activate Bounce if there are enemies and player-owned but not player-controlled ships in the active sector? It would have to poll all the player-owned ships in the sector to get their race IFF settings, get the player's global IFF settings, and check for ships of races considered enemy in either of those sets (since your ships can have IFF settings that differ from the player's). Add a check on a slow loop (like every few seconds) for player-owned ships in the active sector being attacked or targeted by missiles to cover unexpected aggression, and you should have a CPU-light monitor that catches every case. Wouldn't be active if there are no enemies in sector or only the player ship is present. Should catch every other scenario where it would be needed, correct?
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Update!
1.1
- Test script destroy everything in sector, commented out
- Fixed an oops bug in check script.


@HotSake: The text file write is about 5 lines of code. Feel free to use it + the Wall Writer text file for whatever you need.

Your edit describes the alpha version AL plugin. So, yes, it's possible. :)
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

Looked at the script; that's a more elegant method than I had in mind, but I see I was on the right track. Why a Xenon station specifically? Does the shape make it better for this purpose? If you want to be super anal about it, I'd think a flat station like a SPP, oriented correctly, would give you a more wall-like wall.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

@HotSake: That's what the Bounce.cat/.dat file are for. I made a model of a wall that's 8 KM x 8 KM x 1 meter large. That station uses that model. If you set the YOffset to 0 in the wall generating script, you can see the whole process take place while generating the wall. You'll see all the huge ships in the game getting rammed into the wall from every angle.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

For what I understood, sounds like a great idea.

However, for someone like me, it needs to be turn on and forget.

I jump around a great deal in my games, and I can lose ships to collisions when I havent yet seen there are any in the sector I just appeared in. Hitting the hotkey after every single jump, just isnt an option.

It needs to be working IS from the moment you appear in the sector, automatically.

I dont see why there are 2 hotkeys. Should be a single hotkey toggle. imo.

I really didnt understand the whole "wall" thing. Or why generating it needs to be manual. Cant it regenerate itself on game start automatically ?

What about stations and gates ? For those of us who dont play carrier fleet games because we are not combat oriented, the biggest enemy IS is station, complex tubing and gate collisions.

Can it handle these as well ?
User avatar
sms_747
Posts: 63
Joined: Mon, 15. Nov 10, 14:22

Post by sms_747 »

Sms_747: :star:

Yaaaaay!
'In space, the real enemy is space itself, and the fear it instils in your counterparts'
[ external image ]
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

apricotslice wrote:I really didnt understand the whole "wall" thing. Or why generating it needs to be manual. Cant it regenerate itself on game start automatically ?
It requires the player to sit and do nothing for 10 minutes, and it only needs to be generated if the installed ships change. Better to just do it once, manually, to get the needed file. The user has to exit out of the game afterward and move the file, so it's no good trying to automate the process.
What about stations and gates ? For those of us who dont play carrier fleet games because we are not combat oriented, the biggest enemy IS is station, complex tubing and gate collisions.

Can it handle these as well ?
If there are no enemies IS, the safe mode turns off collisions on player ships, so yes. If you write a simple AL plugin to keep Bounce running all the time, then you'll have exactly what you want. Should take about 5 minutes, right?
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Update!

1.2:
- Optimized station versus ship code.
- There was an error calculating the wait times in relation to ship speed. Collisions could have happened more frequently as a result.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

apricotslice wrote: I jump around a great deal in my games, and I can lose ships to collisions when I havent yet seen there are any in the sector I just appeared in. Hitting the hotkey after every single jump, just isnt an option.

It needs to be working IS from the moment you appear in the sector, automatically.
No it doesn't. However, Requiemfang's comments hold weight in this thread, so I'll probably be releasing an AL plug-in to do just that. In my opinion, it's wasted cycles when you don't need them, especially a continuous loop through every ship in the sector, but it will be the user's option.

apricotslice wrote: I dont see why there are 2 hotkeys. Should be a single hotkey toggle. imo.
This is a valid point. The reason I made two is so that there's no sloppyness between toggles. There's some stuff happening in the background, and I wanted the player to be confident that when he/she saw "Bounce has been disabled", that is really was disabled. It's something I've been counseled on, and am considering going to a toggle system, but only if I can get it working perfectly and under heavy testing. I just wanted to get this out in time.
apricotslice wrote: I really didnt understand the whole "wall" thing. Or why generating it needs to be manual. Cant it regenerate itself on game start automatically ?
I'm sorry you didn't understand it. I was probably not as clear as I should have been. However, as HotSake has already explained, the wall file can't be generated automatically. It takes the dimensions of the models by ramming them into a giant wall and records them to a log file. This takes some time, but I am working on optimizing it. For this release, I figured collision was more important to get right.
apricotslice wrote:What about stations and gates ? For those of us who dont play carrier fleet games because we are not combat oriented, the biggest enemy IS is station, complex tubing and gate collisions.

Can it handle these as well ?
From the first post: "Also, when an enemy ship is not detected within 10 KM, AND there are no missiles currently locked onto a ship, your ships will ignore collisions. So you can have your formation without experiencing collisions with your other ships, neutral ships, asteroids, gates, or stations."
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Thanks for the clarification. :)

Re stations, yes, I missed that.

Ah, didnt realise it took so long to generate the wall file. Obviously 10 minutes is too long to wait on the game starting. Any chance you can do a pre-generated wall file for the AMS and Merge Mods ?

Is there any consequence of the wall file being present with Bounce not actually installed ? I was thinking, it would be a good idea to include the file in my mods, already in the correct place, for those who subsequently install Bounce. So the mods would be Bounce-ready.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

@apricot:

If you have the wall file in there, it won't cause any problems, even if Bounce isn't installed. It's just a text file in the t folder.

Do you have either of the mods you referenced installed? And if so, do you know where I'm going with this? :)
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Are you going shopping ? Or lunch ? :D
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

apricotslice wrote:Are you going shopping ? Or lunch ? :D
Yes, but that wasn't *quite* what I was implying. :)
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

Litcube: How precise do you want the nodes to be? You currently move the ships 1 unit at a time to test collisions. You could halve the time to hit the wall if you just increase $MoveIncrement to 2.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

HotSake wrote:Litcube: How precise do you want the nodes to be? You currently move the ships 1 unit at a time to test collisions. You could halve the time to hit the wall if you just increase $MoveIncrement to 2.
I know. I could go even quicker if I move it to 100! :p

I'd like them to be as precise as possible. My optimization idea has to do with moving them at 100. Once they blow up, back up by 101 and try again at speed 50. Once it blows up, back up by 51, and go again at 25. Once it blows up, go at 1.

That should cut times down by a significant amount.

I'll do it tonight or tomorrow.
Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Post by Requiemfang »

Hmmm Litcube, about your concern for wasted cycles. How about doing a bit of a hybrid idea though it takes out the on off switch hotkeys and instead replaces it. By that I mean the script will ONLY run when the player is in the same sector of the ships, we all know OOS battles are a lot different then IS battles, you even stated yourself that collisions tend to happen only when the player is IS with the ships.

So instead of a hotkey you have the script run and do it's thing only when the player is present in the sector.

(highly likely you already thought of this but I thought I'd spit it out before the thought goes to waste and I forget about it.)
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Requiem, ships *only* collide when you're in the same sector as them. It's impossible for a ship to collide with anything if they're Out Of Sector.
Requiemfang wrote:So instead of a hotkey you have the script run and do it's thing only when the player is present in the sector.
Present in *what* sector? I'm not sure I follow, exactly.

If you mean only run Bounce on ships in the current sector, that's what the alpha plugin did.

The other option is going by a signal of change sector. When the player owned AI ships jump to a new sector, I can run a check to see if it's the active sector. If it is, run bounce. That should be simple enough. Jack08 and I talked about that, but I thought at the time that I might not want to mess with it.

Let me see what I can come up with. I'm still going to have a hotkey as a toggle, though. Players need to be able to turn it off if they want.
HotSake
Posts: 472
Joined: Sun, 3. Jan 10, 22:15
x3tc

Post by HotSake »

Requiemfang wrote:Hmmm Litcube, about your concern for wasted cycles. How about doing a bit of a hybrid idea though it takes out the on off switch hotkeys and instead replaces it. By that I mean the script will ONLY run when the player is in the same sector of the ships, we all know OOS battles are a lot different then IS battles, you even stated yourself that collisions tend to happen only when the player is IS with the ships.

So instead of a hotkey you have the script run and do it's thing only when the player is present in the sector.

(highly likely you already thought of this but I thought I'd spit it out before the thought goes to waste and I forget about it.)
Actually, collisions only can happen in the player's sector. OOS ships are never checked for collisions. That's why they can use gates so easily. Anyway, the wasted cycles from an AL plugin are due to the monitoring required. The most obvious way to do it is to set up a looping process (on some reasonable delay like a few seconds) to continuously check all player ships in the player's sector and start Bounce on them if they're not running it already.

Much more efficient to hook Bounce to signals so it's started on player ships in the active sector after the player's ship changes sector, and also on new player-owned ships that enter the active sector.

And I see Litcube already sniped me on that one. :)
Requiemfang
Posts: 3206
Joined: Thu, 16. Jul 09, 12:24
x4

Post by Requiemfang »

Litcube wrote:Requiem, ships *only* collide when you're in the same sector as them. It's impossible for a ship to collide with anything if they're Out Of Sector.
Requiemfang wrote:So instead of a hotkey you have the script run and do it's thing only when the player is present in the sector.
Present in *what* sector? I'm not sure I follow, exactly.

If you mean only run Bounce on ships in the current sector, that's what the alpha plugin did.

The other option is going by a signal of change sector. When the player owned AI ships jump to a new sector, I can run a check to see if it's the active sector. If it is, run bounce. That should be simple enough. Jack08 and I talked about that, but I thought at the time that I might not want to mess with it.

Let me see what I can come up with. I'm still going to have a hotkey as a toggle, though. Players need to be able to turn it off if they want.
Yeah I think you get what I was saying, that the script only runs when the player is in sector and if there are other ships owned by the player that are AI controlled that bounce runs on them.

This is what I initially thought you would do after the alpha test you wanted me and a few others did in the final version.

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”