News Design Artwork Photos Articles
Creative Commons All use of my digital work is covered by this Creative Commons Deed.
Please do not use any of my work for commercial purposes, thank you.
 Random Crazy Logic (Page 7 of 7) Previous Page Articles page
Edge of Forever - Random Number The puzzles in the map Edge of Forever only have one solution and the method for finding them is usually the same. Some of the puzzles can be setup randomly and that would make the solution more interesting to find.

A target_delay entity can use a random number to setup puzzles differently, but this often produced the same number several times in a row. The random function could be changed with new code, but the project was about creating something with the vanilla Q3 engine only.
Click on the above image for a larger version
Entity Legend The ideal solution would be for the random number function to give a different result each time. One possible solution is to create a crazy logic machine that would keep generating random numbers and give different results. I did say crazy logic right!?!

The puzzles that could be setup differently have four binary switches which the player has to change to the same value. Only two of the switches need to be changed each time for the solution to be different.
 Making Square Wheels    
Whole Number Logic The random function returns a decimal number (0.00 - 0.99) and the final result needs to be an integer. This means the number should be rounded down using some entity logic as no math functions are available.

Four target_delay entities are connected to four func_door blockers which are setup with incremental one second delays to emulate the integer number boundaries in the range of zero to four seconds. Each blocker has a hole for the target_shooter to aim through.
Unique Logic The Q3 random number function can still generate the same number every time the target_delay is triggered. The entity logic should keep trying to generate a new number if the same is produced every time.

When the target_shooter entity (pink square) triggers the func_button entity (purple/red block) it moves up temporarily (wait key) to stop the repeat function happening. A func_door entity (blocker) is also triggered to stop the number from being picked again and letting the repeat function retry.
Repetition Loop When a random number is finally generating the whole process starts again because the original puzzle requires two switches to be changed to make the solution different.

The random number logic is started when the game begins and two func_buttons are used to control how many times the whole process is run. When a result is found, everything feeds back to the original counter and checks if anymore loops are required.

Warning, creating this type of crazy logic at home can lead to insanity and should only be used as a last resort!
Prev Page Articles Page
Mememe
Articles 
Level Design -
GameDev Advice -
Creating Terrain -
Terrain Blending -
Rockwall Corridors -
Rockwall Detail -
2 Point Clipping -
Phong Shading -
3D Puzzle Scripting -
Triggerable Shaders -
RTCW Scripting -
Scripted Doors -
Basic Lift -
Advanced Lift -
Cooking -
Apple Crumble -
This site has been cobbled together by Simon O'Callaghan
Contact Information: Simon O'Callaghan
All content is Copyright © 2000-2024
Hosted by ApisNetwork