Off Topic Productions
http://www.offtopicproductions.com/forum/

Minor things worth mentioning
http://www.offtopicproductions.com/forum/viewtopic.php?f=36&t=12035
Page 8 of 9

Author:  Hanfling [ Sun Jul 02, 2017 12:27 am ]
Post subject:  Re: Minor things worth mentioning

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:
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;
}

Author:  Hanfling [ Sun Jul 02, 2017 4:57 am ]
Post subject:  Re: Minor things worth mentioning

Code:
SET RootWindow bShowStats 1

Author:  Hanfling [ Sun Jul 02, 2017 3:25 pm ]
Post subject:  Re: Minor things worth mentioning

Hanhikers guide to UnrealScript optimization

Author:  Hanfling [ Mon Jul 03, 2017 10:15 pm ]
Post subject:  Re: Minor things worth mentioning

For rendering the 'Menu' windows after ScreenFlash.

Code:
// 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');
}

Author:  Hanfling [ Mon Jul 10, 2017 4:06 am ]
Post subject:  Re: Minor things worth mentioning

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.

Author:  Hanfling [ Tue Jul 11, 2017 10:54 am ]
Post subject:  Re: Minor things worth mentioning

http://coding.hanfling.de/Cargo_ROMM_vs_AppleRGB.zip What does look less wrong?

Author:  Andrievskaya Veronika [ Wed Jul 12, 2017 9:20 am ]
Post subject:  Re: Minor things worth mentioning

Cargo_ROMM

Author:  Hanfling [ Wed Jul 12, 2017 6:42 pm ]
Post subject:  Re: Minor things worth mentioning

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.

Author:  Hanfling [ Thu Jul 13, 2017 2:32 am ]
Post subject:  Re: Minor things worth mentioning

Ever wondered what this:
Quote:
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:
REGISTER_NAME(   2, IntProperty      )
REGISTER_NAME(  10, StructProperty   )


And Region is literally the name of the Property, so looking that up:
Code:
// Actor.uc:
var const PointRegion     Region;        // Region this actor is in.

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

Author:  Andrievskaya Veronika [ Thu Jul 13, 2017 8:44 am ]
Post subject:  Re: Minor things worth mentioning

The ROMM version looks more colorful than others, so i would prefer it.

Author:  Hanfling [ Tue Jul 25, 2017 2:54 pm ]
Post subject:  Re: Minor things worth mentioning

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

Author:  Hanfling [ Tue May 01, 2018 3:57 pm ]
Post subject:  Re: Minor things worth mentioning

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

Author:  Hanfling [ Mon May 14, 2018 1:35 pm ]
Post subject:  Re: Minor things worth mentioning

Code:
// ----------------------------------------------------------------------
// 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;
}

Author:  Hanfling [ Sun May 26, 2019 4:55 pm ]
Post subject:  Re: Minor things worth mentioning

Code:
//
// 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.

Author:  Hanfling [ Sun Jun 02, 2019 10:18 pm ]
Post subject:  Re: Minor things worth mentioning

New Launch/LCC release over at:

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

Page 8 of 9 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/