自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(53)
  • 收藏
  • 关注

原创 Ue4反射使用

// Fill out your copyright notice in the Description page of Project Settings.#include "HelloGameModeBase.h"#include"MyObject.h"#include "MiddleStudent.h"#include "UObject/UObjectHash.h"#include "UObject/UObjectIterator.h"AHelloGameModeBase::AHello

2022-03-04 09:42:23 520

原创 C++反射实现

基础版:只实现了通过对象的类名,获取到成员属性的name和type#include <string>#include<iostream>#include<map>#include<vector>#include<set>using namespace std;#define REFLECT_ATTR(type,name) ReflectManager __##name = ReflectManager(this,#type,.

2022-03-02 11:47:15 384

原创 渲染顺序实现

1. 场景资源组织结构类图2. 设置相机的俯仰角为30度 决定了长:宽 = 2:13. 三个场景坐标系的实现4.场景网格实现,填充网格中对象5.遍历网格中对象通过比较函数构建有向图6.用SCC算法检查冲突问题...

2021-12-02 11:51:53 158

原创 用SCC算法检查冲突问题

https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithmtarjen算法实现scc_ccqq0507的博客-CSDN博客1. 冲突问题理解当一个有向图的方向,因从哪个节点先开始而导致不同的有向图结果,即可理解为有向图中存在冲突问题2. 问题产生过程一旦构成了强连通,就会产生冲突问题首先,下图上面的就构成了强连通具体是因为经过了下图的就是因为从right有一条指向..

2021-12-02 11:48:44 549

原创 遍历网格中对象通过比较函数构建有向图

