[RELz] - QQuix Conceptuals

Post » Tue Mar 29, 2011 11:59 pm

i would like to implement your code in my ship script. an extra script would cause much more cpu load, i think. and some of the work must be done by my script anyway. (angle to ship, distance to ship, setpos, etc...)

Fair enough.
But I am going to create the single-ship-rocking-system anyway. It will be easier to integrate into other scripts.
I will do it with functions, so you can call them from your script with minimum changes.


ouch! but... if the x axis really remains... you can always use the ship's x for the object's x? the x axis remains if you change z?? could you find out how it behaves exactly, so i can ask someone about the math...

From what I remember from discussions more than one year ago, the Oblivion angle system is not something Bethesda created out of nowhere. It is used in other areas. I think the system even has a name.

As I see it, it is like those big, decorative Earth globes you see in old movies (mostly). The one that you can tilt the vertical Earth axis and the globe, then, spins inclined. When you change the X angle, the Z axis (the vertical globe axis) goes along.

Oblivion system is like that:
- the X axis don't move
- when you change the X angle, the Y axis and the Z axis go along.
- when you change the Y angle, the Z axis goes along.

This way the Z axis always stays in the same place relative to the object (like the vertical globe axis remains 'vertical' to the globe)

Crazy example: a ship at 0/0/0 angles. An object on the deck at 20/20/20 angles. Turn both 30 degrees counterclockwise. Ship angles are now 0/0/-30. The object angles are now 7/27/-12 !!?!?!
User avatar
W E I R D
 
Posts: 3496
Joined: Tue Mar 20, 2007 10:08 am

Post » Tue Mar 29, 2011 10:40 pm

ok. let's try to find a solution. :)

could you find the name of that system somewhere...? this would help if i ask someone...
User avatar
Heather Stewart
 
Posts: 3525
Joined: Thu Aug 10, 2006 11:04 pm

Post » Wed Mar 30, 2011 12:18 pm

Found my http://www.gamesas.com/bgsforums/index.php?showtopic=941395 where Skyranger-1 mentioned "6DoF". Googled a bit and found it: http://en.wikipedia.org/wiki/Euler_angles. The math is too advanced for me. Hope you can find someone that can translate it into something we can do with scripts.

Also related: http://en.wikipedia.org/wiki/Degrees_of_freedom_(mechanics)
User avatar
Lance Vannortwick
 
Posts: 3479
Joined: Thu Sep 27, 2007 5:30 pm

Post » Wed Mar 30, 2011 4:56 am

ok, i can try to find someone. but as i look at the math i think this could be to cpu hungry to do it every frame. may be it is not worth it? how much is the cpu load of your script?
User avatar
Pawel Platek
 
Posts: 3489
Joined: Sat May 26, 2007 2:08 pm

Post » Tue Mar 29, 2011 10:58 pm

Heavy, I would say. About 100 lines of code per rocking object.

It is hard for me to say, because (1) I don't have mods installed and (2) I am usually testing scripts, spitting a zillion lines to Conscribe log.

Worth it? I think so. There is already a lot of calculations to determine the XYZ position and Z angle, calculation two more angles should not make much difference, I guess.
User avatar
Amysaurusrex
 
Posts: 3432
Joined: Wed Aug 09, 2006 2:45 pm

Post » Wed Mar 30, 2011 8:28 am

so it's worth a try.

but it seems to heavy for my ships. my scripts are really slick, just a few sines and cosines. but the CPU load is already high. i think that moving the statics adds a lot load too. at least because of the collision. not to talk about moving actors... i don't know if the engine calculates the collision for the moved objects even if they are currently not rendered... but i guess it does.
you don't move the collision, otherwise you would notice a FPS drop too...?
User avatar
cassy
 
Posts: 3368
Joined: Mon Mar 05, 2007 12:57 am

Post » Wed Mar 30, 2011 5:49 am

I was planning to do some tests before answering, but I did not have the opportunity and I must return to my main project.

