Notes about computer programming.
All notes taken as issue.
Try delete directory "Engine\Intermediate\Build\Win64\UE4Editor\Development\VisualStudioDTE" and rebuild.
Get-ChildItem .\ -Include bin,obj -Recurse | %{ Remove-Item $_.FullName -Force -Recurse }
setup proxy before running it: set HTTP_PROXY=http://localhost:8889
gitk file_path
Download and modify the qt5.natvis file, place it in VS_InstallRoot/Visualizers
Detail: https://wiki.qt.io/IDE_Debug_Helpers
Q: why QT built-in varaible is not displayed by default?
A:
A homogeneous coordinate is given by: (x, y, z, w), which projects to: (x/w, y/w, z/w). gl_FragCoord stores this projection, but rather than storing the (useless) (w/w) = (1) for the last component, it stores (1/w), to preserve useful information.
.*[^a]$
If you put the ^ symbol at the beginning of brackets, it means "everything except the things in the brackets." $ is simply an anchor to the end.
in StatsCommand.cpp, just define a static variable then cmds will be handled.
/** Exec used to execute core stats commands on the stats thread. */
static class FStatCmdCore : private FSelfRegisteringExec
{
public:
/** Console commands, see embeded usage statement **/
virtual bool Exec( UWorld*, const TCHAR* Cmd, FOutputDevice& Ar ) override
{
// Block the thread as this affects external stat states now
return DirectStatsCommand(Cmd,true,&Ar);
}
}
StatCmdCoreExec;
Error message: Make sure you have the correct access rights
use ssh -vv to check which ssh config file is used, add
Host gitlab.hostname.com
PreferredAuthentications publickey
IdentityFile path_to_fork_ssh_key
template<int N>
class TSize;
TSize<sizeof(long)> tSize;
error : implicit instantiation of undefined template 'TSize<8>'
template<typename N>
class TD;
auto x = 100;
TD<decltype(x)> xType;
Error message:
error : implicit instantiation of undefined template 'TDef<int>'
UnrealPakViewer可视化Pak分析工具
https://github.com/jashking/UnrealPakViewer
We encounter a rendering issue that one drawcall wirtes color buffer to all black.
From the GPU frame capture, found that the VS output does not match the PS input, one unsed attribute is not past to PS for saving the memory bandwith. so it`s a layout issue.
Fix:
hlslcc-option-flags 0x4000 is used when compiling shader.
HLSLCC_FLAG_SEPARABLE_SHADER_OBJECTS 0x4000 If set, adds location qualifiers to intra-shader varyings.
VS
Before | After |
---|---|
out vec4 vs_COLOR0; | layout(location = 4) out vec4 vs_COLOR0; |
out vec4 vs_COLOR1; | layout(location = 5) out vec4 vs_COLOR1; |
out vec4 vs_COLOR2; | layout(location = 6) out vec4 vs_COLOR2; |
out vec4 vs_COLOR3; | layout(location = 7) out vec4 vs_COLOR3; |
PS
Before | After |
---|---|
in vec4 vs_COLOR0; | layout(location = 4) in vec4 vs_COLOR0; |
in vec4 vs_COLOR2; | layout(location = 6) in vec4 vs_COLOR2; |
in vec4 vs_COLOR3; | layout(location = 7) in vec4 vs_COLOR3; |
Breakpoint can be hit if this attribute is added.
__attribute__((optnone))
void MyFunc()
{
}
PowerShell
Get-PhysicalDisk | ForEach-Object {
$physicalDisk = $_
$physicalDisk |
Get-Disk |
Get-Partition |
Where-Object DriveLetter |
Select-Object DriveLetter, @{n='MediaType';e={ $physicalDisk.MediaType }}
}
GenerateProjectFiles.bat -project="D:\xx\project\xx.uproject" -Game -Engine
Then the xx.sln will be generated in D:\xx\project
Additional argument: -Platforms=Win64 -ShippingConfigs -NoDummyConfigs -NoEnginePrograms
ShowDebug Animation
FScopedMemoryStats. need to add GlobalDefinitions.Add("ENABLE_MEMORY_SCOPE_STATS=1"); in xx.Target.cs
rhi.DumpMemory
r.DumpRenderTargetPoolMemory
ToggleDebugCamera
DisableAllScreenMessages/EnableAllScreenMessages
-waitforattach
-ExecCmds="stat unit,log LogTemp Verbose"
stats.MaxPerGroup
// To get verbose informations about drawcalls. only for dev build. for test build, define ALLOW_PROFILEGPU_IN_TEST
ToggleDrawEvents
r.RHISetGPUCaptureOptions 1 // enable more infos
r.VisualizeOccludedPrimitives 1
r.SecondaryScreenPercentage.GameViewport
r.DynamicRes.OperationMode
r.DynamicRes.FrameTimeBudget
profileGPU //to investigate the breakdown of GPU performance per pass
Stat GPU to see the total gpu impact (overdraw in transparency, cycle cost in Niagara GPU Simulation)
Stat Niagara //is just a basic cost and memory overview
Stat NiagaraEmitters //gives frame information about the emitters
Stat NiagaraSystems //gives frame information about systems.
r.ShadowQuality // 0:off, 1:low(unfiltered), 2:low .. 5:max (default)
r.ScreenPercentage 10 // to quickly check if your`re GPU bound
r.SubsurfaceScattering 0 // to disable subsurface scattering
r.PostProcessAAQuality // 0:off, 1:very low (faster FXAA), 2:low (FXAA), 3:medium (faster TemporalAA), 4:high (default TemporalAA), 5:very high, 6:max
r.AmbientOcclusionLevels 0 // to disable AmbientOcclusion
r.ViewDistanceScale 0.0 - 1.0 // View Distance
// only in development build
ViewMode ShaderComplexity
ViewMode QuadOverdraw
Turn off VSync: r.vsync 0
Turn off Frame Rate Smoothing
startup arugument: networkversionoverride=123
FNetworkVersion::GetNetworkCompatibleChangelist
FNetworkVersion::GetLocalNetworkVersion
LogNetVersion: ProjectName 1.0.0.0, NetCL: 54239, EngineNetVer: 17, GameNetVer: 0 (Checksum: 4117681995)
// add in cpp
PRAGMA_DISABLE_OPTIMIZATION
PRAGMA_ENABLE_OPTIMIZATION
// add in xx.Build.cs
OptimizeCode = CodeOptimization.Never;
log LogNetPackageMap VeryVerbose // 打开网络消息日志
log LogPhysics
log LogEQS
log LogStreaming
log LogNavigation
log LogUMG
log LogPlayerController Verbose
log LogRenderTargetPool Display
log LogStreamableManager Verbose
#new bat to call GenerateProjectFiles.bat
call "../GenerateProjectFiles.bat" "../../../Game/xx.uproject" -Game -Engine -Platforms=XSX+Win64+PS5 -ShippingConfigs -NoDummyConfigs -2019
working directory: Engine\Binaries\DotNET
command arguments: "../../../Game/xx.uproject" -Game -Engine -Platforms=XSX+Win64+PS5 -ShippingConfigs -NoDummyConfigs -2019
working directory: Engine\Source
command arguments: xx XSX Test -WaitMutex -FromMsBuild -2019
...\Engine\Programs\AutomationTool\Saved\Logs\Log.txt
Generate multiple paks: check "Store all contents in a single file(UnrealPak)", uncheck "Generate Chunks"
What are in pak files:
Game\Saved\TmpPackaging\
MySQL v 5.7 or higher generates a temporary random password after installation and stored that in mysql error log file, located at /var/log/mysqld.log
for an installation by the MySQL Yum repository on CentOS 7.
use below command to see the password:
shell > sudo grep ‘temporary password’ /var/log/mysqld.log
use below mysql command to set the password policy to low:
SET GLOBAL validate_password.policy=LOW;
#Usage
public class DerivedC : BaseC
{
new public void Invoke() {}
}
class ItemFactory<T> where T : new()
{
public T GetNewItem()
{
return new T();
}
}
Find exclusive items in Column B against Column A:
A|B|=IF(COUNTIF($A:$A, $B1)=0, "Not found in A", "")
Client Version 3.3.5(12340)
6852306D5908A9519D61C06BB06A923CF3E46405.zip
https://www.wowhead.com/wotlk/items can be used to check the item id, id is in the url.
https://trinitycore.atlassian.net/wiki/spaces/tc/pages/77971021/Final+Server+Steps
GM commands:
https://trinitycore.atlassian.net/wiki/spaces/tc/pages/2130065/GM+Commands
worldserver.conf
AlwaysMaxSkillForLevel = 1
.additem 51809 4 // 24 slots bag
.gm fly on
.modify speed fly 15
// learn all my class skills
.learn my trainer
// learn riding skills
.learn 34091 // riding 300
.learn 54197 // cold weather flying
.additem 44843 // dragonhawk
.additem 44413 // motorcycle
// learn fishing
.learn 51294
.additem 44050 // fishing pole
// add itemset
.additem set 885 // priest
CRPT: Curiously Recurring Template Pattern
e.g. std::enable_shared_from_this
Both are use to add generic functions onto existing class.
CRPT: existing class needs to inherit the CRTP.
Mixin: existing class leaves unchanged.
设置一个Content Stream, 让美术和策划不必拉取源代码
P4 Stream Path Setting:
share ...
exclude UnrealEngine/Engine/...
share UnrealEngine/Engine/Binaries/...
share UnrealEngine/Engine/Build/...
share UnrealEngine/Engine/Config/...
share UnrealEngine/Engine/Content/...
share UnrealEngine/Engine/Shaders/...
share UnrealEngine/Engine/Plugins/...
exclude UnrealEngine/Engine/Plugins/....h
exclude UnrealEngine/Engine/Plugins/....cpp
exclude UnrealEngine/Engine/Plugins/....cs
share UnrealEngine/Engine/Source/Programs/Shared/MetaData.cs
exclude UnrealEngine/Game/Source/...
share UnrealEngine/Game/Source/*Editor.Target.cs
如果workspace看不到 *Editor.Target.cs, 那UGS就无法启动Editor
上述配置有个问题, editor binary提交p4后, UGS依然无法看到记录, 原因为workspace过滤掉了相关代码.
临时解决办法:
1.去掉代码过滤.
2.手动修改CL号为具体代码提交CL
最终解决办法: 不过滤代码
It`s a tool to generate diagram.
char (*__kaboom)[sizeof( TYPE )] = 1;
find the compilation error: can not convert 'int' to 'char (*)[xxx]'
xxx will be the sizeof( TYPE )
A lambda can only be converted to a function pointer if it does not capture.
minUpdateDiff = 1; //ms
while()
{
realCurrTime = getMSTime();
uint32 diff = getMSTimeDiff(realPrevTime, realCurrTime);
if (diff < minUpdateDiff)
{
// sleep until enough time passes that we can update all timers
std::this_thread::sleep_for(Milliseconds(minUpdateDiff - diff));
continue;
}
sWorld->Update(diff);
realPrevTime = realCurrTime;
}
for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do rd "%d"
How to access cvar from different cpp
static const auto CVarEnableTickAggregation = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("EnableTickAggregation"));
Get argument at very early time, we need to use special functions rather than FCommandLine
#if !UE_BUILD_SHIPPING
const TCHAR* CommandLine = ::GetCommandLineW();
if (FCString::Stristr(CommandLine, TEXT("-ansimalloc")))
{
AllocatorToUse = EMemoryAllocatorToUse::Ansi;
}
#endif
adb exec-out screencap -p > screen.png
std::enable_shared_from_this use std::weak_ptr to enable passing shared_ptr within class member function.
C# source file -> CSC.exe -> app.exe
app.exe .text section contains:
app.exe -> MSCOREE.dll -> CLR Loaded -> Compils IL to machine code -> run machine code
Since C++17:
std::vector<int> vec ={1,2,3,4,5};
if(auto it = std::find(vec.begin(), vec.end(), 3); it != vec.end())
{
std::cout << *it << std::endl;
}
template<typename T0, typename... T>
void MyPrint(T0 t0, T... t)
{
std::cout << t0 << std::endl;
if constexpr (sizeof...(t) > 0) MyPrint(t...);
}
This is a feature that enables the GPU ranther than the CPU to determine to not draw, copy, or dispatch an object.
The typical use of this feature is with occlusion: if a bounding box is drawn and is occluded, there is no point in drawing the object itself.
while early-z pass remove the unnecessary pixels shading, conditional rendering can remove the overhead of drawing cammand itself,
LC_ALL=C find . -name '*[! -~]*'
p4 diff2 -u //streamdepot/Dev/...@32696 //streamdepot/Dev/...@32697 > 32697.patch
p4 changes -m1 "#have"
p4 changes -m1 //ac3l-remake-data/main/...#have
Console.WriteLine($"Arguments: {System.Reflection.Assembly.GetExecutingAssembly().Location} {string.Join(", ", Arguments)}\nCurrentDirectory: {System.IO.Directory.GetCurrentDirectory()}");
Console.WriteLine("Waiting for debugger to attach");
while (!Debugger.IsAttached)
{
Thread.Sleep(100);
}
Console.WriteLine("Debugger attached");
It is a convinient that put Open/Close, Start/Stop or Initlize/Uninitialize functions call together, like this:
if (!StartDB())
return 1;
std::shared_ptr<void> dbHandle(nullptr, [](void*) { StopDB(); });
List comprehensions with if
[expression for variable_name in iterable if condition]
odds = [i for i in range(10) if i % 2 == 1]
print(odds)
# [1, 3, 5, 7, 9]
sort a tuple list, by the second item
obj_diff_list.sort(key = lambda i:i[1], reverse=True)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.