从场景网格到有向图先将center加到有向图然后比较函数,得出right在center后面,所以形成由right指向center----int Compare(const iso::IsoView* a, const iso::IsoView* b) { const IsoAABB& aabb1 = a->getWorldAABB(); const IsoAABB& aabb2 = b->getWorldAABB(); .

2021-12-02 11:23:49 783

原创 场景网格实现,填充网格中对象

1. 确定网格边界即世界坐标通过屏幕坐标系,化为256*256的网格,但是Y轴只用到128简单来书就是像比图比例尺18900:256 = 1:0.00044554一个贴图会有屏幕坐标,然后进行缩放,计算在网格中的边界值(bounds)2. 网格实现spatialGrid// 根:对象static inline void getCookie(int* raw, iso::IsoWorldCookie*& cookie){ // cppchec...

2021-12-02 11:12:44 192

原创 场景坐标系z坐标的实现,x与y的夹角为多少?

1. cell坐标系(场景的边界值)

2021-12-02 10:51:53 429

原创 UE中Csv配置器

蓝图配置器 准备csv格式配置文件 创建蓝图struct,命名为FSpeakerInfoLine,导入表配置,得到Speaker的DataTablet 使用配置数据 创建UI并把其中的文本bind为SpeakerChoice的变量 在GameMode中显示UI和获得SpeakerController的引用,通过对象引用进行初始化InitSpeakerController:SpeakerController进行...

2021-11-22 09:45:43 459

原创 tarjen算法实现scc

//#include <bits/stdc++.h>#include<iostream>#include<stack>using namespace std;#define M (INT_MAX)#define PRINT_ARRAY(a,n) do{for(int i = 0; i < n; i++) cout<<a[i]<<"|"; cout<<endl;}while(0)/***************

2021-10-14 17:07:07 183

原创 选择排序之堆排

void heapInsert(int curArr[], int index){ while (curArr[index]>curArr[(index-1)/2]) { swap(curArr[index], curArr[(index - 1) / 2]); index = (index - 1) / 2; }}void heapify(int curArr[], int heapSize){ int rootIndex =

2021-09-15 15:21:18 71

原创 交换排序之快速排序

int partion(int curArr[],int lIndex,int rIndex){ int partIndex = rIndex; int moreIndex = rIndex - 1; int lessIndex = lIndex; while (moreIndex != lessIndex) { if (curArr[lessIndex] > curArr[partIndex]) { swap(curArr[

2021-09-15 11:10:46 57

原创 四种简单排序

deque<int> merge(deque<int>leftVec, deque<int>rightVec) { deque<int> ret; //reverse(leftVec.begin(), leftVec.end()); //reverse(rightVec.begin(), rightVec.end()); while (leftVec.size()>0&&rightVec.size()&gt

2021-08-26 17:15:38 80

原创 构造二叉树用中序vector以及前序或者后序

TreeNode* preTree(vector<int>preVec, vector<int>inVec){ if (preVec == inVec) return nullptr; int rootValue = preVec.front(); //给后序用这个 //rootValue = preVec.back(); TreeNode* root = new TreeNode(rootValue); if (preVec.si

2021-08-23 20:54:49 109

原创 cppAndLua

#include"lua.hpp"#include<iostream>using namespace std;void showStack(lua_State* st){ int size = lua_gettop(st); cout << "=================== top ===================" << endl; while (size>0) { string value = lua_isstring(st,

2021-08-05 16:57:43 275

原创 二叉树是否平衡

// fowlup.cpp -- unique_ptr not a good choice#include <iostream>#include <string>#include <stack>#include<vector>#include<string>#include <algorithm>using namespace std;struct TreeNode { int val; TreeNo

2021-08-04 20:23:57 76

原创 行为树的实现

#pragma once#include<string>#include<vector>using namespace std;#include<iostream>enum E_Status{ RUNNING, SUCCESS, FAIL,};class NodeBase{public: virtual void enter() = 0; virtual E_Status tick() = 0; virtual void exit() =

2021-08-01 17:41:06 438

原创 状态机和行为树

游戏AI的实现通常分为两种,有限状态机(FSM)以及行为树,有限状态机(FSM)有限状态机,又称有限状态自动机,简称状态机,是表示有限个状态以及在这些状态之间的转移和动作等行为的数学模型。有限状态机维护了一张图,图中的结点代表不同的状态,状态之间通过某种条件触发转换,如果不满足条件则维持原状态。这里以一个简单的例子来说明。下图为游戏中使用的怪物AI有限状态机。从图中可以看出,有限状态机表示的AI不可能同时处于图示状态中的多个,而只可能处于其中一种状态,状态的转换取决于转换条件和当前所处状态。我

2021-07-31 17:13:28 274

原创 二叉树所有路径

void traversal(TreeNode* cur, vector<int>& path){ path.push_back(cur->val); if (cur->left == nullptr && cur->right == nullptr) { cout << "path::::"; for (auto it : path) { cout <&l

2021-07-29 10:04:25 79

原创 二叉树层序遍历

void CengOrder(TreeNode* root,vector<vector<int>>& res) { if (root == nullptr) return; queue<TreeNode*> q; q.push(root); while (!q.empty()) { int cursize = q.size(); res.push_back(vector<int>(

2021-06-30 17:30:40 69

原创 二叉树递归

// fowlup.cpp -- unique_ptr not a good choice#include <iostream>#include <string>//#include <memory>#include<vector>#include<string>using namespace std;struct TreeNode { int val; TreeNode* left; TreeNode* r

2021-06-17 20:24:21 54

原创 智能指针的选择

// fowl.cpp -- auto_ptr a poor choice#include <iostream>#include <string>#include <memory>int main(){ using namespace std; auto_ptr<string> films[5] = { auto_ptr<string> (new string("Fowl Balls")),

2021-06-10 17:58:10 63

原创 使用atomics的使用

#include <iostream>#include <ctime>#include <mutex>#include <vector>#include <thread>#include <atomic>std::mutex mtx;size_t count = 0;//使用atomicstd::atomic<size_t> count_1(0);void threadFun(){ for (int

2021-06-01 10:50:37 89

原创 Unreal事件分发机制

什么是观察者模式观察者模式定义了对象之间的一对多关系。 当一个对象改变状态并发出通知时,它的所有观察者都会收到提示并作出自己的响应。认识观察者模式 · 游戏工程案例(击杀怪物后的逻辑)什么是事件分发机制通过观察者模式的“订阅 – 发布”机制,使用事件传递数据与驱动行为的方法。Unreal 蓝图中的使用Unreal C++中的使用Unreal 蓝图与C++的联合使用打造自己的事件分发机制实现 使用 蓝图/C++/蓝图&C++..

2021-05-12 17:24:52 502

原创 astar的cpp实现

#pragma once#include <iostream>#include <vector>#include <queue>using namespace std;class AStar{public: struct AStarPathPoint { AStarPathPoint* father; int x, y, gval, hval, fval; AStarPathPoint(pair<int, int> point, p

2021-04-13 16:35:10 159

原创 人物动作队列

一.问题分析花园偶现一些奇怪的Npc出现在场景中,如下图:但是由于没有复现的办法,也尝试修改,但是还是会偶尔出现上述问题;通过不断地发现,大致发现以下两个规律:1.大概率出现在切换区域后的瞬间2.奇怪npc出现的位置与花园第一区域的大马路的坐标范围;二.人物动作队列管理根据以上发现出现规律以及之前看了部分代码逻辑整合;1.加载方法GardenPersons::LoadPerses加载所有花园角色配置,游戏通过DataXmlPaths来收集各类资源,而角色资源的类型为Dat

2021-04-06 14:12:27 89

原创 Actor的复制

Actor是实现复制的主要推动者Actor 主要通过两种方式进行更新: 属性更新 RPC (远程过程调用)。 组件复制:尽管使用起来简单直观,但它却有些不同寻常:大多数组件都不会复制组件复制中涉及两大类组件。一种是随 Actor 一起创建的静态组件。也就是说,在客户端或服务器上生成 所属 Actor 时,这些组件也会同时生成,与组件是否被复制无关。服务器不会告知客户端显式生成这些组件。 在此背景下,静态组件是作为默认子对象在 C++ 构造函数中创建,或是在蓝图编辑..

2021-03-04 16:10:54 470 1

原创 ue4的GamePlay框架

创世记UE创世,万物皆UObject,接着有Actor。UObject:起初,UE创世,有感于天地间C++原始之气一片混沌虚无,便撷取凝实一团C++之气,降下无边魔力,洒下秩序之光,便为这个世界生成了坚实的土壤UObject,并用UClass一一为此命名。藉着UObject提供的元数据、反射生成、GC垃圾回收、序列化、编辑器可见,Class Default Object等,UE可以构建一个Object运行的世界。(后续会有一个大长篇深挖UObject)Actor:世界有了土壤之后,但还少了一..

2021-03-02 20:56:55 842

原创 ue4多人联网的实例

1.验证actor的显示和消失的复制问题1.要分清服务器和客户端2.要分清自治体和模拟体这个验证1.

2021-02-25 20:52:29 2431

原创 简单述三消游戏逻辑:

讲述三消游戏逻辑:项目简介:支持六种元素,以及障碍元素,行,列,彩虹特殊道具核心就是填充算法和一个匹配算法:填充:本文采用分步填充(即一次只向下移动一个单位)public bool Fill() { bool filledNotFinished = false;//判断本次填充是否完成 //Debug.Log("This is Fill1");//左上为(0,.0) for (int y = yRow - 2; y >=0; y--)/

2021-02-20 17:37:51 1585

原创 effective cpp 4

#include <iostream>#include <assert.h>using namespace std;class Rectangle{public: Rectangle(int h,int w) :height(h), widget(w) {} ~Rectangle() {} virtual void setHeight(int newHeight) { height = newHeight; } virtual void setWidth(int

2021-02-02 14:21:34 60

原创 Socket

socke1.简述大学学习网络基础的时候老师讲过,网络由下往上分为物理层、数据链路层、网络层、传输层、会话层、表示层和应用层。通过初步的了解,我知道IP协议对应于网络层,TCP协议对应于传输层,而HTTP协议对应于应用层,三者从本质上来说没有可比性,socket则是对TCP/IP协议的封装和应用(程序员层面上)。也可以说,TPC/IP协议是传输层协议,主要解决数据如何在网络中传输,而HTTP是应用层协议,主要解决如何包装数据。关于TCP/IP和HTTP协议的关系,网络有一段比较容易理

2021-01-29 16:43:58 1110

原创 CPPeffective3

#include <iostream>#include <assert.h>using namespace std;class Rectangle{public: Rectangle(int h,int w) :height(h), widget(w) {} ~Rectangle() {} virtual void setHeight(int newHeight) { height = newHeight; } virtual void setWidth(int

2021-01-27 20:37:05 72

原创 c++ effective3

#include <string>#include <iostream>#include <vector>//using std::string; //using namespace std:using namespace std;class Person{public: Person(); virtual ~Person();private: string name; string address;};Person::Person().

2021-01-20 15:00:43 57

原创 c++effective 2

#include<string>class Bitmap {};class Widget { Widget& operator=(const Widget& rhs);private: Bitmap* pb;};Widget& Widget::operator=(const Widget& rhs){ //if (this == &rhs) return *this; //delete pb; //pb = new Bitmap(*

2021-01-11 14:08:49 206 1

原创 effective cpp 1-10

#include <string>#include<stdlib.h>using namespace std;class name {public: static const int kk = 16; int arrar[kk]; enum {num= 5}; int arrs[num];};class TextBlock{public: TextBlock(std::string id) :text(id),pText(nullptr),textLengt

2021-01-06 20:06:23 69

原创 c++类型转换

// tv.h -- Tv and Remote classes#ifndef TV_H_#define TV_H_class Tv{public: friend class Remote; // Remote can access Tv private parts enum { Off, On }; enum { MinVal, MaxVal = 20 }; enum { Antenna, Cable }; enum { TV, DVD };

2020-12-23 21:10:07 53

原创 chapter14

// studentc.h -- defining a Student class using containment#ifndef STUDENTC_H_#define STUDENTC_H_using std::istream;using std::ostream;using std::cin;using std::string;#include <string> #include <valarray>class Student{private:

2020-12-23 16:28:43 138

原创 chapter13 jicheng

#ifndef TABTENN0_H_#define TABTENN0_H_#include <string>using std::string;// simple base classclass TableTennisPlayer{private: string firstname; string lastname; bool hasTable;public: TableTennisPlayer(const string& fn = "n

2020-12-21 20:12:29 127

原创 chapter12 classs and new

// bank.cpp -- using the Queue interface// compile with queue.cpp#include <iostream>#include <cstdlib> // for rand() and srand()#include <ctime> // for time()#include <cstring> #include <string>using std::cout;using

2020-12-18 19:09:40 96

原创 chapter11 use class

// mytime0.cpp -- implementing Time methods#include <iostream>#ifndef MYTIME0_H_#define MYTIME0_H_class Time{private: int hours; int minutes;public: Time(); Time(int h, int m = 0); void AddMin(int m); void AddHr(int h

2020-12-17 21:12:48 271

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除