Jump to content

(just for fun) "Alternative" methods of doing things in-game


sjg
 Share

Recommended Posts

Thought I'd share this as someone might find the topic interesting or even useful. My project includes a random terrain/flora generator which creates the game area on the fly from a bunch of functions. However, I'm inexperienced with mathematics and don't know how to calculate the distance from say, the bottom of an entity to whatever brush is below it, so I did things the way they would happen in the real world: with gravity. I simply spawned a bunch of ents & props in the air, and let them land. Then, I added a hook to each entity so that when they hit the ground for the first time, it marks the time. After a certain period since marking, the collision hook is removed, the entity's mass is set to 0, it's rotated upright and to a random Y rotation, shadow mode to static and the collision type set to Collision::Scene. A brush is then created at the bottom of the model, is given an appropriate shape, and then its material is set to one with a 16x16 texture of alpha-transparency, giving the illusion that the scene prop has a solid body, but without calculating any gravity. Or something like that. It was a few days ago and I didn't document exactly WHY I had to use a brush with an invisible texture but it made sense at the time. I must have tried it with a pivot + shape and had no luck for whatever reason.

 

Anyway here's a video of the terrain generation in action, over and over again. Usually I hide the loading and falling behind an opaque splash screen, but I also put together a simple fade in/out system. Much like the splash screen it's mostly there to distract the eye; the duration is easily changed but I haven't altered it recently so it's still pretty obvious.

 

 

So, what MacGyver-y "hacky" tricks do you pull? I'm always fascinated by others' creativity when it comes to solving problems.

 

 

 

Edit: Just realised I posted this in General Discussion and not Off-Topic. My mistake!

  • Upvote 3
Link to comment
Share on other sites

In the title screen of my tournament game Rick Powers he's 'falling' and it looks like the wall behind him is endless but I actually just created a huge cylinder and am rotating it.

 

  • Upvote 4

---

Scott

 

Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...