Coder Social home page Coder Social logo

zoloypzuo / zeloengine Goto Github PK

View Code? Open in Web Editor NEW
82.0 3.0 11.0 22.21 MB

Game Engine in C++/OpenGL/Lua

License: MIT License

CMake 0.73% C++ 81.24% Batchfile 0.20% Python 2.16% AutoHotkey 0.01% Lua 13.09% GLSL 2.55% HLSL 0.03%
game-engine cpp lua opengl rendering-engine game game-development d3d12

zeloengine's Introduction

Happy Coding! 😊

Logo Design by FlamingText.com

⚙️  GitHub Analytics

 







🤝🏻  Connect with Me

zeloengine's People

Contributors

dependabot[bot] avatar gitter-badger avatar zoloypzuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zeloengine's Issues

Detected memory leaks!

Detected memory leaks!
Dumping objects ->
{305} normal block at 0x00FE7738, 68 bytes long.
Data: <${$ > 24 7B 24 00 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.

坦克炮塔控制 手感不对

image

看起来简单的东西,naive的方式写出来的就是很奇怪的

自由度太高,首先一点是坦克炮塔的上下移动肯定是需要clamp的
第二是同一时刻,我们希望只能水平或只能垂直旋转,实际上这个要求会更复杂
我们需要一个输入事件rotate,包含参数

  • 参数1是x或y,同一时间只能一个方向移动
  • 参数2是移动速度
        transform.Rotate(Vector3.up, rotateXSpeed);
        transform.Rotate(Vector3.right, rotateYSpeed);

lua模块路径

基本的概念已经有了

lua没有路径的标准

current dir或者working dir是固定的,就是lua.exe启动的地方,是由操作系统定义的

比如emmylua指定work dir,就是先cd到work dir,再启动lua.exe

我想要的是c的include的current script dir的概念,就是他自己搜索当前路径

我记得有一个搜索器的概念,我可以试一试

====

lua模块的组织
dll统一放在一个目录即可,luarocks是这么做的
这个dll就是lua用的(是包含导出到lua的专用函数的),所以没必要分散开来

lua脚本不一样,确实可能在不同地方
,模块要放在一起,确实可能有多个地方放模块

比如zelo需要这样
要添加Util目录
要填Src/Script目录

=====

看一下这个?\init.lua是蛮重要的
我再添加一个??.lua
image

lua;require栈溢出

Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> require "cmake_compiler"
add_executable(aaa ${SRC_LIST})

D:\ZeloEngine\Src\Script\list.lua:28: C stack overflow
stack traceback:
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        ...
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:28: in metamethod '__index'
        D:\ZeloEngine\Src\Script\list.lua:32: in metamethod '__newindex'
        D:\ZeloEngine\Src\Script\list.lua:11: in field '_ctor'
        D:\ZeloEngine\Src\Script\Class.lua:234: in global 'list'
        D:\ZeloEngine\Util\cpp.lua:27: in function 'header_guard'
        D:\ZeloEngine\Util\cmake_compiler\cmake_compiler.lua:36: in function 'example_project'
        D:\ZeloEngine\Util\cmake_compiler\cmake_compiler.lua:45: in main chunk
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: in ?

hello world

// 初始化窗口(渲染窗口和console窗口)
// console输出helloword

是否要封装lua C API?

PiL的例子上就封装过一些

但是我的建议是不要封装

暴露得如此彻底,而且auxlib提供了一些封装

说到底是为什么?

就是C API你可以发现一个操作比如push*,to*,*需要有各个lua类型的版本

所以当你试图去封装的时候,也是每个类型都要有一个版本

这种封装是非常低效的,通用性也可能不太好,经常需要改动,就变得复杂,背离了封装的本意

Detected memory leaks!

Detected memory leaks!
Dumping objects ->
{251} normal block at 0x00E5B7E8, 32 bytes long.
Data: <D 3 D 1 1 A p > 44 00 33 00 44 00 31 00 31 00 20 00 41 00 70 00
{250} normal block at 0x00E5E780, 8 bytes long.
Data: < > BC 82 E6 00 00 00 00 00
{249} normal block at 0x00E68290, 112 bytes long.
Data: <4Z h c ` > 34 5A 0A 00 68 13 98 03 B4 63 EF 00 60 EB F0 00

Detected memory leaks!

Detected memory leaks!
Dumping objects ->
{351} normal block at 0x008302D8, 8 bytes long.
Data: < 6 > B0 36 84 00 00 00 00 00
Object dump complete.
The program '[31096] Chapter4_Direct3D_Initialization.exe' has exited with code 0 (0x0).

lua禁止修改标准库

比如我写cmake-compiler
我想写一个log-error函数

突然我想改个名字为error

注意动机是我在写另外一个语言,cmake和lua当然有重复的语言成分

我会习惯性地去一样地命名

然后就覆盖了lua的error

====

事实上,这个事情应该有一个自动的保护措施

比如,strict.lua里全局变量禁止修改

禁止修改又太那个了

有些时候,我自己要重写标准库,比如print,require,但是这个量很少

所以你要开辟一个地方去重写标准库

函数的话,没有意外确实不应该修改

但是值就不一定了

===

这里暂时不去想,目前还没有影响

lua;实现Python的模块化

就是每个脚本运行在自己的环境中,不要污染解释器的全局环境

还要提供自动的,将全局变量导出的功能,其他模块require一下就能访问全局变量

内存泄漏

太多了

tmp.txt

简单分析一下把

就是他的lua-binding,都没有finializer

lua调用createxxx去实例化一个东西,他都没有回收的过程

包括Sandbox-Cleanup这种函数,都是空的,手工回收也没有

lua;lua没法感知C库中的函数

之前就有想法

当时的一个想法是,编辑时导入一个伪api的lua脚本,运行时不走这个

Sandbox这里有一个问题,他是全局注入的,你不需要require就有了,这样不好

可以重写一下,封装,运行时也带着走,这样需要每次多调用一次函数

====

所以一个IDE,至少要支持Lua的智能提示,还要有方法显示C模块的智能提示

Lua脚本require路径问题

在饥荒项目运行lua脚本,因为环境变量运行了global.lua,他找不到同目录的std-extension.lua

D:\ZeloEngine\lua.exe: D:\ZeloEngine\Src\Script\global.lua:12: module 'std_extension' not found:
	no field package.preload['std_extension']
	no file 'D:\LuaRocks\lua\std_extension.lua'
	no file '
D:\LuaRocks\lua\std_extension\init.lua'
	no file '
D:\ZeloEngine\lua\std_extension.lua'
	no file '
D:\ZeloEngine\lua\std_extension\init.lua'
	no file '
D:\ZeloEngine\std_extension.lua'
	no file '
D:\ZeloEngine\std_extension\init.lua'
	no file '
D:\ZeloEngine\..\share\lua\5.3\std_extension.lua'
	no file '
D:\ZeloEngine\..\share\lua\5.3\std_extension\init.lua'
	no file '
.\std_extension.lua'
	no file '
.\std_extension\init.lua'
	no file '
C:\Users\91018\AppData\Roaming/luarocks/share/lua/5.3/std_extension.lua'
	no file '
C:\Users\91018\AppData\Roaming/luarocks/share/lua/5.3/std_extension/init.lua'
	no file '
D:\LuaRocks\systree/share/lua/5.3/std_extension.lua'
	no file '
D:\LuaRocks\systree/share/lua/5.3/std_extension/init.lua'
	no file '
D:\ZeloEngine\Src\Script\std_extension.lua'
	no file 'D:\ZeloEngine\std_extension.dll'
	no file '
D:\ZeloEngine\..\lib\lua\5.3\std_extension.dll'
	no file '
D:\ZeloEngine\loadall.dll'
	no file '.\std_extension.dll'
	no file '
D:\ZeloEngine\std_extension53.dll'
	no file '
.\std_extension53.dll'
	no file '
C:\Users\91018\AppData\Roaming/luarocks/lib/lua/5.3/std_extension.dll'
	no file '
D:\LuaRocks\systree/lib/lua/5.3/std_extension.dll'
stack traceback:
	[C]: in function 'require'
	D:\ZeloEngine\Src\Script\global.lua:12: in main chunk
	[C]: in ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.