Anyway, I've always had the feeling that SetPos is much lighter on the CPU than MoveTo. I would guess that SetPos just changes a value somewhere in the engine data and that is it. No further considerations about collision, havok or anything. MoveTo, OTOH, does a lot of checking and corrections (at least for actors). Maybe that is why the engine quits running scripts after a MoveTo.

Someday I will do some timing tests to see how they go.
User avatar
Pixie
 
Posts: 3430
Joined: Sat Oct 07, 2006 4:50 am

Post » Wed Mar 30, 2011 5:05 am

yes, the problem with setpos... the geometry may disappear if you move a certain distance. i don't know why. i had that issue with reneer's ship. so i have to use moveto for safety for the objects. actors don't disappear.

scripts only return if you call moveto on the player (or actors?). you can even move the scripted objects to an unloaded cell... the script will finish the current frame.
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Wed Mar 30, 2011 12:01 pm

yes, the problem with setpos... the geometry may disappear if you move a certain distance. i don't know why. i had that issue with reneer's ship. so i have to use moveto for safety for the objects. actors don't disappear.

I did a quick test with this and solved the problem checking the "Visible when distant" flag. But it has been a while and I don't remember all the details.

scripts only return if you call moveto on the player (or actors?). you can even move the scripted objects to an unloaded cell... the script will finish the current frame.

I meant the fact that when a script uses MoveTo, PositionCell or Activate, the engine does not run any further scripts on that frame. I found this out some time ago (reported http://www.gamesas.com/bgsforums/index.php?showtopic=1000091) and it has been confirmed by at least one modder (http://www.gamesas.com/bgsforums/index.php?showtopic=1013395). Until someone proves otherwise, I must assume it is true for everyone.

For example: I did not look at you scripts, but I knew you were using MoveTo every frame because, when I took one of your ships to Anvil, all the ships there stopped rocking (my rocking script stopped running). Stop your boat, the ships rock. Move your boat, ships stop rocking.
User avatar
Quick draw II
 
Posts: 3301
Joined: Thu Nov 08, 2007 4:11 pm

Post » Wed Mar 30, 2011 7:19 am

I did a quick test with this and solved the problem checking the "Visible when distant" flag. But it has been a while and I don't remember all the details.

I meant the fact that when a script uses MoveTo, PositionCell or Activate, the engine does not run any further scripts on that frame.


thank you for pointing at this! i was not aware about it... does 'any further scripts' include quest scripts? i excessively use moveto in the beta because i still don't know why the ship disappears for some users. so i will try VWD now...

now something completely different. you did so many tests: the data (actors, havok, etc) of 'expired' cells remains in the savegame until the cell is entered again, right?
User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Wed Mar 30, 2011 1:23 pm

I did a quick test with this and solved the problem checking the "Visible when distant" flag.


ok. i tried this and it doesn't work. the ship disappeared after moving a certain distance. i think it gets unloaded when i leave the cell radius of the original cell of the ship (the ship's object script also stops then)...

but i found out something amazing: as i moved away from the position the ship disappeared the ship was suddenly visible again and did NOT disappear while moving away from me. i watched the ship until it was a dot in the horizon. so it's possible to achieve real VWD with moving objects! did you know that?? is it this you found out with your test too? (because you did not move the player with the object?)

i turned the ship around then but it disappeared again when i left the original cell radius.
User avatar
Carlos Rojas
 
Posts: 3391
Joined: Thu Aug 16, 2007 11:19 am

Post » Wed Mar 30, 2011 10:58 am

... does 'any further scripts' include quest scripts?

I've not checked quest scripts. Scripts are executed on a cell by cell basis. If one uses MoveTo, scripts on the reaming cells don't run. Quest scripts, probably, run either before object scripts (in which case they are not affected - as they have already ran), or after. I will test it when I have a chance.

now something completely different. you did so many tests: the data (actors, havok, etc) of 'expired' cells remains in the savegame until the cell is entered again, right?

It has been stated many times that cell reset occurs only when the cell is entered. The process is described in the OBSE doc:

