SuperSprite3D

Advanced game related topics
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post by Dare »

Blooming impressive!
Dare2 cut down to size
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

Any progress :( ?
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

I just ran your ground compiled example on my 7300se graphics card and it worked fine, however, when I exited the program the desktop was completely corrupted.

The whole screen was mostly black with thin horizontal lines of colour going across every now and then, the pointer was still visible and the computer was still working but it had to be restarted.

Hopefully this was just a one off glitch, I will try the examples again and let you know what happens. :?
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Just ran infinite ground, not working. :cry:

Edit: Found out what it was, opening a 1024 * 768 screen with my crappy graphics board corrupts the screen after the program ends. :cry: :cry:
Anonymous

Post by Anonymous »

I have'nt internet connection in my home. SuperSprite3D don't work with PB 4.01 or 4.02.

Sry.

@+
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

SuperSprite3D don't work with PB 4.01 or 4.02.
Zats bad >.< ...
Last edited by Chrono Syndrome on Tue Mar 27, 2007 8:05 am, edited 1 time in total.
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Cpl.Bator wrote:SuperSprite3D don't work with PB 4.01 or 4.02.
I use 4.02 and it works here perfectly. :D
And for my use, i have modified 2 procedures for these ones which are about 2 times faster:

Code: Select all

Procedure FlipSuperSprite3D(*Sprite.SuperSprite3D,Mode.b)
  StartDrawing(SpriteOutput(*Sprite\No))
  Protected *DB.b=DrawingBuffer(),PF.b
  Protected l.l,swf.l=DrawingBufferPitch(),rows.l=SpriteHeight(*Sprite\No)
  Protected *row1.b=*DB.b,*row2.b=*DB.b+swf*(rows-1)
  Select DrawingBufferPixelFormat()
  Case #PB_PixelFormat_8Bits:PF=1       ; 1 bytes per pixel, palletized
  Case #PB_PixelFormat_15Bits:PF=2      ; 2 bytes per pixel 
  Case #PB_PixelFormat_16Bits:PF=2      ; 2 bytes per pixel
  Case #PB_PixelFormat_24Bits_RGB:PF=3  ; 3 bytes per pixel (RRGGBB)
  Case #PB_PixelFormat_24Bits_BGR:PF=3  ; 3 bytes per pixel (BBGGRR)
  Case #PB_PixelFormat_32Bits_RGB:PF=4  ; 4 bytes per pixel (RRGGBB)
  Case #PB_PixelFormat_32Bits_BGR:PF=4  ; 4 bytes per pixel (BBGGRR)
  EndSelect
  Protected *s1.long=*DB.b,*s2.long=*DB.b+swf-PF
  Select Mode
  Case #Flip_Horizontally
    For l=1 To rows
      While *s1<*s2
        Swap *s1\l,*s2\l
        *s1+PF:*s2-PF
      Wend
      *s1=*DB.b+l*swf:*s2=*s1+swf-PF
    Next
  Case #Flip_Vertically
    Protected *rowbuffer.b=AllocateMemory(swf)
    While *row1.b<*row2.b
      CopyMemory(*row1.b,*rowbuffer.b,swf):CopyMemory(*row2.b,*row1.b,swf):CopyMemory(*rowbuffer.b,*row2.b,swf); <- swap
      *row1.b+swf:*row2.b-swf
    Wend
    FreeMemory(*rowbuffer.b)
  Case #Flip_Vertically|#Flip_Horizontally
    *s2+(rows-1)*swf
    While *s1<*s2
      Swap *s1\l,*s2\l
      *s1+PF:*s2-PF
    Wend
  EndSelect
  StopDrawing()
EndProcedure
And

Code: Select all

Macro CopyMatrice(Source,Target)
  CopyMemory(Source#,Target#,SizeOf(MATRIX4x4))
EndMacro
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

This does look fantastic! My version has no real examples... I would love to see what you have done with infinite ground etc. Any way to post some examples? Code for examples? anything??? :D
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Works great on PB4.xx and Vista! :D

Fred: You should include these commands in PureBasic itself.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Anonymous

Post by Anonymous »

This is the code of infinite ground 2D
Sorry, the code is not clean :wink:


ps: use the medias of the program Infinite Ground 2D ( First post )

Code: Select all

IncludeFile "Include\Supersprite3D.pbi"
InitSprite() :InitSprite3D() : InitSuperSprite3D() : InitKeyboard() : InitMouse()


OpenScreen(800,600,16,"")

SetPerspective(400,300)



TransparentSpriteColor(-1,0)
UsePNGImageDecoder()

LoadSprite(0,"Ground.png",#PB_Sprite_Texture)
CreateSprite3D(0,0)

LoadSprite(1,"Mask.png",#PB_Sprite_Texture)
CreateSprite3D(1,1)

LoadSprite(2,"Arch.png",#PB_Sprite_Texture)
CreateSprite3D(2,2)

LoadSprite(3,"Wall.png",#PB_Sprite_Texture)
CreateSprite3D(3,3)

LoadSprite(4,"fond.png",#PB_Sprite_Texture)
CreateSprite3D(4,4)

LoadSprite(5,"Ceil.png",#PB_Sprite_Texture)
CreateSprite3D(5,5)


MonSprite   = CreateSuperSprite3D(0,512,512)
Arch        = CreateSuperSprite3D(2,512,512)
Wall        = CreateSuperSprite3D(3,512,512)
Ceil        = CreateSuperSprite3D(5,512,512) 



Structure Ground
 z.f
 x.f
 y.f
 Alpha.l
EndStructure

Global Sol.Ground


Repeat
ClearScreen(0) : ExamineKeyboard() : ExamineMouse()




If FPST.l<ElapsedMilliseconds()
FPST=ElapsedMilliseconds()+1000
fps.l = fpsc.l
fpsc = 0
EndIf 

If FPST > ElapsedMilliseconds()
fpsc+1
EndIf


Delta.l  - 30

If Delta<-1024 : Delta=0 : EndIf 
   
   dx-MouseDeltaX()
   
   If dx>768 : dx=768 : EndIf
   If dx<-768 : dx=-768 : EndIf
   
Start3D()
Sprite3DQuality(0)

;-AFFICHAGE DU SOL
    For z = 50 To 0 Step -1
     For x = -2 To 2 
      
      Sol\z = Delta + z*512
      RotateSuperSprite3D(MonSprite,90,0,0)
      SetSuperSpritePosition(MonSprite,dx+x*512,300,Sol\z)
      DisplaySuperSprite3D(MonSprite)
      
      RotateSuperSprite3D(Ceil,-90,0,0)
      SetSuperSpritePosition(Ceil,dx+x*512,300-512,Sol\z)
      DisplaySuperSprite3D(Ceil)
      
      
      
      
      Next
    Next
    
   ; son masque
   
     DisplaySprite3D(1,0,0,128)
     Sprite3DBlendingMode(5,6)
     
     
;-Affichage des arches     

    For z = 50 To 1 Step -1
      Sol\x =15360 - x*512
      Sol\z = Delta + z*512
      
     
         For x = -2 To 2
      RotateSuperSprite3D(Ceil,90,0,0)
      SetSuperSpritePosition(Ceil,dx+x*512,300+512,Sol\z)
      DisplaySuperSprite3D(Ceil,100)
      Next 
      
      
      ;Reflet mur droit
      RotateSuperSprite3D(Wall,270,-90,90)
      SetSuperSpritePosition(Wall,dx+1024,300+256,Sol\z)
      DisplaySuperSprite3D(Wall,100)
      
      ;Reflet Mur gauche
      RotateSuperSprite3D(Wall,90,90,90)
      SetSuperSpritePosition(Wall,dx-1024,300+256,Sol\z)
      DisplaySuperSprite3D(Wall,100)
     
  
      
      For ax = -1 To 1
       ;Reflet des arches
      RotateSuperSprite3D(Arch,0,0,180)
      SetSuperSpritePosition(Arch,dx+(ax*512),300+256,Sol\z)
      DisplaySuperSprite3D(Arch,150)
        
        
      ;arch
      RotateSuperSprite3D(Arch,0,0,0)
      SetSuperSpritePosition(Arch,dx+(ax*512),300-256,Sol\z)
      DisplaySuperSprite3D(Arch)
       
      Next 
      
      ;mur droit
      RotateSuperSprite3D(Wall,270,-90,90)
      SetSuperSpritePosition(Wall,dx+1024,300-256,Sol\z)
      DisplaySuperSprite3D(Wall)
      
      ;Mur gauche
      RotateSuperSprite3D(Wall,90,90,90)
      SetSuperSpritePosition(Wall,dx-(1024),300-256,Sol\z)
      DisplaySuperSprite3D(Wall)
      
      
 
      
    Next 
     
  

 
Stop3D()


StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent)
DrawText(0,0,"SuperSprite3D DEMO - Infinite Ground 2D - BGAMES TEAM",RGB(0,255,255))
DrawText(0,20,"Frame rate : "+Str(fps),RGB(0,255,255))

StopDrawing()



 FlipBuffers(2)
Until KeyboardPushed(#PB_Key_Escape)

If you want use 3D in PureBasic, work with Dreamotion3D :wink:

@++
User avatar
IceSoft
Addict
Addict
Posts: 1682
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Post by IceSoft »

I add my ICE_SpriteFont3D library to this example:
Should be faster now ;-)

Download (demo):
ground_ice.zip


Download (Userlib): ICE_SpriteFont3D
and put it to the UserLibraries folder.
Then start this example again.

Code: Select all

IncludeFile "Supersprite3D.pbi" 
InitSprite() :InitSprite3D() : InitSuperSprite3D() : InitKeyboard() : InitMouse() 


OpenScreen(800,600,16,"") 

SetPerspective(400,300) 



TransparentSpriteColor(-1,0) 
UsePNGImageDecoder() 

LoadSprite(0,"Ground.png",#PB_Sprite_Texture) 
CreateSprite3D(0,0) 

LoadSprite(1,"Mask.png",#PB_Sprite_Texture) 
CreateSprite3D(1,1) 

LoadSprite(2,"Arch.png",#PB_Sprite_Texture) 
CreateSprite3D(2,2) 

LoadSprite(3,"Wall.png",#PB_Sprite_Texture) 
CreateSprite3D(3,3) 

LoadSprite(4,"fond.png",#PB_Sprite_Texture) 
CreateSprite3D(4,4) 

LoadSprite(5,"Ceil.png",#PB_Sprite_Texture) 
CreateSprite3D(5,5) 

LoadFont(1, "Small Font", 10)
Global SpriteFont1 = ICE_CreateSpriteFont3D($FFFF, 0, 1)  
Global SpriteFont2 = ICE_CreateSpriteFont3D($FF, 0, 1)  

MonSprite   = CreateSuperSprite3D(0,512,512) 
Arch        = CreateSuperSprite3D(2,512,512) 
Wall        = CreateSuperSprite3D(3,512,512) 
Ceil        = CreateSuperSprite3D(5,512,512) 



Structure Ground 
 z.f 
 x.f 
 y.f 
 Alpha.l 
EndStructure 

Global Sol.Ground 

puls =5

Repeat 
  angle +1
  If angle > 360: angle = 0:EndIf
  
    heartbeat +puls
  If heartbeat > 360 Or heartbeat < 0: puls*(-1):EndIf
  
ExamineKeyboard() : ExamineMouse() 



Delta.l  - 30 

If Delta<-1024 : Delta=0 : EndIf 
    
   dx-MouseDeltaX() 
    
   If dx>768 : dx=768 : EndIf 
   If dx<-768 : dx=-768 : EndIf 
    
Start3D() 

;-AFFICHAGE DU SOL 
    For z = 50 To 0 Step -1 
     For x = -2 To 2    
      Sol\z = Delta + z*512 
      RotateSuperSprite3D(MonSprite,90,0,0) 
      SetSuperSpritePosition(MonSprite,dx+x*512,300,Sol\z) 
      DisplaySuperSprite3D(MonSprite) 
      
      RotateSuperSprite3D(Ceil,-90,0,0) 
      SetSuperSpritePosition(Ceil,dx+x*512,300-512,Sol\z) 
      DisplaySuperSprite3D(Ceil) 
 
      Next 
    Next 
    
   ; son masque 
    
     DisplaySprite3D(1,0,0,128) 
     Sprite3DBlendingMode(5,6) 
      
      
;-Affichage des arches      
    Sol\x =15360 - x*512 
    For z = 50 To 1 Step -1 
      
      Sol\z = Delta + z*512 
      
      
      For x = -2 To 2 
        RotateSuperSprite3D(Ceil,90,0,0) 
        SetSuperSpritePosition(Ceil,dx+x*512,300+512,Sol\z) 
        DisplaySuperSprite3D(Ceil,100) 
      Next 
      
      
      ;Reflet mur droit 
      RotateSuperSprite3D(Wall,270,-90,90) 
      SetSuperSpritePosition(Wall,dx+1024,300+256,Sol\z) 
      DisplaySuperSprite3D(Wall,100) 
      
      ;Reflet Mur gauche 
      RotateSuperSprite3D(Wall,90,90,90) 
      SetSuperSpritePosition(Wall,dx-1024,300+256,Sol\z) 
      DisplaySuperSprite3D(Wall,100) 
      
  
      
      For ax = -1 To 1 
       ;Reflet des arches 
      RotateSuperSprite3D(Arch,0,0,180) 
      SetSuperSpritePosition(Arch,dx+(ax*512),300+256,Sol\z) 
      DisplaySuperSprite3D(Arch,150) 
        
        
      ;arch 
      RotateSuperSprite3D(Arch,0,0,0) 
      SetSuperSpritePosition(Arch,dx+(ax*512),300-256,Sol\z) 
      DisplaySuperSprite3D(Arch) 
        
      Next 
      
      ;mur droit 
      RotateSuperSprite3D(Wall,270,-90,90) 
      SetSuperSpritePosition(Wall,dx+1024,300-256,Sol\z) 
      DisplaySuperSprite3D(Wall) 
      
      ;Mur gauche 
      RotateSuperSprite3D(Wall,90,90,90) 
      SetSuperSpritePosition(Wall,dx-(1024),300-256,Sol\z) 
      DisplaySuperSprite3D(Wall) 
    
      
    Next     
    ICE_DrawingSpriteFont3D(SpriteFont1)
    ICE_DisplayRotatedFadingSpriteFont3D(400, 300,angle ,"SuperSprite3D DEMO - Infinite Ground 2D - BGAMES TEAM",255)
    ICE_DrawingSpriteFont3D(SpriteFont2)
    ICE_ZoomSpriteFont3D(1, heartbeat/4, heartbeat/4)
    ICE_DisplayRotatedFadingSpriteFont3D(400, 200,heartbeat, "FPS: "+ Str(ICE_GetFPS()),255)
    ICE_ZoomSpriteFont3D(0, heartbeat/4, heartbeat/4)

Stop3D() 



FlipBuffers(0) 
Until KeyboardPushed(#PB_Key_Escape) 
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Fantoma
New User
New User
Posts: 6
Joined: Sun Jul 06, 2003 5:04 am
Location: Australia
Contact:

Re: SuperSprite3D

Post by Fantoma »

All of the links seem to be dead. Anyone know where to find else to find any/all of the archives in this thread?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Re: SuperSprite3D

Post by Psychophanta »

Fantoma wrote:All of the links seem to be dead. Anyone know where to find else to find any/all of the archives in this thread?
I have it.
PM me if you don't find.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Tazman47
New User
New User
Posts: 1
Joined: Sun Jun 14, 2009 7:20 pm
Location: Virginia

Re: SuperSprite3D

Post by Tazman47 »

Does anyone know if this lib is still available? I would like to take a look at it to see if it is usable in PB4.31. All links come up as page not found. Thanks :D
Teng
User
User
Posts: 21
Joined: Thu Aug 27, 2009 12:13 pm

Re: SuperSprite3D

Post by Teng »

From all the great comments posted on this thread, I gather that Cpl.Bator's SuperSprite3D is a must see. Too bad the links are dead for me too. If it's not too much trouble Psychophanta (or anyone else who has the source), could you please post a link here, I'm sure lots of people would like to try it out. By the way how large is Supersprite3d.pbi, is it more than 800 lines? Cause if it is I can't run it :( .
Post Reply