Page 8 of 9

Re: Minor things worth mentioning

Posted: Sun Jul 02, 2017 12:27 am
by Hanfling
Found another weired thing: Windows are ticked before the Engine class is (which ticks Level, which ticks all Actors, etc.). And flipping the Tick order seems to solve this annoying issue of ViewportWindows are sometimes (or at least sometimes noticable) rawn without their overlay when toggling them on/off for a frame or so.

Nothing otherwise happening in Tick below UGameEngine, so for experimenting with, one just flips the order and be done.

Code: Select all

void URevGameEngine::Tick( FLOAT DeltaSeconds )
{
	guard(URevGameEngine::Tick);

#if 0 // Try ticking Windows before Engine. (Doesn't crash, but leave it out for now).
	UGameEngine::Tick( DeltaSeconds );
	XRootWindow::TickWindows( DeltaSeconds );
#else
	// Super.
	Super::Tick( DeltaSeconds );
#endif

	// Tick GamePlatform.
	TickGamePlatform( DeltaSeconds );
	unguard;
}

Re: Minor things worth mentioning

Posted: Sun Jul 02, 2017 4:57 am
by Hanfling

Code: Select all

SET RootWindow bShowStats 1

Re: Minor things worth mentioning

Posted: Sun Jul 02, 2017 3:25 pm
by Hanfling

Re: Minor things worth mentioning

Posted: Mon Jul 03, 2017 10:15 pm
by Hanfling
For rendering the 'Menu' windows after ScreenFlash.

Code: Select all

// Extension.PlayerPawnExt
simulated event PostRenderFlash( Canvas Canvas )
{
	// Allow windows to be rendered after Flash.
	if ( !bool(RootWindow) || !RootWindow.RenderWindowsAfterFlash() ) // Actually no much of a point in calling it without RootWindow. --han
		PostRenderWindows( Canvas );

	Super.PostRenderFlash( Canvas );
}
simulated event PostRender( Canvas Canvas)
{
	// Allow windows to be rendered after Flash.
	if ( bool(RootWindow) && RootWindow.RenderWindowsAfterFlash() )
		PostRenderWindows( Canvas );

	Super.PostRender( Canvas );
}

// Extension.RootWindow
function bool RenderWindowsAfterFlash()
{
	return false;
}

// DeusEx.DeusRootWindow
function bool RenderWindowsAfterFlash()
{
	return WinCount>0 && WinStack[0].IsA('MenuUIMenuWindow');
}

Re: Minor things worth mentioning

Posted: Mon Jul 10, 2017 4:06 am
by Hanfling
The story why there are no savegame snapshots for OpenGLDrv:

Basically Sweeney, when creating the first UOpenGLRenderDevice (version) sort of managed to dublicate the Viewport variable off URenderDevice, so that was set by the UOpenGLRenderDevice, not the one on the URenderDevice. Afterwards everyone just copied that all along.

Deus Ex snapshot functionality in the end uses GRenderDevice->Viewport, which will never get set for OpenGLDrv because of that dublicated variable and thus Rootwindw can't figure out Viewport size and does nothing.

Re: Minor things worth mentioning

Posted: Tue Jul 11, 2017 10:54 am
by Hanfling

Re: Minor things worth mentioning

Posted: Wed Jul 12, 2017 9:20 am
by Andrievskaya Veronika
Cargo_ROMM

Re: Minor things worth mentioning

Posted: Wed Jul 12, 2017 6:42 pm
by Hanfling
Added more shots, but now put them on a page, rather than update the zip file. I now added cargo03, and sRGB (as some sort of default if no convertion happens).

http://coding.hanfling.de/Cargo/

Convertion to Apple RGB is done absolute colormetric, in case of ROMM I used Photoshop (with afaik) the same setting. However ROMM uses the D50 illuminant instead of the D65 as the other two are using, so there is plenty of room for experimenting with other whitepoint adaption schemes.

Re: Minor things worth mentioning

Posted: Thu Jul 13, 2017 2:32 am
by Hanfling
Ever wondered what this:
Warning: Type mismatch in Region of GameReplicationInfo: file 10, class 2
Warning: Skipping 6 bytes of type 10
is all about? I have before, but now I got it:

