HomeNewsFeaturesLicensingDownloadsScreenshotsFAQRoadmap Contact Us
Search:
10 Online

Community

Discussion Topics Recent Postings User Contributions General Articles Example Documentation Credits

Licensed Developer

Programmer's Manual Artists Manual Tutorials and Articles

Programming: Game Code

Game Code Overview Server Side Game Code Client Side Game Code

Programming: System

Alphabetical Function List Renderer File System Collision & Ray Casting Low Level Audio Game Audio The Console Console Variable List Multiplayer Localisation Maths Library Memory Manager Model File Formats Texture Formats

Art: Overviews

Specifications Shaders Particle Systems Lens Flares Cipher console Cipher file types Tutorials Reference

Art: Tools

Shader Designer Particle Designer 3dsmax tools Model Conversion Font Generator

Cipher Engine
Game Development Search Engine
GameDev.net
You are not signed in - [sign in] [register]

Manual Visibility of Segments

Overview

Author: firefox
Date Submitted: 2004-01-06 00:31:19

Source Code

/*
==========================
world_ReadVis

Parse the visibility information in a segment
==========================
*/
void world_ReadVis(int segment)
{
	tchar_t* tok;
	int i;
	
	// Read Visibility string in the format 0100101, a digit for each segment, 1=visible, 0=invisible
	tok = NextTok();

	// ignore strings with wrong length
	if( (int)com_strlen( tok ) == segment_count )
	{
		for( i=0; i < segment_count; i++ )
		{
			if( tok[i] == _T( '0' ) )
				segments[segment].vis[i] = 0;
			else
				segments[segment].vis[i] = 1;
		}
	}
}


Description

Cipher offers a great functionality with its segmentation of levels. By using the defaults of the engine, one can automatically let cipher determine which of the segments is visible from each other by simply setting the "seg_visrange" CVAR before loading a level.

The Cipher docs also mention a possibility to manually state which one of the segments is visible from each other; unfortunately I wasn't able to find the according source code. At least as far as I could find it, the function responsible for reading the manual visibility information, world_ReadVis in file r_world.c of project renderer, is present but not implemented.

So all I had to do was implement it ;-). It is already called from the segment parser script, so to use it, simply copy this code to r_world.c, roughly at line 550 you will find world_ReadVis.

As the comment roughly states, you can insert visibility information into each segment by defining a digit for each segment existing, 0 for invisible, 1 for visible. By default, at least the current segment should be visible. For example:


segment_count 23
...
segment 12
{
vis 00000001111111110000001
...

This defines Segments 8-16 and Segment 23 as visible from Segment 12. There have to be exactly as many digits as next token after "vis" as there are Segments, so if you have 50 Segments, there are 50 digits, 0 or 1.

Hope you can use it in your projects (if you haven't already implemented it ;-).

[Recent Contributions] [Recent Source Code]



Register and Sign In to discuss this article