Scripts / Portal Gun & Random Placement

Author
Message
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 7th Dec 2014 10:57 Edited at: 7th Dec 2014 11:04
So the video shows a rough work in progress idea for a portal gun script ... it currently shows teleporting to random places on the map after you run through the portal generated by the gun, it could be made to teleport to a random pick from a known list of exit points, but I quite like the completely random idea (I'm also working on a procedural random placement of enemies script - which is starting to work OK to add a bit more of that "different play each time run same level" twist).



One problem I've got for the random placement is that I can't think of a way to pre-determine the terrain height at an X,Z co-ordinate - so I'm having to drop the player in from a large height to stop spawning inside hills. Anyone any better ideas or would this need an engine change?



The other issue (for the portal gun itself) is that I can't determine within lua which weapon the player is using - am I missing something obvious? I can tell which was last picked-up and all weapons in the collection, but not the one that is actually in use.



Oh - and thanks to Cosmic Prophet and Unfamilia for the steampunk weapons in the FPSC community pack (one of which is seen in the video as the portal gun).





smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Dec 2014 21:39
cool
but as for the questions...sorry no idea.

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 7th Dec 2014 22:35
You were one of my best hopes to answer the questions! If you don't know ... I'll just have to wait for next version !

Cheers.

Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 12th Dec 2014 14:32
That looks great! Nice work!

MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Dec 2014 19:26
my advice would be to email lee or SC directly after 1.009 is released and give him the/a video and your specific requirements - i.e. GetTerrainHeight(x,z) or some similar command
and also the one about the get current weapon - i have never used any of the commands you listed so i don't know anything about them but if there are already some in place then im sure it wont take long for him to add that too (should only be 1 variable after all)

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 13th Dec 2014 01:06
Thanks for the comments and advice.

I've been trying to procedurally place entities (buildings, trees etc) as well as NPC enemies and have had some success with the characters, but the trees and other entities are very difficult to place on a non flat terrain - they spawn in hills or if I try to hide-drop-reveal they fall over and even with delays to establish y position and for gravity and collision once 'landed', not very successful so far

smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 13th Dec 2014 10:15
for falling over you could try setting the weight as max
i think it's like 9999, not tested it with falling as such but the weight setting does have an effect on moving etc

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 14th Dec 2014 02:39 Edited at: 14th Dec 2014 02:50
You can determine terrain height at a given point by using a proxy object that has physics on to follow the terrain. The item can be invisible and you simply move it to the place on the map you want to check the terrain height. It'll automatically following the terrain so getting the entity's y position will give you the terrain height at that position.



EDIT: Or it might be Physics off and gravity on. I can't remember which exactly, but proxy objects like this will work. I did it in my Rescue the Princess game so I know it works.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.0085
Avram
GameGuru TGC Backer
18
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 17th Dec 2014 12:29
I also thought of proxy object which you would move to X,Z and let it fall to ground, then teleport to it. It would need to have gravity on but physics off.

How do you spawn that teleport when shooting?

cybernescence
GameGuru Master
11
Years of Service
User Offline
Joined: 28th Jan 2013
Playing: Cogwheel Chronicles
Posted: 18th Dec 2014 10:29
Thanks for the comments. I couldn't get proxy objects to work this way - I must have missed some combination of gravity/physics/collision or something - I'll try again now that I know it can be made to work.

@Avram - there is a hidden entity in front of the 'portal weapon' when it's selected that waits for hits (health drop) from the weapon (to trap when gun fired basically), then the portal sprite is activated at the same position ... standard teleport code to a random position after that (following a proxy object).

Login to post a reply

Server time is: 2024-12-21 17:54:16
Your offset time is: 2024-12-21 17:54:16