Scripts / DIY Xmas prezzy from 'Master' AmenMoses - makes me feel young again. ;-)

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 00:18 Edited at: 23rd Dec 2017 12:56
So to celebrate my new badge as well as the summer solstice, no wait, darn I'm six months adrift again, Yuletide that's the one, I've put together a little DIY project for anyone out there who happens to have the Sci-Fi pack and Mega Pack 2. (I will be putting together something similar for the New Year for those who don't) (the adventurous could adapt this to other models btw)

For those who may remember my moonlander demo this will feel familiar but this is in fact a complete re-working of a small part of that demo using my new libraries and minimalising the number of scripts (thus making it a lot simpler to implement).

I've attached the scripts required to this first post, in the next post I will start the detailed instructions on how to put them to use, I will try to explain every step in such a way that even if you have no scripting abilities you will end up with a functional and hopefully fun present to play with. Finally I will answer any questions you have about how this is all done. (Oh and at some point post the obligitory smart-arse video showing it in action)

Edited: new_moonlander.lua script polished a tad.

Edited: new_moonlander.lua and dynamic_entity.lua scripts tweaked.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 00:47 Edited at: 23rd Dec 2017 01:08
On with the lesson:

(After having put the scripts in your scriptbank)

First the entities used for this will consist of the Sci-Fi Pack "Moon Lander", the same packs "Moon Lander (crashed)" (both found in the packs Scenery folder) and finally the "Hot steam" decal from the Mega Pack 02 (found in the packs Decals/Emissions folder).

Start with an empty map and place the "Moon Lander" down in it. Select it and in 'Parameters' set 'Static Mode' to No, Always Active to Yes and in the AI System/Main setting select the new_moonlander.lua script. Apply Changes.

Now place the "Moon Lander (crashed)" model and do the same except choose the dynamic_entity.lua script.

(do not rotate or scale either model, this is important!)

The next step involves putting enough "Hot steam" decals in to attach to every 'nozzle' on the moon lander model. Stay tuned.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 01:06 Edited at: 23rd Dec 2017 14:06
So each nozzle needs two named decals which are displayed at 90 degrees to each other by the scripts to give a 'fake' 3D appearance of a jet which would IRL provide propulsion for our moon lander.

The names are really important! The scripts use the names to show or hide the correct decals at the correct time, get this bit wrong and things will look really weird!

Drop one 'Hot steam' decal on the map, select it and in Properties change the name to Main.
Make Always Active and set the script to dynamic_entry.lua. Apply changes.

Now select this decal, 'Extract' and using 'shift-LMB' place exactly 16 copies on the map. We need 2 decals per 'Main' nozzle and there are 8 nozzles (the big ones on the bottom of the model).

So the rest is a rinse-and-repeat exercise, do the same steps for the rest of the nozzles: (the names are really important, including the case of the characters!)

Name: Number of Copies:
Down 12
Fwrd 6
Back 6
Left 12
Rght 12 (note no 'i')

So you should now have a map looking something like the attached pic
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 01:20
So now you have a whole bunch (64 unless I've miscounted) of decals and two models in your map and every one should have the right name, be attached to the correct scripts and be 'always active' so now hit the rocket baby.

Controls are as follows, mouse left/right to rotate moon lander, E key to thrust upwards, R key to thrust downwards, LMB to thrust forwards and RMB to thrust backwards. A/D keys adjust the 3rd person view angle.

The three numbers displayed are rotational velocity, height over terrain and absolute velocity.

If you hit the terain with low enough rotational velocity and absolute velocity you landing is a success otherwise you will crash.

Very simple flight model (heck it is free!) but still a bit of fun.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 01:25
So assuming all went well the challenge now for all you budding astronauts is to build a convincing 'moon' level around this. Round of applause to the winner.

There are a few rough edges still with this, not sure if its my fault or GG limitations, but if anyone has any questions please feel free to fire away.

Been there, done that, got all the T-Shirts!
PM
JPH-GAMES
3D Media Maker
9
Years of Service
User Offline
Joined: 13th Feb 2015
Location: Belgique
Posted: 23rd Dec 2017 11:45
Thank you for the beautiful Christmas gift
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 12:14 Edited at: 23rd Dec 2017 12:16
Here is one I made earlier.

Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 23rd Dec 2017 12:34
Thank you so much Amenmoses
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 13:21 Edited at: 23rd Dec 2017 17:14
Just a quick word on how I would like to improve this.

1) Currently there is a slight 'wobble' effect when rotating the player view around, I need to turn off the player 'wobble' in Player control system.

