Results 1 to 9 of 9

Thread: Machina Engine - Game Engine

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Here are some news:
    First of all, now I'm using XML as language for data-files(which can be encrypted). The engine is faster and more flexible because of this.

    Second, part of the physics engine is already working:

    • Force;
    • Velocity;
    • Acceleration;
    • Friction;


    Sprites can be used already. Also, they can be rotated, and be animated.

    The next step is to implement the physics with different types of collision:

    • Option to use multiple masks of collision for a same sprite;
    • With different masks of collision in the same sprite, the collision can be treat differently according with the part collided;
    • Default masks like rectangle mask, circle mask, etc;


    ...and implement the Momentum(Conservation of Linear Momentum).

    This small video show these features:


    And you can see the code of the game-using the game engine- here:

    Code:
    type
      TBaseMainChar    = class(TBaseObject)
      public
         procedure    OnKeyPress(BSender: TBase; var BKeyBoard : TMsgKeyBoard);
        constructor    Create; override;
      end;
    
    procedure    TBaseMainChar.OnKeyPress(BSender: TBase; var BKeyBoard : TMsgKeyBoard);
    var
      BBaseObject    : TBaseObject;
    begin
      BBaseObject    := TBaseObject(BSender);
      if VK_Up in BKeyBoard then
      begin
        BBaseObject.ApplyForce(0.6,    BBaseObject.FRotationZ);
      end;
      if VK_DOWN in BKeyBoard then
      begin
        BBaseObject.FAcceleration    := 0;
      end;
      if VK_Left in BKeyBoard then
      begin
        BBaseObject.FRotationZ    := BBaseObject.FRotationZ - 2;
      end;
      if VK_RIGHT in BKeyBoard then
      begin
        BBaseObject.FRotationZ    := BBaseObject.FRotationZ + 2;
      end;
    end;
    
    constructor    TBaseMainChar.Create;
    begin
      inherited Create;
      FOnKeyDown    := nil;
      Self.FOnKeyPress    := OnKeyPress;
      Self.FOnKeyUp    := nil;
    end;
    
    begin
      FApplicationGame    := TApplicationGame.Create;
      FApplicationGame.FFrameProcessType    := FPT_CONSTANT; // There are 3 kinds of loops;
      FApplicationGame.CreateForm('FFormName',    'Form Title', True);
    
      //---------------------------------------------\\
      //Register TBaseObject class into memory:
      //---------------------------------------------\\
      New(FClassRegistry);
      FClassRegistry.FClassName    := 'TBaseObject';
      FClassRegistry.FClassReference    := TBaseObject;
      FApplicationGame.FManagerClassReference.Add(FClassRegistry);
      //---------------------------------------------\\
      //Register TBaseMainChar class into memory:
      //---------------------------------------------\\
      New(FClassRegistry);
      FClassRegistry.FClassName    := 'TBaseMainChar';
      FClassRegistry.FClassReference    := TBaseMainChar;
      FApplicationGame.FManagerClassReference.Add(FClassRegistry);
      FApplicationGame.LoadDataFile('\MainData.dat');
      FApplicationGame.LoadAllResourceFiles;
      FApplicationGame.LoadAllSprites;
      FApplicationGame.Run;
    end.
    Small, i'snt?
    Last edited by FelipeFS; 12-06-2012 at 05:11 PM.

  2. #2
    Finally, the collision detection was finished.
    And, most of the code to display the maps(multi-layered by the way) is completed.

    I'm implementing a code to delivery alarms(like in game maker).

  3. #3
    I have made a fluxogram explaining how the data-files and resource-files work::



    Features:

    • A data-file can point to more than one resource-file, also can point to a resource-file already pointed by another data-file;
    • A data file can point to another data-file, this way, the game engine can also load into memory the pointed data-file;
    • The previous feature allows the use of many data-files. A main data-file is created, and it point to the others data-files;
    • While data-files store information, the resource-files store files itself;
    • Data-files can be created and loaded at run-time. So, they can be used as *.sav files. You cound store information of an object, or a entire may, for example.



    Screenshot of MEMaker(The previous game editor was discarded) loading a picture:

    Look that in the field "Stored In" the developer can tell in which resource-file("ResFile" in this case) the picture will be stored. But, as you can see, the picture("PTileset001") information is inside the data-file "MainData".

    ... Now I'm working on the room-editor(the most important part of this game editor, of course).
    Last edited by FelipeFS; 24-08-2012 at 05:19 PM.

  4. #4
    Also, I'm using FreeGLUT. I wasn't before, but FreeGLUT provides me a easy way to make this game engine cross-platform.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •