Results 1 to 10 of 87

Thread: Space Shooter Game Editor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    To be honest I don't know exactly as newest version of Asphyre had some changes in it. But based on the dfm file of your main form AsphyreDevice1 component which has been placed on your MainForm has property WindowHandle which is currently set to 0.
    I belive that changing this property to Panel.Handle should set Panel as rendering target for Asphyre but I'm not sure. You need to change this property prior the Initialization of the engine.

  2. #2
    Did some aditional progress meanwhile, ditched the combobox in favor of ListView, now I can display all them Tiles with Names besides them in a nice manner.

    Also added animated background tiles instead of static.... check out water water_1_1_ani.image,water_1_2_ani.image,water_2_1_ ani.image,water_2_2_ani.image , they are supposed to be assembled in a 64x64 tile...
    like

    Water1,1 ; Water 1,2
    Water2,1 ; Water 2,2

    And damn they move but look darn bad (did it myself... dang, I'm going to have to look for another nicer....way to animate water , that does not overwhelm me, this requires a far better artist then I.

    Anyway please check my latest and greates editor....

    Note : it was designed with 1920x1080 resoltion.

    Greetings
    Robert
    Attached Files Attached Files

  3. #3
    A few more advices:
    1. I see that you are treating every sprite as animation sprite now. This is OK but you don't need to have active animation for every sprite especially if it contains just normal picture and not animatio. Having active animation for sprite which contains just an image slows down everything becouse SpriteEngine still treats it as animation with 1 picture and since you are looping the animation it is always updating its image with the same image. So I recomend you to have active animation only for those sprites which are actually animated.

    2. In DrawLevel procedure you are calling this:
    Code:
    Used_Tile := Images.Item[map.data[i,j+Offset]];
                   BackGround[i, j].ImageName:= Used_Tile.Name;
    This can slow down everything quite a bit since you are searching for needed images using and Image name which can be quite slow.
    Why don't you search for the right image using its index.
    Doesn't TAnimatedSprite alows you to specify its image by directly specifying TAsphyreImage? If it does don't search for proper image using its name but simply specify its Index which should be the same Integer value as you are saving it in Map data.
    Code:
    //Note writen from my head
    BackGround[i, j].Image = Images.Item[map.data[i,j+Offset]];
    3. As for moving water animation the main problem is that you have those white lines which stands out to much. If they would be dark blue it would seen much similar to water than it does now. Infact now it loks more like a bunch of Blue bugs crowding in some place.
    Several picture editing programs low adding watery effect to the pictures so I suggest for you to check it ot if this is supported by your Picture editing programs and the use it. What you actually want is some constant waves movment.

  4. #4
    Hi,

    thank you for the great tips, unfortunately this did not work

    Code:
     BackGround[i, j].ImageIndex = Images.Item[map.data[i,j+Offset]];
    but I'll probably have to spend a bit more time with it, tried it once... but since I was thinking about my water tiles, and then saving loading... , I'll return to this later.

    Also I was wondering if I could solve my sprite animation possible problems later like this ?

    Code:
    procedure TMain.LoadLevel;
    var i,j : integer;
    begin
      for j := 0 to 14 do
        begin
          for i := 0 to 19 do
            begin
                BackGround[i,j] := TBackGround.Create(SpriteEngine);
                BackGround[i,j].ImageName:= 'Empty.image';
                BackGround[i,j].X:=i*32;
                BackGround[i,j].Y:=j*32;
                BackGround[i,j].Z:=1;
                if BackGround[i,j].PatternCount > 1 then
                    begin
                       BackGround[i,j].AnimPos:=random(3);
                       BackGround[i,j].AnimCount:=3;
                       BackGround[i,j].AnimSpeed:=0.010;
                       BackGround[i,j].AnimLooped:=true;
                       BackGround[i,j].DoAnimate:=true;
                   end;
        end;
    end;
    Tried it with my current code, but did not work, nothing moved anymore, maybe it's because I've loaded my images incorrectly into my asdb file? (Will have to check later).

    Anyway here is the latest greates version, now I think my water tile looks like water....added some other tiles. The program is a mess, I know, but I will do the fine tuning later...

    In order to load my test level , you have to click generate level (no need to change 15) , then when you load my level, it will be reset to 30, the length of that level...and you can go up and down in it...change stuff , save it....

    I've found the code on the net, took out some parts I did not need....

    Unfortunately the following did not work with dynamic arrays :

    Code:
     procedure TForm2.Button2Click(Sender: TObject);
    var f:file;
    begin
      if OpenDialog1.Execute then
      begin
        assignFile(f,OpenDialog1.FileName);
        reset(f,1);
        blockread(f,map,sizeof(map)); // load map
        closeFile(f);
        // assign name again
        Edit1.Text:=map.name;
      end;
    end;
    Check out my editor, and leave a comment. The tiles are inspired (and NOT COPIED) from warcraft 2 tileset, I did them myself...

    Greetings
    Robert
    Attached Files Attached Files

  5. #5
    Quote Originally Posted by robert83 View Post
    Hi,

    thank you for the great tips, unfortunately this did not work

    Code:
     BackGround[i, j].ImageIndex = Images.Item[map.data[i,j+Offset]];
    Code:
    Images.Items[map.data[i,j+Offset]]
    is returning a TAspyhreImage result and not Image index.
    Actually you are providing Image index to this line by yourself using:
    Code:
    map.data[i,j+Offset]

    So final code should probably look like this:
    Code:
    BackGround[i, j].Image := Images.Items[map.data[i,j+Offset]];
    asuming that BackGround[i,j].Image is of TAsphyreImage type.


    Quote Originally Posted by robert83 View Post
    Also I was wondering if I could solve my sprite animation possible problems later like this ?

    Code:
    procedure TMain.LoadLevel;
    var i,j : integer;
    begin
      for j := 0 to 14 do
        begin
          for i := 0 to 19 do
            begin
                BackGround[i,j] := TBackGround.Create(SpriteEngine);
                BackGround[i,j].ImageName:= 'Empty.image';
                BackGround[i,j].X:=i*32;
                BackGround[i,j].Y:=j*32;
                BackGround[i,j].Z:=1;
                if BackGround[i,j].PatternCount > 1 then
                    begin
                       BackGround[i,j].AnimPos:=random(3);
                       BackGround[i,j].AnimCount:=3;
                       BackGround[i,j].AnimSpeed:=0.010;
                       BackGround[i,j].AnimLooped:=true;
                       BackGround[i,j].DoAnimate:=true;
                   end;
        end;
    end;
    I belive it should work if PatternCount is automaticly calculated. Try setting a breakpoint inside a if clause to see whether code inside it do executes when needed. If not then probably PatternCount is always returning 1.

    In your program you are using next line:
    Code:
    BackGround[i,j].AnimPos:=random(3);
    This can break animation for continuos tiles like water since neighboring tiles are not synchronized (have different animation position). SO I strongly suggest that you get rid of it. Also you should note that generating random numbers is quite slow so if you call it often it can affect your program performance quite a bit.
    Now I do understand that you would probbably like to have some random animations in case of some animated buildings so that they don't look just like clones of each other. But ass soon as you are dealing with some continuos tiles or contected tiles you need to synchronize their animation ogether.

    Quote Originally Posted by robert83 View Post
    I've found the code on the net, took out some parts I did not need....

    Unfortunately the following did not work with dynamic arrays :
    Code:
     procedure TForm2.Button2Click(Sender: TObject);
    var f:file;
    begin
      if OpenDialog1.Execute then
      begin
        assignFile(f,OpenDialog1.FileName);
        reset(f,1);
        blockread(f,map,sizeof(map)); // load map
        closeFile(f);
        // assign name again
        Edit1.Text:=map.name;
      end;
    end;
    The reason why this probably doesn't work is becouse you would need to first set the size of your arrays manualy by using:
    Code:
    SetLength(Map,Width,Height);
    But I would rather suggest that you make your own map file type which would include all the needed information (width, height, number of layers, map name, etc); Making this would require a bit more code but if done properly would prevent you from having trouble when trying to load unsuported file.
    If you want I can lend you some help in this but I need to know what kinda data structure are you trying to use in your map.

    Also nice work on water texture.
    Last edited by SilverWarior; 31-12-2012 at 07:17 PM.

  6. #6
    Happy new year!!!

    Thank you for the tips, I did remove the random... also in my previous version (probably you did not check my source), I've already managed to save my map data using 2 for cycles, and load it as well.

    Since then I've gone a bit further, I've modified my map record like this :
    Code:
       TMapData=array of array of Integer;
      TMapAnim=array of array of Integer;
      TMap=record
             name:string[20];
             map_length:string[3];
             data:TMapData;
             anim:TMapAnim;
           end;
    It stores the tile index, and it also stores for each tile index if it should be animated or not.

    I'm also saving the data correctly map.name, map.length, map.data, map.anim , and loading correctly as well. But now I have a tiny problem , I don't know how can I make my water tiles get synced, right now if I move fast up or down on this
    map I drew, they get out of sync.

    (yeah I've created the tiles using some tutorials...to see how my map would look like).

    I'm planing to also save into my map file, anim_start, anim_speed so for example if I want to add some light (for example airport lights) to my map, I could specify in which order they would light up, so they would not look like clones of each other.

    I don't know maybe if I add anim_start and anim_speed into my map file , my water tiles will be synced again?

    As for the whole thing I don't know myself what I wanna do... My plan is to make a Space Shooter game...that as you can see will have a lot of terrain in it...with moving stuff. Right now I wanna properly finish layer1 , then I'll add another layer
    for trees, houses, other stuff, some floating on water stuff...., and much much later, I'll probably add another one Layer3 enemy objects, kinda like spawning points for enemy units, enemy buildings that shoot at you etc... but as I said I'm focusing on layer1, I don't want to overcomplicate and get lost, still got very-very-very much to learn about how exactly this sprite_engine works, and Asphyre as well, and game programing in general.

    Attached I give you my latest Editor 0.7 with my tileset, I know it's bad , I will later revise it a few times for the final product... just wanted to see how the final picture would look like.
    I've attached it again, the previous attachment had a nasty bug...

    Greetings
    Robert
    Attached Files Attached Files
    Last edited by robert83; 01-01-2013 at 11:52 PM.

  7. #7
    Hi,

    Meanwhile I've managed to simplify down my DoAnimate yes or no logic.... here is the new code :

    Code:
     procedure TMain.LoadLevel;
    var i,j : integer;
    begin
      for j := 0 to 14 do
        begin
          for i := 0 to 19 do
            begin
                BackGround[i,j] := TBackGround.Create(SpriteEngine);
                BackGround[i,j].ImageName:= 'Empty.image';
                BackGround[i,j].X:=i*32;
                BackGround[i,j].Y:=j*32;
                BackGround[i,j].Z:=1;
                BackGround[i,j].AnimStart:=1;
                BackGround[i,j].AnimCount:=3;
                BackGround[i,j].AnimSpeed:=0.01;
                BackGround[i,j].AnimLooped:=true;
            end;
        end;
    end;
    procedure TMain.DrawLevel;
    var i, j: Integer;
    begin
         for j := 0 to 14 do
            begin
              for i := 0 to 19 do
                begin
                  Used_Tile := Images.Item[map.data[i,j+Offset]];
                  BackGround[i,j].ImageName:= Used_Tile.Name;
                  if BackGround[i,j].PatternCount = 1 then
                    begin
                      BackGround[i,j].DoAnimate:=false;
                    end
                  else
                    begin
                      BackGround[i,j].DoAnimate:=true;
                    end;
                  BackGround[i, j].Draw;
                end;
            end;
    end;
    The problem still persists.... my water tile animation are no longer synced....how can I sync them? It does not matter if all animation would be synced, since I will use the map.anim to specify from which frame to start the animation , and add the map.animspeed to the mix, to make things like lights etc... be "unique" .

    Greetings
    Robert

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
  •