2) At the Euler gimbal lock positions (-90 and +90 y angle) there is a strange little 'jump' in the visuals, I solved this issue in the original moon lander but can't recall how and didn't comment my code (lesson learnt, add more comments!).

3) I'd like to add adjustment of the camera up/down angle and also a zoom in/out. Mouse y and wheel maybe.

4) Bit more complex; currently the dynamic_entity.lua script only allows for hiding/showing of the decals, would look a lot better if they could scale up/down, i.e. have a special version of DE_Show function that could be passed a start scale value and end scale and have the scaling handled automatically. The problem with this is that it will only work properly if the decal/entity being scaled has it's origin at the exact centre, 'hot steam' doesn't so this approach may look a bit weird.

5) Change the numerical scale to use a text panel, or even better do it with sprites, this would probably mean adding another library module though.

6) The math for the 'flight modelling' is way way too simple at present, need to put in some proper math to handle acceleration/deceleration with proper formulae (Newtonian would probably suffice ).
Been there, done that, got all the T-Shirts!
PM
granada
Forum Support
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 23rd Dec 2017 14:43
Very cool AmenMoses,and thank you for this.

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 23rd Dec 2017 17:13
1) and 4) from my improvements list done. Amended scripts attached to this post in case I've broken anything.

Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 26th Dec 2017 00:24
Thanks for the fantastic work and Merry Christmas.
Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 30th Dec 2017 10:57
Amenmoses, I can't Thank You enough for the awesome Christmas gift! And all the other cool things you have done for our community. I'm speechless! The moonlander scripts are awesome! I can't stop playing now! Lol. I wish you, your family and every one on these forums a Very Happy New Year and many more to come! Cheers
Jim C
AceRimmer
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 31st Dec 2017 20:32
Smashing job, looks great going to be a load of fun when I get it working.

But whatever I do i keep getting this error message

.\scriptbank\utillib.lua:208: attempt to call upvalue 'ducked' (a nil value)

any ideas?

its like deja-vu, but all over again, again
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 20:54
Interesting one, 'ducked' is attempting to call GetGamePlayerStatePlayerDucking which is in global.lua.

Are you by any chance using an older version of GG that doesn't have that function in global.lua?
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 21:02
Try this version of the library.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AceRimmer
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 31st Dec 2017 21:36
I'm using the current public release.
I get another error with the above version script (mousemoveX) but no worries.

I'll wait until the DX11 version goes public, or try it in the preview version sometime.

Have a great new year!!!
its like deja-vu, but all over again, again
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 21:45
That's just weird, something must be screwy with the basic Lua setup on your machine, maybe missing some of the default scripts or something.
Been there, done that, got all the T-Shirts!
PM
AceRimmer
Reviewed GameGuru on Steam
9
Years of Service
User Offline
Joined: 28th Feb 2015
Playing: classic British heavy metal mostly
Posted: 31st Dec 2017 21:57
yea, it has not been right since I tried public preview DX11 and then reverted to 1.4.

On the bright side I just deleted everything except my "files" file and reinstalled it and your script all works great on the Public Preview version
its like deja-vu, but all over again, again

Login to post a reply

Server time is: 2024-04-20 14:33:16
Your offset time is: 2024-04-20 14:33:16