Duplicating a brushmodel entity

Hi there !

I’m working on a random level generator working with square tiles re-arranging themselves once the level start.

I created a “func_tile” entity that I use in gtkRadiant to set up my tiles with brushes.

When the game starts, it goes through the bsp’s entities. I intentionally don’t spawn the func tiles; later on I have a function that spawns my tiles dynamically :

ent = G_spawn;
SP_duplicate_func_tile( ent, g_entities[g_Ttiles[0]]);

That last function works in a similar way as the SP_func_* functions in g_mover.c.

Everything compiles correctly, but once I test my map, there is a client / renderer side problem :
On the server / game side, everything seems to work fine : the player collides correctly with the entity’s geometry.
Visually, only One instance of the entity is drawn ! and this is relative to where you are looking - if I spawn only one func_tile, it’s allright, but if there is 2, and if the two are on the screen, only one will be drawn.

I hope my description talks …

So basically, my question is : is it possible to draw the same brushmodel (func_* type entity) multiple times ?

I’m looking inside the SV_SetBrushModel function right now.

Problem solved by commenting a condition in the function “R_AddWorldSurface” in tr_world.c ;

(line 284)
if ( surf->viewCount == tr.viewCount ) {
    return // already in this view
}

I hoped to solve this without doing stuff in the renderer :-s

Do you think it would be possible to solve this by only modifying stuff in game and / or cgame ?

Thanks :slight_smile:

Possibly by rendering multiple scenes. Though it might break sort order or totally not work.

Like each time you’re going at add duplicated brush to scene do;

	// add the duplicate brush entity
	trap_R_AddRefEntityToScene( &blah );

	// draw brush and all other things added so far
	cg.refdef.rdflags |= RDF_NOWORLDMODEL;
	trap_R_RenderScene( &cg.refdef );

	// prepare for next time or final scene draw
	cg.refdef.rdflags &= ~RDF_NOWORLDMODEL;
	trap_R_ClearScene();

Yup that could theoricly do it … But the I think the sort order is taken care of in the renderer, isn’t it ? so yes, I think this would lead to unwanted results :slight_smile:

it’s alright, I’ll do my game without dynamic lights. Actually, I might not even have this problem in the final version, since I’ll have enough tiles to have every one different :slight_smile: