eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2180 on: January 15, 2014, 06:16:21 PM » |
|
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2181 on: January 18, 2014, 09:14:02 PM » |
|
Update: The refactoring is going well but slower than I like. I added a temporary component refactoringcomponent which serves as a shim between the old system and the new one. It's a mega component that stores _all_ the attributes, which I incrementally reduce as each attribute is refactored out. I started adding some components, like transform which just stores the position of an entity, aicontrol which lets the ai system control an entity, and humanoidcontrol which is basically a human without a control. For debugging purposes the components can print out their contents. For example some of the components in a human entity (id=2) are printed below.
Entity 2 transform {x: 367.819, y: 319.005} refactoringcomponent { old_x: 367.708 old_y: 319.005 vx: 3.33333 vy: 1.65674e-008 on_ground: true on_ladder: false max_ground_speed: 5 max_jump_force: 8 health: 14 health_max: 14 recovery_timer_ms: 0 blood_colour: 4278190335 is_flammable: true ... } aicontrol {physicsId: 0, init: false, decisionTimer: 0, chaseTimer: 0, chasingMoonman: false, checkGroundTimer: 0, isJumping: false} humanoidcontrol {...} }
|
|
|
Logged
|
|
|
|
kleiba
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2182 on: January 21, 2014, 10:36:38 AM » |
|
Let's all send some cheers out to eigenbom! ![Hand Thumbs Up Right](https://forums.tigsource.com/Smileys/derek/hand-thumbsup-r.gif) Apparently, he's serious about finishing the Moonman this year! Good on ya, mate! I'm just saying this because it kinda sucks not to have this devlog on the front page every time I come to the forum. But knowing that it's for a greater good makes it bearable. ![Gentleman](https://forums.tigsource.com/Smileys/derek/gentleman.gif)
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2183 on: January 21, 2014, 12:39:41 PM » |
|
Hey thanks kleibs. I've been busy doing the refactor, it's all boring stuff, but when I get back to features I'll be posting more again. :D
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2184 on: January 21, 2014, 08:53:22 PM » |
|
Update: Refactored many components now, but stilling wrestling with random crashes and annoying things. I also cleaned up some of the system logging stuff, here's the starting log, telling me how much memory I'm allocating for each component. It's currently set low to speed up booting. Logger started Loading settings Finding core package path Initialising font Platform: Windows OpenGL 4.2 Loading core resources (NOT THREADED) Creating entity system Setting up components ----------------------------------------------------- Allocated 0.13M for Transform Allocated 1.91M for RefactoringComponent Allocated 0.21M for Physics Allocated 0.02M for AIControl Allocated 0.17M for HumanoidControl Allocated 0.39M for Inventory Allocated 0.01M for Interactive Allocated 0.14M for SimpleSprite Allocated 4.20M for SpriteDriver ----------------------------------------------------- Creating component systems Creating other systems Creating renderer ...
|
|
|
Logged
|
|
|
|
kleiba
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2185 on: January 23, 2014, 10:47:45 AM » |
|
Have you considered running a static code analysis tool on your code base?
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2186 on: January 23, 2014, 04:34:56 PM » |
|
Hey kleibs, yeah I've run msvc's static code analyser, it's pretty interesting. It basically just picked up a few uninitialised variables or complained about potential memory access errors - most of which were covered by checks in my code. Update: Refactored the physics and sprite components, which were some of the largest. Here's what some of the new code looks like when using the Health component -- which you'll note is similar to the toy system I described a few pages back. Things are coming together, slowly. void handleEvent(const EvDamageEntity& ev){ Entity& e = gCore->entitySystem->lookup(ev.entity); if (e.has<Health>()){ Health& h = e.get<Health>(); h.health -= ev.amount; if (h.health <= 0){ queueEvent(EvKillEntity(ev.entity)); } } }
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2187 on: January 28, 2014, 05:33:02 PM » |
|
Update: Most of the stuff is refactored now, there's just a couple of remaining old-style attributes that I need to work on. Here's a print out of a new type entity and its components. The line + Transform 2 {...} specifies that Entity 2 has an enabled (+) component called Transform that has id=2 and contents {...}. Entity 2 + Transform 2 {x: 353.23, y: 319.007} + RefactoringComponent 2 { sprite_map_id: 472446486, } + Physics 2 { type: 1, body: 48947548, landedThisFrame: false, onGround: true, onLadder: false, numFootContacts: 1, leftFootContact.numFlat: 2, rightFootContact.numFlat: 1, numLadderContacts: 0, numLeftEdgeContacts: 2, numRightEdgeContacts: 4, numLeftBlockedContacts: 0, numRightBlockedContacts: 0} + Animal 1 { init: true, isWalking: false, direction: 0, decisionTimer: 1.61579, checkGroundTimer: 0.025, isJumping: false, isWhackingRight: false, isAttacking: false, triggerRightArmAttackAnim: false, attackTimer: 0, onGround: true} + SpriteDriver 1 { init: true, mode: 1802264951, animating: true, playOnce: false, resetToFirstFrame: false, removeOwnerOnFinishPlaying: false, frame: 0, time: 0.887108, rotation: 0, flipHorizontal: true, flipVertical: false, tint: rgba(255,255,255,255), playbackSpeed: 3.33333, spriteHasFire: false, isProjectile: false, isSpriteOrientable: false, lastSignificantProjectileVelocity: vec2(1,0), isPickupable: false, isAttached: false} + Health 2 { health: 6.81482, health_max: 10, blood_colour: 4278190335} + Renderable 2 {init: true, layer: MIDDLEGROUND, z: 100, parent: 0, partIndex: 0, children: } + Info 1 { description: "a cat"} + WorldObject 2 { ... } + Flammable 2 { isAlight: false, isAlightForever: false, alightTimer: 0, burnTimer: 0, isFuel: false} + Breather 2 { gaspTimer: 0, breath: 5, breathMax: 5, }
|
|
|
Logged
|
|
|
|
oodavid
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2188 on: January 29, 2014, 01:57:34 AM » |
|
Just been flicking through this thread, there's too much I want to say! Looks lush and good fun. I also like the idea of wearable enemy pelts...
|
|
|
Logged
|
|
|
|
kcbanner
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2189 on: January 29, 2014, 06:55:42 AM » |
|
Thanks for posting about your entity component system! I've just finished a similar refactor in my engine where I built a similar system, and am delighted to see that our systems are very similar. I was mostly inspired by the Dungeon Siege entity system, which I found described on an old wiki which is now down (but I have the pages saved if you'd like), as well as Scott Bilas' talks: http://scottbilas.com/games/dungeon-siege/. Thanks for sharing and keep up the awesome work!
|
|
|
Logged
|
|
|
|
rek
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2190 on: January 29, 2014, 09:01:04 AM » |
|
Too much code talk, post more gifs! ![Screamy](https://forums.tigsource.com/Smileys/derek/screamy.gif)
|
|
|
Logged
|
|
|
|
Thecoolestnerdguy
Level 2
![*](https://forums.tigsource.com/Themes/tigsource/images/star.gif) ![*](https://forums.tigsource.com/Themes/tigsource/images/star.gif)
while(!succeed) try();
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2191 on: January 29, 2014, 10:13:56 AM » |
|
Too much code talk, post more gifs! ![Screamy](https://forums.tigsource.com/Smileys/derek/screamy.gif) Too much C++ code talk ![Screamy](https://forums.tigsource.com/Smileys/derek/screamy.gif) ! Port Moonman to Javascript, and then we can talk!
|
|
|
Logged
|
![Sad](https://forums.tigsource.com/Smileys/derek/sad.gif) minecraft didnt copyright squares
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2192 on: January 29, 2014, 07:45:55 PM » |
|
@oodavid thx mate ![Smiley](https://forums.tigsource.com/Smileys/derek/smiley.gif) @kcbanner Yeh that's a great article, and was also my inspiration when I wrote the first bit of MM code over 2 years ago. Update: The refactor is done. I've got to tidy up a few things, but thanks for bearing with me with all these technical posts! Here's an image to appease you: ![](http://moonman.io/wp-content/uploads/2014/01/particlerunsmall.gif)
|
|
« Last Edit: January 29, 2014, 09:20:50 PM by eigenbom »
|
Logged
|
|
|
|
Bandreus
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2193 on: January 30, 2014, 12:01:26 AM » |
|
Too much code talk, post more gifs! ![Screamy](https://forums.tigsource.com/Smileys/derek/screamy.gif) can't we just have more of both? ![Beg](https://forums.tigsource.com/Smileys/derek/beg.gif)
|
|
|
Logged
|
|
|
|
Zaphos
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2194 on: January 30, 2014, 12:23:54 AM » |
|
Update: The refactor is done. I've got to tidy up a few things, but thanks for bearing with me with all these technical posts! Here's an image to appease you: ![](http://moonman.io/wp-content/uploads/2014/01/particlerunsmall.gif) Hooray! Also what are those particles? Is that guy just super smelly? They look like smelly particles.
|
|
|
Logged
|
|
|
|
rundown
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2195 on: January 30, 2014, 08:43:22 AM » |
|
Update: The refactor is done. I've got to tidy up a few things, but thanks for bearing with me with all these technical posts! Here's an image to appease you: ![](http://moonman.io/wp-content/uploads/2014/01/particlerunsmall.gif) Hooray! Also what are those particles? Is that guy just super smelly? They look like smelly particles. MoonmanFarts!
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2196 on: January 30, 2014, 05:38:12 PM » |
|
More stuffing around! ![](http://moonman.io/wp-content/uploads/2014/01/flaming_run.png)
|
|
|
Logged
|
|
|
|
eigenbom
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2197 on: January 30, 2014, 07:16:02 PM » |
|
|
|
|
Logged
|
|
|
|
DarkWanderer
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2198 on: January 30, 2014, 07:20:31 PM » |
|
![Blink](https://forums.tigsource.com/Smileys/derek/blink.gif) Wow. These aesthetics have come a long way. I'm in ![Hand Money Left](https://forums.tigsource.com/Smileys/derek/hand-money-l.gif) ![Kiss](https://forums.tigsource.com/Smileys/derek/kiss.gif) ![Hand Money Right](https://forums.tigsource.com/Smileys/derek/hand-money-r.gif) When & where can you take my money? Wait, procedural generation, exploration, resource gathering & crafting? Crap ![Facepalm](https://forums.tigsource.com/Smileys/derek/facepalm.gif) This should have been on my radar long ago
|
|
|
Logged
|
|
|
|
_bm
|
![](https://forums.tigsource.com/Themes/tigsource/images/post/xx.gif) |
« Reply #2199 on: January 30, 2014, 07:24:57 PM » |
|
Those flame particles are amazing! ![Crazy](https://forums.tigsource.com/Smileys/derek/crazy.gif)
|
|
|
Logged
|
|
|
|
|