Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: Speedup: basics

  1. #1

    Speedup: basics

    Welleeh. I just dumped DelphiX after use of couple years. Sorry for noobish questions :-) I'll just ask them quickly and you'll get rid of me! ^^


    So. If someone told me few things, I'd find out rest of things by my self..

    Basic idea of drawing images on 2D-surface..
    1. Loading images. Where I load them? Where's this ImageList which I'm used in DelphiX?
    2. When I've got images loaded, it's probaply very simply to draw them; asphyrecanvas.draw(blabla,...

    In fact, my big rpg/adventure/surviror/etc- game project's graphics are now mostly made with DelphiX's Draw- functions.. I'm planning to change the game from DelphiX -> Asphyre. There are my own Draw- procedures which draws given images in given positions. Will it be hard to move it to work with Apshyre?


    Umm, this wasn't good post.. well, I'll write more when problems appears!

    Got truly excited of this package :) Amazingly powerful. Just hope I could use it. Shouldn't be hard.
    Making ultimate rpg with thousands of years and every time new random history, people, world....

  2. #2

    Speedup: basics

    Hey Rojekti, could you be a little bit more specific? Are you wondering how to draw an image on the canvas? Are you using Asphyre 3.1 or one of the beta 4 versions? The last question is very important, as how the canvas works has changed for version 4.

  3. #3

    Speedup: basics

    Oh, sorry. As far I know, I'm using Asphyre eXtreme v3.1.0!

    Yes, I'm trying to draw an image to canvas, also I'd like to know how I can control images; DelphiX has this ImageList- item where I can load manually images from file, then using ImageList's procedures, draw it on screen;

    So first load the items to the list; imagelist.items.add(...), then draw them; imagelist.item[x].draw(...). How it could be done with Asphyre eXreme? Just simply 2D.. :)
    Making ultimate rpg with thousands of years and every time new random history, people, world....

  4. #4

    Speedup: basics

    Aha! Well, I wrote a semi-complete game in Asphyre 3.1 and released the full source under the MPL. You are more than welcome to look at that as a way to learn to use Asphyre, and since it's a very simple game (I'm more or less a newbie in the whole realm of game programming, though I know Asphyre well) it won't take you very long at all.

    There are many examples and discussions on the main forums there, afterwarp.net, and I would advise you to read a few of the samples available there.

    Anyway, here's a link to my project which you can dissemble at your leisure.

    Asphyre uses a "TAsphyreImages" component, which then loads all images from an archive. Try looking at the examples provided and checking the form components, and how they are used.

  5. #5

    Speedup: basics

    Hmm, it seems to be that your game doesn't work with my Delphi.. I got Delphi 7.0 and Asphyre 3.1 eXtreme; gives some odd errors of your code's syntax, weird. Which Delphi you have?

    But, anyway. I read the code completely, then I searched with google and this forum's search engine everything that could help me but hmm, didn't found answers..

    Well, umm.. I got now these components on my form; AsphyreTimer, AsphyreImages, AsphyreDevice and AsphyreCanvas.

    So this is how it goes: I must load images to AsphyreImages and then draw them with AsphyreTimer to AsphyreCanvas (someone could tell me why there are AsphyreDevice and AsphyreCanvas separated :o is it that A-Canvas "sends" screen for A-Device which shows it on screen? :D).

    So, since I'm trying to move my RPG-project from DelphiX to Asphyre, I'm now trying to create just a little testing program to make Asphyre familiar to me..

    This program now has AddImage and DrawImage- procedures. AddImage adds given images to AsphyreImages and, oh man, it should be so simple, but it just doesn't work; I should draw image on AsphyreCanvas..


    First load:
    Code:
      with pics.Add do
      begin
     {   Quality    := aqHigh;
        AlphaLevel := alFull;   }
        PatternSize:= Point(wi, he);
        Size       := Point(wi, he);
        VisibleSize:= Point(wi, he);
        LoadFromBitmap(sad, true, 0, 15);
        Name := extractfilepath(kuva);
      end;
    And so on.. there's one problem: Delphi claims that "aqHigh" and "alFull" are undeclared identifiers! What's wrong? I even improvized; I added ImageFX to Uses- list but it didn't help..


    And then, draw.. hmm, screen stays black:

    Code:
      can.Draw(pics.Item[0], x, y, 0, 0);
    ..the last parameter (last zero there) should be fxBlend or some other mode.. but Delphi claims them also as undeclared identifiers! Is that why nothing happens?


    I do initialize Device in OnCreate of Form, and there are Begin- and EndScene- functions in Device.Render.. Should images be drawn in Device.render or with AsphyreTimer?


    Oh man.. :/ am I just so noob? :( Seems to be that Asphyre requires kinda more "standard" programming style :) heh, I should learn that style too..
    Making ultimate rpg with thousands of years and every time new random history, people, world....

  6. #6

    Speedup: basics

    Oh, yes, one more thing..

    AsphyreImages loads images from archive.. well, umm. I think it's still possible to load images from file, from folder? It would be great. In fact, I really need this kind of a feature. I don't want to load them from some weird archive :( I did found some program from Asphyre's Example- folder, it made those archives from chosen images.. but noooo! :o just trying to load them from folder :/
    Making ultimate rpg with thousands of years and every time new random history, people, world....

  7. #7

    Speedup: basics

    Yes, you can load your images from a file, but this isn't recommended. What if you want to animate an image like you do with sprites? Without adding to the archive, an ASDb file, and converting it to an AsphyreImage it won't work. It's too convoluted a process.

    I used Turbo Delphi, BDS2006 dumbed down, so there might have been a few things. But, the problems you describe come from not including AsphyreDef in your Uses clause. My code might be rather amateur, but aside from the sound system there really aren't any bugs that I've found or been notified of. (On some computers there are instant crashes, which near enough as I can tell is related to the music. Odd, but I can't really explain that one.)

    Once you get AsphyreDef in, remedy your aqHigh/alFull and fxBlend problems you should start to see results.

    Half the problem seems to be that you aren't wanting to adapt, and so want to continue to use what conventions you are used to. In the end, you'll see that Asphyre is extremely powerful, and that you don't even have to stay where you are comfortable. To that end, I've worked with Asphyre 4 and extended it slightly to support ZIP archives ... so you just define all your resources in XML and then load them by groups from a Zip Archive. Wasn't hard, but it wasn't like I used to program either.

  8. #8

    Speedup: basics

    Hmm, interesting, and sad :/

    Well, I'll explain.. when I'm using DelphiX and I'm animating images (in the qurrent project), I have just done 5 DIFFERENT FILES for each frame. Must sound horrible, but it really does work. Qurrent system loads in the beginning all those images from grf- folder to DelphiX's ImageList and after that, I'm able to use them all without loading them from folder. Images are small, there are probably 10-20mb of them. Isn't this really possible in Asphyre? To load all the images in startup to lists and later use them from the list?

    DrawImage(image+f(frame), x,y, w,h)...

    Well, that's really true, I'm in love that system.. :D need some therapy..

    Thanks for the Uses- tip! I'll try it immediately. Probably it helps :-)

    Hmm, well, umm. Probably I must adapt, though it hurts me. I'll just have to study those examples and your program to get this all. Too sad there aren't good tutorials for Asphyre!
    Making ultimate rpg with thousands of years and every time new random history, people, world....

  9. #9

    Speedup: basics

    Half the problem is that folks are too busy using it to make things, than they are writing tutorials. Reading the sourcecode of the library and existing applications works pretty well though. The wiki is making some progress on tutorials as far as I know.

    Yes, this is possible. You can also use "fasttile" under tools, to generate an animated sprite based off one of the 5 pieces, and all its frames. Then just add it in and load it all at once. It's completely possible, but sometimes not efficient enough for what you might want to do.

  10. #10

    Speedup: basics

    Yes, that's maybe true. Well.

    I got it working. Basic problems are now away. Just very simple graphics; that's all I had to achieve now.

    Thanks for help! It really helped. Though I'm too stubborn to do things in right way.. some weird neurotic habits.. well, that's how I did it, could someone tell me how dumb is this:


    First images are loaded from their directory; there's loadimage- procedure. It adds all the images from given folder to the AsphyreImages. Tolerance etc. sizes can be invidually changed for each image..

    Then just, simply, I draw images with AsphyreCanvas' different procedures..

    Umm, that wasn't so new.. well, anyway. Does it make the program heavier in memory usage etc. when I load them straight from folder to AsphyreImages and destroy everything in the end? I load all the images in the beginning so there will be no loading of new images when the game has started..
    Making ultimate rpg with thousands of years and every time new random history, people, world....

Page 1 of 2 12 LastLast

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
  •