Component based behaviorless entity systems and scripting

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Rebornxeno
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 85
Joined: Thu Jun 23, 2011 11:12 am

Re: Component based behaviorless entity systems and scriptin

Post by Rebornxeno »

lol.
Aleios
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 78
Joined: Mon Feb 21, 2011 2:55 am
Current Project: Aleios Engine
Favorite Gaming Platforms: PC, Dreamcast
Programming Language of Choice: C++
Location: Melbourne, Australia

Re: Component based behaviorless entity systems and scriptin

Post by Aleios »

Rebornxeno wrote:lol.
Well, i was going to tell you to fuck off since our last little conversation but... oh fuck it, :twisted: FUCK OFF! :twisted:

Anyway...
midix wrote: Let's say, I want my entire game logic to be scripted (with Lua or C#/Mono, I guess). The game engine itself should not know anything about particular game, the engine just can supply some optimized algorithms, like pathfinding, some predefined generic AI algorithms etc.
Hmm, i guess it would be somewhat useful, but the purpose of scripting is usually to add a few smaller components or 'pieces of logic' (for lack of a better word). Scripting is, in comparison to compiled c++ code, way slower. For example i generally use scripting for simple tasks such as adding an NPC and most of the time i just end up using it as a debug console (kind of like what gyro did in). Im not saying you should not give it a shot, but rather that i believe you will start to see the side-effects of relying on scripting as you require more complex operations, though this is assuming that it's the path you wanted to take.

Most of the rest of your post i did not understand too good, im still improving my English :)
Image
CC Ricers
Chaos Rift Regular
Chaos Rift Regular
Posts: 120
Joined: Sat Jan 24, 2009 1:36 am
Location: Chicago, IL

Re: Component based behaviorless entity systems and scriptin

Post by CC Ricers »

Scripting is good when it's done to speed up development time. That's really the appeal of using a scripting language for your program. I agree that it should be nowhere near touching the lower-level stuff like moving NPCs around, calculating matrices or swapping the render order of sprites, but as far as modifying content or high level gameplay mechanics, it's all good.

That GameDev article that midix posted is very good, by the way. I ran across it two years ago and it got me moving away from rigid hierarchical based structures and more into aggregate components, where game entities are literally a sum of their parts. The most problematic issue, to me, is specifying an order of priorities in which the order that components communicate with each other. There's this example of how to organize the flow out a certain way, but I wasn't able to find a basic code sample of such a component based system anywhere on the net. Maybe I'm just wrong in thinking that the horizontal axis represents the time and order of execution? (also I'm wondering in the world would he want the alien to not have a physics component, but still gave one to the grenade :mrgreen:)
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Component based behaviorless entity systems and scriptin

Post by dandymcgee »

CC Ricers wrote:Maybe I'm just wrong in thinking that the horizontal axis represents the time and order of execution? (also I'm wondering in the world would he want the alien to not have a physics component, but still gave one to the grenade :mrgreen:)
There is no time in that figure. It simply provides you with a few examples you may relate to and shows what components such an example might logically aggregate. Honestly I'm not sure why the dotted lines or arrows are even there at all, it would be less confusing if there were excluded completely. As far as the alien not having a physics component, that's completely up to the designer. Maybe in this particular game an alien fizzes out of sight when hit by any weapon, rather than flying across the room and bouncing off a wall. I did start work on a component-based engine solely for demonstration purposes. As a matter of fact, I've recently been considering reviving the project. It was definitely one of the more interesting designs I did work on.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
TheBuzzSaw
Chaos Rift Junior
Chaos Rift Junior
Posts: 310
Joined: Wed Dec 02, 2009 3:55 pm
Current Project: Paroxysm
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Component based behaviorless entity systems and scriptin

Post by TheBuzzSaw »

I am at the "exciting" part of connecting Lua to my C++ engine right now. My philosophy is essentially to let Lua make all the "slow decisions". For example, HP is a slow decision. HP is not something that is updated 60 frames per second. HP is something that is updated periodically (during a collision event, during a poison update, etc.). On the other side, C++ makes all the "fast decisions". Whereas Lua might say "this asteroid has a mass of 40 kg", C++ correctly applies the asteroid's mass and velocity in a collision and keeps everything smooth.

C++ is the master violinist. Its job is to know how to play any sheet music placed before it. Lua is the one choosing the song. :)
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Component based behaviorless entity systems and scriptin

Post by XianForce »

I feel slightly ashamed because I tried to "like" your post, TheBuzzSaw... :oops:
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Component based behaviorless entity systems and scriptin

Post by GroundUpEngine »

TheBuzzSaw wrote:...

C++ is the master violinist. Its job is to know how to play any sheet music placed before it. Lua is the one choosing the song. :)
That was beautiful man. :cry: ;)
Post Reply