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.
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
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