Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Is there a way to paste images to the backbuffer instead of using the sprite system?

Author
Message
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 1st Dec 2016 19:09
Hello AppGameKit folks.

I just purchased AGK2 this past weekend on Steam. Truthfully I had come across it several times while searching for an alternative to Unity but the word "kit" in the name immediately made me think it was something like GMS or Construct so I passed it by.

For some reason this past weekend I took the time to read the comments on Steam and as soon as I read this ("Be warned: this is a "language", not an "editor" or "engine". There is no "drag and drop". You use words and symbols to tell the computer what to do, and you have to actually use your brain a bit.") I bought it. I've been programming and making games as a hobby for decades so I much prefer just writing code in a simple text editor than I do all of this drag and drop & property boxes nonsense.

Okay, so there is my intro.

I have studied the documentation and it all seems quite logical. However, I didn't notice any way to directly just draw images to the back buffer. Kind of like how the old PasteBob (IIRC) in AMOS and DrawImage in Blitz works.

Reading through the forum posts I found a mention of a PasteSprite command but I did not see this anywhere in the documentation nor did the editor recognize it when I typed it in.

Is there some way to directly paste images to the back buffer? I would much prefer to just work this way instead of going through the sprite system.

Thanks!
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Dec 2016 19:37
Welcome

The command you are looking for is DrawSprite. This is effectively the same as drawing an image, the sprite is just a holder for the data around the image, and allows you to use one image in many different ways.

My advice is that the sooner you go through the pain of getting away from the blitting mentality and move to using sprites as they are intended to be used, the more you will get out of AGK. Many of us "old timers" have gone through the same pain, using DarkBASIC, the predecessor to AGK.

Sprites have abilities to resize, recolour, rotate, inherit physics, collide and many other things. You can still choose to do all of this yourself to a sprite if you want to be in control, but it is a useful toolbox to have. You won't feel cheated that you are not really programming It just gives you more time to do the fun stuff and add more bells and whistles.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 1st Dec 2016 21:03
Thanks for the fast and detailed reply!

Ha ha. I hear you about the blitting mentality. I think I probably drove many folks near insane on the Unity forums because I basically developed like I always have handling all movement, physics, collisions and so on myself. Used Unity as just a way to draw graphics and play audio. Interesting thing though is myself and another developer over there did a stress test with a Space Invaders game. Turned out the minimal programming reling on all of the canned systems approach was several times slower than simply writing everything in C#. So there is some reason for my "madness" other than just preferring it.

So far I have been using sprites. I found the subimages atlas thing a bit odd. Using a text file I mean. It would be cool to be able to specify the offsets with a command I think instead of that file. Also not sure why names are needed. But not a big deal I think. I just use "00", "01" etc for my names.

I will check out DrawSprite and most likely continue creating an architecture to better deal with sprites for my future AppGameKit games.

This is exciting stuff! So glad I got it. Seems to be what I have been looking for the past few years.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 2nd Dec 2016 06:59
Hi GarBenjamin. Welcome to the forum. I reckon you from the Monkey board, right? AGK2s api is one of the most complete ones from all the actively developed languages. I love it.
-----------------------------------------------------------
Using AGK2 Tier 1
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 2nd Dec 2016 23:24
Hey @MikeHart yes I thought your name looked familar from the MX forum as well. Ha ha. I guess many of us have invested a lot of time into checking out various Game Dev options trying to find the "right" one.

From what I have seen so far AGK2 looks very good. I'm going to make a tiny game this weekend to try it out. Thinking maybe a farmer trying to keep the crows off his land. Attack of the Crows or whatever. lol
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
MikeHart
AGK Bronze Backer
21
Years of Service
User Offline
Joined: 9th Jun 2003
Location:
Posted: 4th Dec 2016 08:54
That is a cool idea. Maybe a walking scarecrow. When you get closer, they flight away. The goal could be to keep the fields free for a speific amount of time. Sometimes the crows picked something which the drop and you could collect.
-----------------------------------------------------------
Using AGK2 Tier 1
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 5th Dec 2016 14:24
Well this is ultra low res 2D pixel art along the lines of the ole Demon Attack / Space Invaders. So far AGK2 has been a lot of fun to work with. Unfortunately, I was sick Friday night and most of Saturday so wasn't able to put the time in to complete the game but I have a good start. I spent most of my time just checking out all of the examples that come with it. Cool stuff!

I can't believe I had passed this by in the past. They really should have used a different name. That whole App Game Kit thing makes it seem like (a) it is only for mobile games (App) and (b) is some kind of GUI push button game maker (Kit). That's why I never bothered to check into it. Awesome Game Programming Kit (AGPK) may have been good.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
GarBenjamin
AGK Developer
7
Years of Service
User Offline
Joined: 30th Nov 2016
Location: USA
Posted: 6th Dec 2016 05:02
I did test the DrawSprite command. Works great. I ended up going back to the sprite system just because everything is so easy & logical.

Honestly, I have to say I have checked out many different game engines, frameworks and languages and from what I have experienced so far with AppGameKit it really is superb.

A big part of that is because of the rich command set. They thought of so many things. For example, I am making an ultra low res game just to get into AGK. The actual resolution is 128 x 72 with the idea being I'll scale it up to 768 x 432 or 1024 x 576. I have the player, enemies and player shots completed and tonight decided to see how difficult it would be to scale up the display. At first I looked for way to render to an image and found the command. However, I found another command to scale the viewport and tried that. One line of code! No need to even mess with rendering everything to an image then draw that image scaled up.

So far everything "just works" and it works very well. Easy. Logical. TGC are getting a fan here.
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Dec 2016 08:34
Quote: "However, I found another command to scale the viewport and tried that. One line of code! No need to even mess with rendering everything to an image then draw that image scaled up."


Nice way to solve the challenge. There's a thread somewhere on how people have achieved this, but none as simple as this.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-24 15:30:14
Your offset time is: 2024-11-24 15:30:14