1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

What is the KAG engine?

Discussion in 'Community Dev Corner' started by TheChosenOne2000, Aug 5, 2013.

Thread Status:
Not open for further replies.
Mods: Downburst, Mazey
  1. Hi, i am currently working on a 2d sidescroller game called Shroud. ive been looking at many game engines but none have a brush precise enough for my artwork, i then realized kag looks like it has detail that would be used similarly in the kag game, does anyone now what engine KAG was created on??? Plz help!
     
  2. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,913
    KAG Classic was made with the Crimson Engine (same for Soldat) coded by MM himself and is not available for others.
    KAG Beta does not use a game engine and is just coded from scratch I believe.
     
    Porti, Piano and Froghead48 like this.
  3. PadaV4

    PadaV4 Shopkeep Stealer

    Messages:
    47
    Oh really. Untitled.png
     
    Guitarman, Konfitur, Porti and 2 others like this.
  4. Mazey

    Mazey Haxor Global Moderator Forum Moderator Staff Alumni Donator Official Server Admin

    Messages:
    1,913
    But KAG isn't built with it. It uses Irrlicht for rendering and input
     
    Last edited: Nov 24, 2013
    jimmyzoudcba, Asu, Guitarman and 6 others like this.
  5. PadaV4

    PadaV4 Shopkeep Stealer

    Messages:
    47
    Well until now i thought that rendering was a big fucking part of a game engine. Of course it isn't the whole thing but still a real important one.
     
    AmestriStephen and Konfitur like this.
  6. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    "The core functionality typically provided by a game engine includes a rendering engine (“renderer”) for 2D or 3D graphics, a physics engine or collision detection (and collision response), sound, scripting, animation, artificial intelligence, networking, streaming, memory management, threading, localization support, and a scene graph."

    1. Render - Irrlicht
    2. Physics - Box2d
    3. Collision - Box2d
    4. Sound - Irrlicht
    5. Scripting - AngelScript
    6. Networking - custom?
    7. Input - Irrlicht
    ...
     
  7. AdrianC

    AdrianC Bison Rider Tester

    Messages:
    119
     
    Konfitur and PadaV4 like this.
  8. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    == the Crimson engine

    P.S. GameEngine - many different systems, which work together
     
  9. Shadlington

    Shadlington THD Team THD Team Administrator Global Moderator

    Messages:
    1,562
    The part he is asking about - rendering - is indeed provided by Irrlicht.
     
    Froghead48 likes this.
  10. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    To clear up any confusion, yes irrlicht is used for rendering, no it is not used "raw" - we've made modifications to irrlicht and we basically use it to get access to opengl and operating system events in a portable, comfortable way. If we were to do the same thing again, we'd probably use SDL for handling those tasks, but there's a lot of legacy baggage. We actually use SDL for the threads (as mentioned above) so its a dependency anyway.

    The scene graph and logical structure is a complete departure from irrlicht, we dont use any of their scene functionality other than a camera - all of the vertices, textures, culling etc in the engine is handled by us. Irrlicht is much more 3d oriented and it helps to have control over the graphical building blocks. We basically give Irrlicht a bunch of triangles to render (properly batched by texture and culled for screenspace of course) and say "render this please" and it handles the last step of interfacing with opengl.

    Sound is IrrKlang, an irrlicht extension. The fact that we don't really have source access means investigating some of the sound bugs is trial and error.

    Physics is largely Box2d but again there's a lot of glue making that actually work with anything in the sense of a game. In future I think we're going to move away from Box2d as it's been nothing but hassle. Classic does not use Box2d, which is why the physics are very different. The collapse physics in both versions are our separate implementation of verlet physics for optimisation and consistency's sake - that many boxes added as entities would be awful for the network and for performance on both client and server.

    Networking is ENet to give us a layer over UDP. The networking model is roughly based on the quake 3 model with many, many alterations to make it work with a large number of objects. We'd do quite a few things differently here too, given the chance, but neither of us is particularly keen on doing a clean slate reimplementation at this point.

    Scripting is Angelscript bound to our internal classes manually (no bindings generator, potentially a bad thing but it works)

    fwiw the term game engine is nebulous and I feel a lot of people don't quite appreciate the scope of the engine behind KAG. There's 110k odd lines of code (not including comments and blanks) including the scripts now, which is about 40k less than the average during classic development, but still pretty large. The reduction in code size is largely due to refactoring and optimisation efforts but also a result of moving the game into the script files, which allows simpler reuse of logic. You can view about 30% of the KAG source as those .as scripts.
    Here's the counts from cloc http://grab.by/p6P4 - scripts are shown as actionscript when they're actually angelscript, but counts should still be accurate. This is not counting irrlicht, sdl, angelscript or anything like that, this is the KAG engine code.

    Understand that that code was largely written by two people (some of it was written by Shadlington and FliesLikeABrick as well, props to them) and that handwaving it as irrlicht or enet or angelscript glued together with a few hours work is pretty ignorant :^)

    Hopefully this helps the OP and also serves as a resource to link the people that ask this question every few months to.
     
    Rubixxcube, Noburu, Porti and 10 others like this.
  11. sticked just in case
     
    Noburu, Porti, phoenixx and 2 others like this.
  12. LostPix

    LostPix Base Burner

    Messages:
    574
    Interesting read Geti. I was thinking why didn't you guys use Havok for physics, I heard at one point that the old version I believe the first one became free or something like that, I'm not sure so correct me. Also if you plan to move away from Box2D collision what would be your choice of a collision system for the future? Will it be something to handle complex geometries?
     
  13. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Yes and no, it'd just be our own physics (something we did for classic and would gladly do again - I've had to do a few clean slate implementations of that kind of stuff for uni and other projects) but should be able to handle any geometry as a combination of concave shapes or lines.
    For 2d games, and games in general I feel that actual dynamics aren't any good unless you can afford to go the whole way in that direction - ragdolls, force driven actors, etc. It is much easier to make an enjoyable experience with fake physics and reliable deterministic physics.
    That rules out Havok, PhysX, Box2d or anything like that for us.
     
    VanHuek likes this.
  14. Sammy257

    Sammy257 Shopkeep Stealer

    Messages:
    21
    This is a little bit off topic but is it easy to make an engine thing like the one KAG uses?
     
  15. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    Yeah it's super easy, thats why everyone and their mum whips up a networked, scripted game engine.

    ...In case the sarcasm wasn't clear, no, it's not particularly easy to make a game engine in general, much less one that's networked nicely or easily modifiable. It takes a strong background in programming at the very least, experience from working on other engines helps too.
     
  16. deleted off-topic and warned all of the people involved, please try to keep threads clean. especially those ones that are sticked
     
  17. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,578
    Will you replace IrrLicht by a another rendering engine later?
     
  18. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Messages:
    3,730
    No, why would we?
     
  19. Asu

    Asu THD Team THD Team Forum Moderator

    Messages:
    1,578
    Maybe for more performances and less bugs ( I'm more talking about sound )
     
  20. SnIcKeRs

    SnIcKeRs Bison Rider

    Messages:
    148
    rendering engine? sound? New engine = new bugs
     
Mods: Downburst, Mazey
Thread Status:
Not open for further replies.