"When the player visits and then exits an interior cell, the game records the number of total hours elapsed in the game at the moment the player exits; this value is the cell's "detach time." The next time he visits that cell, if the difference between the current number of game hours passed and the detach time is greater than the game setting iHoursToRespawnCell, the cell will be reset."

When I tested it (again, long time ago), my interior cell got reset without being visited. I created 1000 PlaceAtMe'd NPC from outside and saved the game (15% increase in file size). Kept saving the game every 24 hours and 3 days later, the savegame size returned to its original size. I have no idea why, or what special condition triggered the reset. Or if it was a cell reset, to begin with.

Better be on the safe side and consider that yes, added objects will remain in the save game until the cell is visited again.

but i found out something amazing: as i moved away from the position the ship disappeared the ship was suddenly visible again and did NOT disappear while moving away from me. i watched the ship until it was a dot in the horizon. so it's possible to achieve real VWD with moving objects! did you know that?? is it this you found out with your test too? (because you did not move the player with the object?)

Very interesting!
What I did was pretty much the first part of your test: moved an ARGate01 away from the player and it disappeared when left the loaded area. Checked VWD and it did not disappear anymore.

I did not move the player or thought much about the uses of this 'feature'.

Now I wonder if it would be possible to keep some far objects visible by 'shaking' them every once in a while.
Would it work also with vanilla statics?
User avatar
My blood
 
Posts: 3455
Joined: Fri Jun 16, 2006 8:09 am

Post » Wed Mar 30, 2011 5:47 am

It has been stated many times that cell reset occurs only when the cell is entered.
When I tested it (again, long time ago), my interior cell got reset without being visited.


