Posted: 2nd Dec 2021 7:23
Here is the code in question

It would work better in appgamekit

I saw this and used it and it works but very slow and I see a lot of code that can be used but not sure about all of it.

+ Code Snippet
sync rate 20

Imw=5 `How many images you want across in the final image
frameskip=2 `How many frames you want skip (so if it's set to 2 it will skip every other frame)
filename$="H-Zombie-Attack1" `name of object

sw=screen width()
sh=screen height()

spr=sw/2+100
spb=sh/2+100
spl=sw/2-(spr-sw/2)
spt=sh/2-(spb-sh/2)

color backdrop rgb(0,0,253)
load object filename$+".x",1
ox#=camera position x()
oy#=object size y(1)/2
oz#=camera position z()

set ambient light 100
loop object 1
repeat
set cursor 0,0
print "Click and drag box to set the size of the image"
print "Use up and down keys to center the object"
print "Use left and right keys to zoom in and out"
print "Press return key to compile"
if mouseclick()=1
spr=mousex()
spb=mousey()
spl=sw/2-(spr-sw/2)
spt=sh/2-(spb-sh/2)
endif

a2box spl,spt,spr,spb,rgb(0,255,255)
text spr+1,spb+1,str$(spr-spl)+"x"+str$(spb-spt)
position camera ox#,oy#,oz#

if upkey()=1 then dec oy#,0.02
if downkey()=1 then inc oy#,0.02
if leftkey()=1 then inc oz#,0.1
if rightkey()=1 then dec oz#,0.1

until returnkey()=1

stop object 1
set camera to image 0,1,sw,sh
sync
tof=total object frames(1)
maxim=1

for x=1 to tof step frameskip
inc maxim
set object frame 1,x
sync
paste image 1,0,0
get image maxim,spl,spt,spr,spb,1
next x

delete object 1
maxim#=maxim
maxy=int((2-maxim#)/imw)*(spt-spb)
maxx=Imw*(spr-spl)


for x=2 to maxim `Removes any black pixels from the object and converts the background to black
cls 0
paste image x,0,0
for ix=0 to image width(x)
for iy=0 to image height(x)
p=point(ix,iy)
r=rgbr(p)
g=rgbg(p)
b=rgbb(p)
if r+g+b=0 then a2dot ix,iy,rgb(1,1,1)
if r+g=0 and b=253 then a2dot ix,iy,rgb(0,0,0)
next iy
next ix
get image x,0,0,image width(x),image height(x),1
if escapekey()=1 then end
text 0,image height(x),"Compiling.."
sync
next x
cls 0
create bitmap maxim+1,maxx,maxy

for x=2 to maxim
paste image x,xpos,ypos
inc imwidth
inc xpos,spr-spl
if imwidth>imw then inc ypos,spb-spt:xpos=0:imwidth=0
next x

get image maxim+2,0,0,maxx,maxy,1
if file exist(Filename$+".bmp") then delete file Filename$+".bmp"
save image Filename$+".bmp",maxim+2
Posted: 2nd Dec 2021 8:25
+ Code Snippet
sync rate 60 -darkbasicpro
SetSyncRate( 60, 0 ) - AppGameKit

or
+ Code Snippet
sync rate 1000 - darkbasicpro
SetSyncRate( 1000, 0 ) - AppGameKit

Attention, plz fix offline support for code examples.
I am already experiencing difficulties myself.
saw this and used it and it works but very slow and I see a lot of code that can be used but not sure about all of it.

To begin with, I advise you to dig deeper into the examples of programs that are given along with the program in order to understand what's what.
Posted: 2nd Dec 2021 19:20
Hi pavelman

I do not think you understand what I am asking

I am asking if this dark basic pro code can be translated, not if someone will translate it.

I think I can do most of it, I just am not sure if some of it will work at all.

If not I will not waist my time.
Posted: 2nd Dec 2021 19:58
Since you don't want anyone to convert it for you then the real question is:
Are you, yourself capable of converting it?
And the fact that you are asking the question is its own answer.

However, if you are simply asking if AppGameKit is able to perform the same function as the above code, then the answer is yes.
The code is loading a 3D model, animating it and exporting 2D images of the frames to use as a sprite sheet. You can do that in AGK.
Posted: 2nd Dec 2021 20:06
yes, the onky way to learn is to do it yourself. so take each line at a time and write equivalent code in AppGameKit syntax it helps if you know both languages then translation will be qucker, if not , then the online guides will help
Posted: 2nd Dec 2021 20:38
You can do that in AGK.


Ok, I figured so I was not 100 percent sure on some of it.

I will try my best.

Are you, yourself capable of converting it?


I will try

Bored of the Rings

I was trying this and hopefully I will get it to work correctly.

Thank you for looking at it and letting me know guys.
Posted: 2nd Dec 2021 21:58
Having established that you can do it, I'm now going to suggest that you don't. Not unless you just want to take on the challenge.
If you want to do it because you need the end results, as in, you want to create a sprite sheet from a 3D model, then I would suggest using Blender (or just about any other modelling software). The functionality is already available and it's much easier to set up the camera, lighting and materials.
Posted: 2nd Dec 2021 22:07
Having established that you can do it, I'm now going to suggest that you don't. Not unless you just want to take on the challenge.


To be honest it is just to see if I can and if it will work better and faster in appgamekit. I think it will.

If you want to do it because you need the end results, as in, you want to create a sprite sheet from a 3D model, then I would suggest using Blender


I use iClone v7.93, it makes all my frame images then I just make them all into a sprite, but Doing this will be faster and easier.

Plus it was already done so I am going to try myself if possible.


I already have the model loaded up and animated, just need to figure out the rest. but wow, I'm not to sure lol.

+ Code Snippet
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "3d to sprite maker" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

Imw=5 `How many images you want across in the final image
frameskip=2 `How many frames you want skip (so if it's set to 2 it will skip every other frame)
filename$="axebrute" `name of object

sw=GetScreenBoundsLeft()
sh=GetScreenBoundsBottom()

spr=sw/2+100
spb=sh/2+100
spl=sw/2-(spr-sw/2)
spt=sh/2-(spb-sh/2)


LoadObjectWithChildren (1,filename$+".x")
ObjectImage=loadimage("axebrute_D.png")
ObjectImage_2=loadimage("axebrute_D2.png")
ObjectImage_3=loadimage("axebrute_N.png")

SetObjectImage( 1, ObjectImage, 1 )
SetObjectImage( 1, ObjectImage_2, 2 )
SetObjectImage( 1, ObjectImage_3, 3 )


ox#=getcamerax(1)
oz#=getcameraz(1)


remstart
a2box spl,spt,spr,spb,rgb(0,255,255)
text spr+1,spb+1,str$(spr-spl)+"x"+str$(spb-spt)

stop object 1
set camera to image 0,1,sw,sh
sync
tof=total object frames(1)
maxim=1

for x=1 to tof step frameskip
inc maxim
set object frame 1,x
sync
paste image 1,0,0
get image maxim,spl,spt,spr,spb,1
next x

delete object 1
maxim#=maxim
maxy=int((2-maxim#)/imw)*(spt-spb)
maxx=Imw*(spr-spl)


for x=2 to maxim `Removes any black pixels from the object and converts the background to black
cls 0
paste image x,0,0
for ix=0 to image width(x)
for iy=0 to image height(x)
p=point(ix,iy)
r=rgbr(p)
g=rgbg(p)
b=rgbb(p)
if r+g+b=0 then a2dot ix,iy,rgb(1,1,1)
if r+g=0 and b=253 then a2dot ix,iy,rgb(0,0,0)
next iy
next ix
get image x,0,0,image width(x),image height(x),1
if escapekey()=1 then end
text 0,image height(x),"Compiling.."
sync
next x
cls 0
create bitmap maxim+1,maxx,maxy

for x=2 to maxim
paste image x,xpos,ypos
inc imwidth
inc xpos,spr-spl
if imwidth>imw then inc ypos,spb-spt:xpos=0:imwidth=0
next x

get image maxim+2,0,0,maxx,maxy,1
if file exist(Filename$+".bmp") then delete file Filename$+".bmp"
save image Filename$+".bmp",maxim+2
remend
oy#=100
oz#=-140
ox#=0

PlayObjectAnimation( 1, "", 1, 2000, 1, 0 )
SetObjectAnimationSpeed( 1, 30 )

do
	
if GetRawMouseLeftPressed()=1
spr=getrawmousex()
spb=getrawmousey()
spl=sw/2-(spr-sw/2)
spt=sh/2-(spb-sh/2)
endif

//ox#=getcamerax(1)
//oz#=getcameraz(1)
//oy#=getcameray(1)
if GetRawMouseLeftPressed()=1 then dec oz#,1.02
//if downkey()=1 then inc oy#,0.02
//if leftkey()=1 then inc oz#,0.1
//if rightkey()=1 then dec oz#,0.1
//

print(ox#)
print(oy#)
Print( oz# )

    SetCameraPosition(1, ox#,oy#,oz#)
    Sync()
loop



edit:

I got it to get each frame image, im getting there

+ Code Snippet
tof=GetObjectAnimationDuration(1,GetObjectAnimationName( 1, 1 ))

for x=1 to tof step frameskip
inc maxim
SetObjectAnimationFrame(1, GetObjectAnimationName( 1, 1 ), x, 1 )
getimage (maxim,spl,spt,spr,spb)
next x   
Posted: 3rd Dec 2021 1:03
Well after trying and trying I see this will not run any faster for me any how.

It is still very slow.

I think it is due to getting image for each frame.

it looks to use a lot of ram and pc disk usage for some reason.

well At least I know it will not run any faster.
Posted: 3rd Dec 2021 3:30
There is an AppGameKit app (with source) here that generates a sprite sheet from a 3d model
Posted: 3rd Dec 2021 4:27
blink0k

Wow, that is pretty cool

It has a lot of code but I think most of it is for fpsc levels

It works pretty good

I will look at the code and see what makes it function.

Thanks
Posted: 5th Dec 2021 17:59
Does it matter how fast it runs, if you are just generating a sprite sheet its not game logic, does it matter?

Hit generate and go have a coffee and a biscuit and its done [if your generating 20 spritesheets I would not advise drinking that much coffee tho!]

Not unless you just want to take on the challenge.


Isn't that the whole point of any of this coding lark?
Posted: 5th Dec 2021 18:41
Hit generate and go have a coffee and a biscuit and its done



lol, I do not have all day to wait silly.

You always make me laugh.
Posted: 5th Dec 2021 19:07
all day, dam is it that slow?

You always make me laugh.


If laughter really is food for the soul, you owe me ?12.80 for that meal.
Posted: 5th Dec 2021 19:39
you owe me ?12.80 for that meal.


mmmmmm, Well If you need it you need it.

I wonder what that is in us dollars lol.

14.48 United States Dollar

wow, that is a cheap date.
Posted: 5th Dec 2021 20:15
Yeah a cheap date, I hope you like McDonalds! lol

14 dollars... dam is the pound ever going to recover!

I went to the US about 15 years ago on a mates stag (Las Vegas) and changed up ?1000 GBP and got over $2500 USD, but on the plus side its a good time for you guys to buy British! lol
Posted: 5th Dec 2021 20:59
you 2 might be interested in my Trillion? featurette which i've just renamed "1 eggnog, 2 straws".

original thread which i've necro'd in case you feel inspired to add your own.
Posted: 5th Dec 2021 21:22
Posted: 5th Dec 2021 21:27
lol !!!
Posted: 5th Dec 2021 21:41
Lmao!!

But... I would start a war with anyone that touches my strawberry milkshake!!

?Be careful not to choke on your aspirations.?