jespa007 / zetgame Goto Github PK
View Code? Open in Web Editor NEWA little game engine implemented in C
License: MIT License
A little game engine implemented in C
License: MIT License
When register the component tell which type of system it belongs
Support
Will perform square-square circle-circle or rectangle-circle collsions, using a collider per entity or per frame defined by the animation.
User configuration
Once entity type is defined by user, pass entity type origina and all entity type that will collide with. For example,
// first define animations and its frames
// second define its
EntityType * bullets = newEntityHandler((EntityData){
max=MAX_ENTITY_BULLETS
,scene=Scene
,animation2d=animation2d
,name="bullet"
,collider=[sphere/quad,etc]
,...
});
EntityType * players = newEntityHandler((EntityData){
max=MAX_ENTITY_PLAYERS
,scene=Scene
,animation2d=animation2d
,name="player"
,...
});
PhysicsCollision.RegisterManagerCollisionTargets((EntityData){
src_entity=this.players
,collision_targets=std::vector<CollisionTarget>{
// ... these entity manager targets
,{
dest_entity: bullets
,on_collision_begin:{
callback_function:[](player,bullet){
bullet.fixation_time=dartboard.getActiveTime()+scene.dartboard_level_properties.fixation_time;
bullet.inside=true;
}
}
,on_collision_end:{
callback_function:[](player,bullet){
bullet.inside=false;
}
}
},{
}
[cute_c2.txt](https://github.com/jespa007/zetgame/files/6934662/cute_c2.txt)
});
parse file.json that has all information to load sprite keyframe
{
"gfx":"aseprite.json"
,"keyframes:"{
,"key_1":{
"collider2d":{
"type":"cicle"
,"diameter":30
}
}
}
Setup development
https://boards.dingoonity.org/ingenic-jz4760-devices/retrofw-developer-support-thread/
Tutorial_ Configuring a Toolchain for RetroFW Development .docx
Will add manager functions and create from template
Tilemap_Load("tiled.map");
tile=Tilemap_NewInstance("tiled.map");
Implement a function Texture_GetTexture that given texture_name with extension it loads from path and it stores in internal map.
glBegin()
...
glEnd();
Should disapear. User glDraw instead
We will have a width/height that is original/game resolution.
From start user could request different resolutions
Setup information
Will load glTF (https://es.wikipedia.org/wiki/GlTF) and create from the templates loaded?
SceneManager_Load("scene.gltf")
Scene *scene=SceneManager_New("scene.gltf"); // create new scene based on template
https://es.wikipedia.org/wiki/GlTF
https://github.com/KhronosGroup/glTF-Blender-Exporter
It will load a window from xml pattern,
As example,
<window background-color="#0F0F0F" window-style="none">
<!-- <label top=200 left=20 text="Have we had the right choice ?" font_name="ArmWrestler.ttf" font_color=#23b9d8 font_size=60></label>-->
<label id="lbl_score"
left="10" top="10" height="25"
text="general.score"
font-size="20" font-color="#FFFFFF"
></label>
<label id="lbl_exp"
left="10" top="35" height="25"
font-size="20" font-color="#FFFFFF"
></label>
<img id="img_time_left"
left="10" top="55" height="25"
src="clock.png"
></img>
<label id="lbl_time_left"
left="38" top="60" height="25"
text="general.time_left"
font-size="20" font-color="#FFFFFF"
></label>
</window>
In the programe will do,
GUIWindow *win=GUIWindow_Get("app/window.xml"); // will load with keyname windows.xml
and then implement or change its texts,
GUILabel_SetText(GUIWindow_Get(win ,"lbl_time_left"),"Hello");
Will update,
In order to register components it proposes the autometic adding using macros
#define ZG_ECS_REGISTER_COMPONENT(_entity_system, _data, _extra_options) \
ComponentId __g_entity_system_component#_data=__g_entity_system_component++;\
EntitySystem_RegisterComponentBuiltin(__g_entity_system_component#_data,(EntitySystemRegisterEComponent){\
.size_data =sizeof(_data)\
,.required_components =_extra_options!=NULL?_extra_options->_required_components:NULL\
,.EComponent_OnCreate =_extra_options!=NULL?_extra_options->on_create:NULL\
,.EComponent_OnUpdate =_extra_options!=NULL?_extra_options->on_update:NULL\
,.EComponent_OnDestroy =_extra_options!=NULL?_extra_options->on_destroy:NULL\
}
To avoid collisions with other modules
Will add load frames information taking texture input and other information for each frame. For example collider information.
Entity Manager acts as ArchyTime where it set the number of required components and the amount of number of entities at start (default 1). If there's no more entities to add it ok but in case it has to extends,
Entity manager extends components by the number of required entities, it calls on create function
If any entities are required to be extend, it will be call on_destroy (if it exists) delete component array, rellocating by the new extension and calling on_create function
It can cause a performance penalty (so the function extends entities will exist but not recomended to use)
Test where is faster.
Compile PC+transfer or compile in rasperry directly
https://dontpressthat.wordpress.com/2017/11/15/using-eclipse-to-write-c-c-programs-for-the-raspberrypi/
Support load from Tiled
Implement json loading struct and create load into SpriteKeyFrame through SpriteKeyFrameManaging
In order to have fast component iterations, it proposes to have components packed to avoid gaps and check for "entity is active" between each iteration. The technique is by swapping components data from entities that it creates or dies (descrived on game Programming Patterns Data Locality).
That will require an array that has reference of which components id it refers of.
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.