this is exactly where i wanted to get at: reset expired cells but avoid triggering respawns (until it's visited again). i think this would be a huge decrease in savegame size... so you already did half of the work! ;)

Now I wonder if it would be possible to keep some far objects visible by 'shaking' them every once in a while.
Would it work also with vanilla statics?


no. they don't stay visible by 'shaking'. they just don't get unloaded because the engine obviously threats them as sitting at their original position. this means: as soon as the player leaves the loaded area the object would vanish.
'moveto' it to the player to keep it loaded and then 'setpos' it to it's original position would do it... most likely. :)

and this means: MOVING SHIPS AT THE HORIZON!!

vanilla statics should work too. i just had to change the collision in the nifs in order to get it moved with the geometry.
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Wed Mar 30, 2011 11:54 am

'moveto' it to the player to keep it loaded and then 'setpos' it to it's original position would do it... most likely. :)

and this means: MOVING SHIPS AT THE HORIZON!!

vanilla statics should work too. i just had to change the collision in the nifs in order to get it moved with the geometry.

This discussion may have solved one of my major concerns with my The Evolving Society mod: LOD

I will have a city and villages build and grown dynamically and I was kind of accepting the fact that they would not be seen from a few cells away.

But I've just tested and it does work: MoveTo player + SetPos far away. I kept buildings in Anvil visible all the way from Kvatch. Now to the drawing board to figure out how to do it with dynamic items.

And, in this case, I don't care about the collision. Only the looks.

Thanks. Although I had all the elements, I might never put them together to achieve this.
User avatar
Lizbeth Ruiz
 
Posts: 3358
Joined: Fri Aug 24, 2007 1:35 pm

Post » Wed Mar 30, 2011 1:42 am

My! My! Here we go again . . . Rock rock rock your ship Version 3!

Now with your own, personal, portable breeze that you can let loose in distant ports.
And a portable Heavy Barrel that will rock a single ship.
Also an improved resetting mechanism, to use before deactivating the mod, or in case the player deactivates the mod without first resetting the ships.

An excerpt from the new ReadMe:

==============================================
QQuix - Rock, rock, rock your ship
Jan/2010 - Version 3.0
==============================================

1. SHORT DESCRIPTION
=========
Ships and boats will rock with the wind improving the ambience in dock areas.


2. DESCRIPTION
===============
Ships and boats will rock slowly or fast according to the current weather's wind speed. Fog weather has the slowest wind. Thunderstorm weather, the fastest.

Ships in Anvil and IC Waterfront will rock automatically.
In other port areas included by mods, you may drop a provided Portable Breeze, so ships there will rock too.
There is also a Heavy Barrel that, when dropped on a ship's deck will unbalance the ship and make it rock.

Cargo, as barrels and crates, furniture, and lamps will rock with the ship.

===IMPORTANT===
Read before deactivating the mod: removing this mod without the proper steps may leave tilted ships all over.
To avoid this, before removing the mod, collect all the Portable Breezes. When you pick up the Portable Breeze crate it stops the movement and place all controlled ships and boats in the area back in their original vertical position.

But if you did remove the mod without taking the above steps, don't despair. Follow the ship reset procedure described in the next section.

If you have a previous version, please deactivate it before activating v3. Follow the instructions for deactivating it, or the ships will remain tilted and tilted ships are ignored and will not rock. Or, at least theoretically, you could have both versions active at the same time. If this is your choice and it does not work, let me know and I will fix it.

===DISCLAIMER===
This mod is meant to give ambience to dock areas. From close distance, some technical restrictions will be noticed (clipping)

3. USAGE

There are three carriable items: a Portable Breeze, a Heavy Barrel and a Ship Reset crate.

Besides some Portable Breezes already deployed, there are additional items in containers by the central lamp post in Anvil dock. The vertical one on the top contains Portable Breezes and Heavy Barrels, the one at the bottom contains Ship Reset crates.

Portable Breeze
Drop it anywhere in a port area. Grab and position it in a place of your choice and activate it once (space bar).
The first activation 'releases' the breeze and ships start rocking. The crate will remain where it is.
A second activation traps the breeze back in the crate and places the crate in your inventory, stopping the movements and resetting the ships to their original position.
There are some small crates already deployed and these will auto-release the breeze the first time the player gets close. They may be found in:
- Anvil dock: by the central lamp post close to the rowboat
- IC Waterfront: by the exit to the houses (right behind you when you fast travel)
- Wherever there is a rowboat in the wilderness in the original game (about 7).
Portable Breezes from the Anvil container are in larger crates, but the size of the crate does not affect its functionality in any way.

Heavy Barrel
Has the same function as the Portable Breeze, but operates on a single ship.
Drop it anywhere on the ship deck. Grab and position it someplace out of the way and activate it once (space bar).
The first activation 'unbalances' the ship and it starts rocking. The barrel will be moving with the ship and, during the movement, you cannot move it from its place (but you can activate it).
Activating the barrel while the ship is moving places it back in your inventory, stopping the ship movements and resetting it to its original position.

Ship Reset crate
Use in case you removed the mod and ships remained in tilted positions.
Get it from the crate in Anvil dock and drop it near tilted ships.
When you activate it, it will locate all ships in the area that were tilted by the mod and reposition them in their vertical position.
This process may take a couple of seconds and the crate will go to your inventory. You can, then, reuse it in some other area. When all ships are back in place, you may safely deactivate the mod.


Supported Ships
The mod will rock only preselected ships. These ships are hardcoded within the mod, so the scripts can identify, from the hundreds (?) of objects around the player, what is a ship and what is not (so they don't end up rocking the houses around the dock)
The supported ships are (from whatever mod that adds them):
- The original game ship [BloatedFloat01 Base Object]
- The original game rowboat [RowBoat01 Base Object]
- mr_siika's Cog [CogHull01.nif]
- mr_siika's fishing boats [MiddleBoatIdle01.nif and MiddleBoatSail01.nif]
- mr_siika's Corvettes [Corvette01.nif, Corvette01armed.nif, Corvette01armedfolded.nif and Corvette01folded.nif]
- mr_siika's Elven Galleys [ElvenGalleyHull01.nif and ElvenGalleyHull02.nif]
- mr_siika's Elven Swan boats [ElvenSwanShip01.nif and ElvenSwanShip02.nif]
- Reneers Sailing Mod's Pirate ship [RenShip02_test.nif]
- CLShade Sailboats [middleboatsailPC02.nif]
- Side's Sailing Ships [Cog01Body.nif, PirateShip.nif, CorvetteBody.nif, MiddleBoatBody.nif, ElvenGalleyBody.nif ElvenSwanBodyB.nif and MiniSwanBody.nif]

These are considered the basic ship meshes and any unmovable object (statics, containers, furniture, doors and lights) on them will rock together as one.

Exclusions: (these will not rock)
Any unsupported ship.
Any supported ship that is found already tilted in any way.
Any supported ship that is not at water level.
Any shallow boat that is not high enough on the water that tilting it would make its floor go below water.
Any supported ship that moves is reset and excluded.

==============================================
User avatar
Amanda Leis
 
Posts: 3518
Joined: Sun Dec 24, 2006 1:57 am

Post » Wed Mar 30, 2011 5:55 am

And a portable Heavy Barrel that will rock a single ship.


My freakin' hero!!! Thanks QQuix!!!

Is version 3 ready? Any DL links as of yet?
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Wed Mar 30, 2011 1:37 pm

I hope you have not spent (much) time working on porting the scripts to other area.
User avatar
neil slattery
 
Posts: 3358
Joined: Wed May 16, 2007 4:57 am

Post » Wed Mar 30, 2011 5:32 am

I hope you have not spent (much) time working on porting the scripts to other area.


Oh, no no no. Still working on a CTD issue that has been bugging me. I don't get much free time these days. I have been
watching this thread and your discussions side777. Gotta say, you guys really know what you're doing!

BTW, I found your DL link for v3 on TES Nexus under your profile. Looking forward to trying it out!
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm

Post » Wed Mar 30, 2011 4:04 am

Any supported ship that is not at water level.


so you included my modified meshes. this must mean it's working with it, which is great! but... what would happen if you did not exclude it while moving? much work to implement it in my scripts? i will have a look at it. stop the boat rocking when moving is not that nice... ;)

i'm going to remove and add some ships for the next version so using the barrell for now would be better.

what does water level mean? i didn't set all of my ships to 0 so if you check for the z pos these may be excluded anyway...
User avatar
Stay-C
 
Posts: 3514
Joined: Sun Jul 16, 2006 2:04 am

Post » Wed Mar 30, 2011 6:36 am

I did not include the meshes themseves. I match every static or activator in the area against a list with the mentioned nif filenames. If there is a match, I rock it. If a player has a building with a nif called, say, "Corvette01.nif", the building will rock, I am afraid.
I only tested a few of those nifs, but it should work with all.

The problem with rocking moving ships is that when they move away from the port (where the rocking script is), sooner or later the scripted object will go out of scope and the rocking scripts will stop running, leaving the ship tilted for the rest of the journey. If you use the barrel, it will/may not move with the ship, leading to the same problem.

Another aspect of moving ships is that they will not be detected automatically when docking at the port. The player will have to take steps to rescan the area by reactivating the port's Portable Breeze or by dropping a barrel on the ship.

But maybe the rocking stopping when you start moving may not be bad. You kind of replace one movement by another and the fact that the ship stopped rocking may not be that noticeable.

As for the water level, for each of those nifs, I hardcoded its dimensions and a minimum and maximum Z offset from the water. Most have a fair offset range, but shallow boats have narrower ranges. The Elven Swan, for example, must have a Z position from 28 to 50 units above water level. Bellow 28, too much water show inside when tilted 3 degrees. Above 50, it is almost out of the water.

The values are in the script "zzCreateListOfKnownShips". The Z offsets are as follows:

BloatedFloat01 - from 0 to 100
RowBoat01 - from 3 to 40
CogHull01.nif - from -80 to 20
MiddleBoatIdle01.nif - from 15 to 40
MiddleBoatSail01.nif - from 32 to 60
Corvette01.nif - from -60 to 60
Corvette01armed.nif - from -60 to 60
Corvette01armedfolded.nif - from -60 to 60
Corvette01folded.nif - from -60 to 60
ElvenGalleyHull01.nif - from -350 to 20
ElvenGalleyHull02.nif - from -350 to 20
ElvenSwanShip01.nif - from 28 to 50
ElvenSwanShip02.nif - from 28 to 50
MiddleboatsailPC02.nif - from 15 to 40
RenShip02_test.nif - from 0 to 100
MiddleBoatBody.nif - from 15 to 40
CorvetteBody.nif - from -60 to 60
PirateShip.nif - from 0 to 100
Cog01Body.nif - from -80 to 20
ElvenGalleyBody.nif - from -350 to 20
ElvenSwanBodyB.nif - from 28 to 50
MiniSwanBody.nif - from 8 to 20

If you find some error, let me know and I will fix it in the next version.
User avatar
Khamaji Taylor
 
Posts: 3437
Joined: Sun Jul 29, 2007 6:15 am

Post » Wed Mar 30, 2011 2:11 am

Thank you so much for V3 QQuix :foodndrink:
It`s not only the boats that rocks, you rock to :rock:

Link for those how having trouble of finding it:

- http://www.tesnexus.com/downloads/file.php?id=29649

(maybe you should add it to the OP, QQuix)
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Wed Mar 30, 2011 4:55 am

I did not include the meshes themseves.

The problem with rocking moving ships is that when they move away from the port (where the rocking script is), sooner or later the scripted object will go out of scope and the rocking scripts will stop running, leaving the ship tilted for the rest of the journey. If you use the barrel, it will/may not move with the ship, leading to the same problem.


yes, that was clear... ;)

another reason better to use the barrells. one of the next versions of my ships include a scroll that lets you attach any statics to the ship like the statics already there. and you would not have to update the breeze.

OR... better include your scripts into mine?
User avatar
Robert DeLarosa
 
Posts: 3415
Joined: Tue Sep 04, 2007 3:43 pm

Post » Wed Mar 30, 2011 3:50 am

are you sure your windspeed calculations are right? afaik by multiplying by the weatherpercent you won't get the actual windspeed. because the weatherID changes and the percent restarts with 0 as soon as the transition to a new weather begins. i may be wrong... i used windspeed in my BMS but this is a while ago...
User avatar
Lil'.KiiDD
 
Posts: 3566
Joined: Mon Nov 26, 2007 11:41 am

Post » Wed Mar 30, 2011 1:00 pm

I think it is better if you imported my scripts into your mod, so you will be independent, as a number of your users won't have my mod installed.

Whether importing the barrel as an independent scripted object or integrating its script into yours, I suppose a single script is more efficient than two, but I doubt it will ever make any difference. Most of my code is in user functions anyway.

Besides, you may want to handle a few situations differently, who knows?
For example: the barrel auto-detects (and 'attaches') all statics, containers, activators, lights and furniture on board. If you want to make it user selectable via spell, you have to change that.

When the weather changes, the wind speed value changes instantaneously with it. I use the weather percent to smooth the rocking speed transition from one rocking speed to the next, otherwise the ships would start shaking before a new thunderstorm weather has any visual indication.

(maybe you should add it to the OP, QQuix)

You are right. Done. Thanks
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Wed Mar 30, 2011 4:49 am

I use the weather percent to smooth the rocking speed transition from one rocking speed to the next, otherwise the ships would start shaking before a new thunderstorm weather has any visual indication.


as i remember the weatherID changes when a new weather STARTS transition. the percent is 0 then and increases to 1 until the transition is done. it does never decrease. e.g. if you are in the middle of a thunderstorm the percent reaches 1. the next weather is set as current weather and the percent jumps back to 0 (of course: the current weather is at 0 percent!)

so you get windspeed 0 at the peak of the storm.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

PreviousNext

Return to IV - Oblivion