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.

AppGameKit Classic Chat / How to use PLOT, DRAWLINE, DRAWBOX, DRAWCIRCLE in AGK with custom bitmap

Author
Message
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 10th Sep 2011 13:04 Edited at: 10th Sep 2011 17:02
I cant wait for Lee to add the drawing commands to AppGameKit tier 1 (BASIC), so I kinda made them myself...

The drawback is that you have to use a very low resolution. I am using a 160x100 resolution "bitmap" for this test. That is 16000 sprites on screen at the same time.

There is no need for media, as I am generating the sprites by using a failsafe in AGK. (It makes a white sprite if no imagedata is found)

Copy and paste the code into a new project, and set the setup.agc to a resolution of 640x400 for best viewing experience on a PC.

Use C to clear the bitmap, and Q to quit the application





----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 10th Sep 2011 16:03
Quote: "There is no need for media, as I am generating the sprites by using a failsafe in AGK. (It makes a white sprite if no imagedata is found)"

Good one
Another out of the box thinker.

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 10th Sep 2011 16:18
Cool. I think it makes sense to prepare for different types of line and dot drawing. I mean, we might never get a DOT or LINE command, but rather we might get direct access to the images, so more like using a memblock image perhaps.
The way AppGameKit works with OpenGL sprites, makes me think that having direct screen access commands might be a stretch... Instead I can see use making a full screen sprite and directly modifying that for drawing commands.

Health, Ammo, and bacon and eggs!
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 10th Sep 2011 17:01 Edited at: 10th Sep 2011 17:03
Yes Van B, that would be great, since I am limited now to 16384 sprites (read pixels) so anything above 160x100 pixels, is not possible.

I made a small demo to show the speed of AppGameKit (atleast on the PC) when showing 16000 sprites on the screen at the same time, and doing manipulations on them to simulate pixels.



Full source attached. No media needed

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.

Attachments

Login to view attachments
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 11th Sep 2011 00:30
That's a LOT of sprites I also commend some really blue sky coding there!

I drink tea, and in my spare time I write software.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 11th Sep 2011 01:06
That vector box looks uber cool
I like it!
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 11th Sep 2011 03:20
What about stretching and rotating sprites to make lines, that way you only need a few sprites and you get high resolution too.

[b]
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 11th Sep 2011 04:01
Or perhaps each shape is a super high resolution image, and the sprites render those images in order to the specified position, scale, alpha, colour, e.t.c. The draw commands would be identical to DBP, but they would be created using sprites. This would have the benefit of being able to dynamically change the art on screen, take advantage of acceleration, would not require any 'writes' to any slower-than-mud pipeline memory and might allow some effects standard dot plotting would not allow. You could also offer extra shapes like filled in circles which are notoriously windy to do with dot/line commands. The ultimate test of this approach is a thin line circle the size of the screen. It would require a few images, one for the thickness of the line which can be selected based on the relative density of the resolution and the source image size. I can almost see an AppGameKit module idea forming here

I drink tea, and in my spare time I write software.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th Sep 2011 10:08 Edited at: 11th Sep 2011 10:18
lol, I have no idea what "blue sky coding" means, but I guess you like it Lee I'm Norwegian, and there is alot of english idioms and cultural references I have not heard of.

Yes Diggsey, I am aware of that approach, and I am going to remake the vector demo using that technique. I just did not know how to generate circles with that one. I guess Lee is on to something with the bigger than screen scaled sprites, that you stretch and shrink to your needs. You could even make elipses by shrinking it unevenly on width and height. I'll try it out too. Can even make archs, by placing dark sprites over parts of the circle and use the sprite depht function in a clever way.

Cliff, yes it's uber cool, the perspective is abit wrong, just to make it look cooler

I can theoretically make a filled textured box with hidded surfaces, but it would take weeks to program it all, and a million dim textureline$[128,0]=["0","0","0","2","1","1","5","0","1","0","1"... `s for the texures alone.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 11th Sep 2011 11:04
Why not use scanlines like in raycasting to do filled boxes?

Here is my line intersect code if you would find it usefull for that?

I converted it because iam planning on doing some kind of raycast engine later on with the agk.

And uses it for simple sprite collision when iam only neaded to know if sprites colides head on.

If you can speed that code up let me know

This code should also return the screen cordinates of where the lines intersect.

This is originally an sample i modified from ianM in the code bas that i later on converted to agk.


Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th Sep 2011 14:28
I guess I could do that Cliff, but I have shifted my focus to sprite lines for the moment.

Here is a smal demo, to stretch a sprite between two points in the X,Y plane.



No media needed, paste in new project, set setup.agc to 1280x800

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 11th Sep 2011 15:15 Edited at: 11th Sep 2011 15:43
My rotating vector box with spritelines.




No media needed, paste in new project, set setup.agc to 1280x800

I found a horrible AppGameKit error, posted it on the google list, as issue 39. I can not have more than 9 variables passed to my function, tried to add alpha, but it ended up with 16777215 as the number always, and therefore making the sprite invisible.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 11th Sep 2011 16:36
Quote: "I found a horrible AppGameKit error, posted it on the google list, as issue 39. I can not have more than 9 variables passed to my function, tried to add alpha, but it ended up with 16777215 as the number always, and therefore making the sprite invisible."

Its not an error but an agk limit!

If you check the documentation online.

I hope they remove it in later releases

Looks awesome by the way!

Login to post a reply

Server time is: 2024-11-23 11:45:53
Your offset time is: 2024-11-23 11:45:53