The 10 and 2 are Name indices, looking them up in UnNames.h yields:

Code: Select all

REGISTER_NAME(   2, IntProperty      )
REGISTER_NAME(  10, StructProperty   )
And Region is literally the name of the Property, so looking that up:

Code: Select all

// Actor.uc:
var const PointRegion     Region;        // Region this actor is in.

// GameReplicationInfo.uc:
var() globalconfig int 		 Region;		// Region of the game server.

Re: Minor things worth mentioning

Posted: Thu Jul 13, 2017 8:44 am
by Andrievskaya Veronika
The ROMM version looks more colorful than others, so i would prefer it.

Re: Minor things worth mentioning

Posted: Tue Jul 25, 2017 2:54 pm
by Hanfling

Code: Select all

x/min(1,x) = max(1,x)

Re: Minor things worth mentioning

Posted: Tue May 01, 2018 3:57 pm
by Hanfling
AllActor iterators silenty sets BaseClass=Actor if you pass BaseClass=None.

So always check if your BaseClass is not None if you store it inside a variable before calling AllActors (or similiar iterators).

I wasn't aware of this behaviour before and had some innocent looking dynamicload class and iterate over and destroy all those actors code, which in the end resulted in networking turned bad. And yes it took me 'some' time to trace down this issue..

Re: Minor things worth mentioning

Posted: Mon May 14, 2018 1:35 pm
by Hanfling

Code: Select all

// ----------------------------------------------------------------------
// VDiskRand2D()
//
// Random point on Disk in xy-plane.
// http://mathworld.wolfram.com/DiskPointPicking.html
//
// Could be optimized.
// ----------------------------------------------------------------------

simulated final static function Vector VDiskRand2D( float DiskRadius )
{
	local float  Radius, Angle;
	local Vector Point;

	Radius = Sqrt(FRand())*DiskRadius;
	Angle  = FRand()*2.0*PI;

	Point.X = Radius*Cos(Angle);
	Point.Y = Radius*Sin(Angle);

	return Point;
}

Re: Minor things worth mentioning

Posted: Sun May 26, 2019 4:55 pm
by Hanfling

Code: Select all

//
// sp##v could get invalid by property object unloading, while dll is never released,
// so the static sp##v can become a dangling pointer.
//
// So for now, try to save RepIndex directly. which should be constant.
//
// Also note, that the initialization time for the static variables are compiler
// dependend, so other compiles unlike MSVC6 may initialize them at dll load time
// before the property may be correctly loaded.
//
//#define DOREP(c,v) \
//	if( NEQ(v,((A##c*)Recent)->v,Map) ) \
//	{ \
//		static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
//		*Ptr++ = sp##v->RepIndex; \
//	}
//
//#define DOREPARRAY(c,v) \
//	{static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
//	for( INT i=0; i<ARRAY_COUNT(v); i++ ) \
//		if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
//				*Ptr++ = sp##v->RepIndex+i;}
//
//#define DOREPARRAYINDEX(c,v,i) \
//	{static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
//	if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
//			*Ptr++ = sp##v->RepIndex+i;}
//

#define DOREP(c,v) \
	static INT s##c##v##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex; \
	if( NEQ(v,((A##c*)Recent)->v,Map) ) \
		*Ptr++ = s##c##v##RepIndex;

#define DOREPARRAY(c,v) \
	static INT s##c##v##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex; \
	for( INT i=0; i<ARRAY_COUNT(v); i++ ) \
		if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
				*Ptr++ = s##c##v##RepIndex+i;

#define DOREPARRAYINDEX(c,v,i) \
	static INT s##c##v##i##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex+i; \
	if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
		*Ptr++ = s##c##v##i##RepIndex;
Found a potential use after free hazard for the nativereplication stuff. So you should at lesat use the above updated macros.

Re: Minor things worth mentioning

Posted: Sun Jun 02, 2019 10:18 pm
by Hanfling
New Launch/LCC release over at:

https://coding.hanfling.de/launch/