Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
39 user(s) are online (30 user(s) are browsing Forums)

Members: 0
Guests: 39

more...

Support us!

Headlines

 
  Register To Post  

AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
Hi all :)
I put a small demo showing the project progress.
It uses 2D Images ( OpenGL Textures), alpha mapping and transparency.
There are parallax and differencials scrollings.

Here is the link to Download the demo :
http://www.odyssey-creators.com/AmiDARK_Engine0.1WIP_2DDemo.rar

Here is also a snapsho made with SGrab showing the demo:
http://www.odyssey-creators.com/AmiDARKEngine0.1WIP2DDemo.png
It should be similar to this (excepted the trees and grass that should appear correctly and not like in the shot ... SGrab cause some bugs in OpenGL :( )

And now, for those that'll like to see the Demo source code, here it is :

/*********************************************************** 
** 
** AmiDARK Engine Development Project 
**------------------------------------ 
** 
** Sample : Textures/Images demonstration 
** Author : Frederic Cordier 
** Date :   2009JUI22-043821 ** 
************************************************************ 
*/ 
#!include! "AmiDARKEngine.c" 
  
int ILoop
  
float XMountain[3]; 
  
float XTrees]; 
  
float XHerbs]; 
  
float XClouds[5][ ]; 

void DarkLoopvoid ){ 
  
// Set display mode to 640x480 using 32bits
  
DESetDisplayMode64048032 ); 
  
// Define default images positions for all elements that'll scroll.
  // Mountains
  
XMountain] = 0.0
  
XMountain] = 512.0
  
XMountain] = 1024.0
  
// Trees.
  
XTrees] = 0.0
  
XTrees] = 512.0
  
XTrees] = 1024.0
  
XTrees] = 1536.0
  
// Grass.
  
XHerbs] = 0.0
  
XHerbs] = 512.0
  
XHerbs] = 1024.0
  
// Clouds.
  
XClouds[1][ ] = 0.0
  
XClouds[1][ ] = 640.0
  
XClouds[2][ ] = 0.0
  
XClouds[2][ ] = 640.0
  
XClouds[3][ ] = 0.0
  
XClouds[3][ ] = 640.0
  
XClouds[4][ ] = 0.0
  
XClouds[4][ ] = 640.0
  
XClouds[5][ ] = 0.0
  
XClouds[5][ ] = 640.0
  
// Set the amount of used textures
  
DESetMaximumTextures13 ); 
  
// Load all images. 
  
DELoadImageEx"Images/RTSky02_SunWake05.png"1,  ); 
  
DELoadImageEx"Images/Mountains512.png"20); 
  
DELoadImageEx"Images/Layer_Trees512A.png"30); 
  
DELoadImageEx"Images/Layer_Trees512B.png"40); 
  
DELoadImageEx"Images/Layer_Herbs512.png"50); 
  
DELoadImageEx"Images/Layer_Water640.png"60); 
  
DELoadImageEx"Images/Layer_Cllouds4[640x12]_Alpha.png",7); 
  
DELoadImageEx"Images/Layer_Cllouds3[640x18]_Alpha.png",8); 
  
DELoadImageEx"Images/Layer_Cllouds2[640x38]_Alpha.png",9); 
  
DELoadImageEx"Images/Layer_Cllouds1[640x80]_Alpha.png",10); 
  
DELoadImageEx"Images/Layer_Cllouds0[640x42]_Alpha.png",11); 
  
DELoadImageEx"Images/Layer_Ground[640x60].png"12,); 
  
DELoadImageEx"Images/Logo.png"13); 
  
DECls(); 
  while( !
DELoop() ){ 
    
// Blue sky, Moon & Sun 
    
DEPasteImage10); 
    
// Mountains scroll 
    
for ( ILoop 1ILoop  4ILoop++ ){ 
      
XMountainILoop ] =  XMountainILoop ] - 0.25
      if ( 
XMountainILoop  ;] < -640.0 ){ 
        
XMountainILoop ]& nbsp;= XMountainILoop ] + 640.0
       } 
      
DEPasteImageEx2, (int)XMounta inILoop ], 224); 
      
// Display mountains
      
DEPasteImage6, (int)XMountain ILoop ], 320 ); 
     } 
    
// Trees scrolling
    
for ( ILoop 1ILoop  5ILoop++ ){ 
      
XTreesILoop ] = XTr eesILoop ] - 0.70
      if ( 
XTreesILoop ]& nbsp;< -512 ){ 
        
XTreesILoop ]&nbs p;= XTreesILoop ] + 2048.0
       } 
     } 
    
// Clouds scrolling using 2 parallax
    
for ( ILoop 1ILoop  3ILoop++ ){ 
      
XClouds[1][ ILoop ] =  ;XClouds[1][ ILoop ] - 0.15
      if ( 
XClouds[1][ ILoop&nbs p;] < -640.0 ){ 
        
XClouds[1][ ILoop ]  = XClouds[1][ ILoop ] + 640.0
       } 
      
XClouds[2][ ILoop ] =  ;XClouds[2][ ILoop ] - 0.30
      if ( 
XClouds[2][ ILoop&nbs p;] < -640.0 ){ 
        
XClouds[2][ ILoop ]  = XClouds[2][ ILoop ] + 640.0
       } 
      
XClouds[3][ ILoop ] =  ;XClouds[3][ ILoop ] - 0.45
      if ( 
XClouds[3][ ILoop&nbs p;] < -640.0 ){ 
        
XClouds[3][ ILoop ]  = XClouds[3][ ILoop ] + 640.0
       } 
      
XClouds[4][ ILoop ] =  ;XClouds[4][ ILoop ] - 0.60
      if ( 
XClouds[4][ ILoop&nbs p;] < -640.0 ){ 
        
XClouds[4][ ILoop ]  = XClouds[4][ ILoop ] + 640.0
       } 
      
XClouds[5][ ILoop ] =  ;XClouds[5][ ILoop ] - 0.75
      if ( 
XClouds[5][ ILoop&nbs p;] < -640.0 ){ 
        
XClouds[5][ILoop ]  = XClouds[5][ ILoop ] + 640.0
       } 
     } 
    
// Display all clouds
    
DEPasteImageEx7XClouds[1][ 1  ], 178); 
    
DEPasteImageEx7XClouds[1][ 2  ], 178); 
    
DEPasteImageEx8XClouds[2][ 1  ], 160); 
    
DEPasteImageEx8XClouds[2][ 2  ], 160); 
    
DEPasteImageEx9XClouds[3][ 1  ], 122); 
    
DEPasteImageEx9XClouds[3][ 2  ], 122); 
    
DEPasteImageEx10XClouds[4][ 1  ;], 42); 
    
DEPasteImageEx10XClouds[4][ 2  ;], 42); 
    
DEPasteImageEx11XClouds[5][ 1  ;], 0); 
    
DEPasteImageEx11XClouds[5][ 2  ;], 0); 
    
// Display the trees.
    
for( ILoop 1ILoop <&n bsp;3ILoop++ ){ 
      
DEPasteImageExILoop 2,  (int)XTreesILoop ], 214); 
      
DEPasteImageExILoop 2,  (int)XTreesILoop ], 214); 
      
DEPasteImage12, (int)XTrees[& nbsp;ILoop ], 420 ); 
      
DEPasteImage12, (int)XTrees[& nbsp;ILoop ], 420 ); 
     } 
    
// Grass scroll
    
for ( ILoop 1ILoop  4ILoop++ ){ 
      
XHerbsILoop ] = XHe rbsILoop ] - 1.0
      if ( 
XHerbsILoop ]& nbsp;< - 512 ){ 
        
XHerbsILoop ]&nbs p;= XHerbsILoop ] + 1536.0
       } 
      
DEPasteImageEx5XHerbs[  ;ILoop ], 440); 
     } 
    
// display Demo logo
    
DEPasteImageEx1364481&nbs p;); 
    
// Synchro. 
    
DESync(); 
   } 
  
// Erase all images from memory.
  
for ( ILoop 1ILoop 14;  ILoop++ ){ 
    
DEDeleteImageILoop ); 
   } 
 }


Wow ! So similar to Basic languages :p and it's C :)
Feel free to give your opinion about this small demo.

@ +
AmiDARK


Edited by freddix on 2009/9/15 20:49:10
Edited by freddix on 2009/9/15 20:49:48
All we have to decide is what to do with the time that is given to us.
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
@freddix

Reminds me of the Psygnosis games.

Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Just popping in
Just popping in


See User information
@freddix

Wow, very nice !! Have you been able to implement the Amos routine engine or something like that ? Or not yet ?

Anyway, thanks for keeping your work "alive".

Nic

Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
@unimon:
Nothing from AMOS
Actually all is developed from scratch.
All is NEW :p

Amos compatibility will come later ;)

All we have to decide is what to do with the time that is given to us.
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Home away from home
Home away from home


See User information
@freddix

Quote:

Here is also a snapsho made with SGrab showing the demo:
http://www.odyssey-creators.com/AmiDARKEngine0.1WIP2DDemo.png
It should be similar to this (excepted the trees and grass that should appear correctly and not like in the shot ... SGrab cause some bugs in OpenGL :( )


I'm pretty sure that the bug is in your image to texture loading code. Look up glPixelStoref(), and check your image loading code. In particular, have a look at GL_UNPACK_ALIGNMENT, and GL_UNPACK_ROW_LENGTH. Slanted textures are usually caused by getting the alignment wrong when copying an image into a texture. Notice that all images with a width of 512 are correctly aligned, but not images with a width of 640 (that includes the clouds, although it's hard to tell).

Incorrect glPixelStore settings have caught me out before too. GlPixelStore also applies to glDrawPixels()/glReadPixels().

Hans

EDIT: Correction, it looks like all of the images except for the logo are slanted.


Edited by Hans on 2009/9/15 7:59:20
Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Just popping in
Just popping in


See User information
@Hans

It can also be because the SGrab is not fast enough to grab the whole window in one frame.

To get correct screenshots of OpenGL it is better to write own code to dump the databuffer to disk and convert it to png.

SGrab vs. buffer dump

/Me, myself and A1G4!
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
The 2 images that are not slanted are logo and sun+moon backdrop
these 2 images does not move.
I think that the problem is the one menthos said.

Thank you for your comments.
Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Home away from home
Home away from home


See User information
@Menthos

Quote:

Menthos wrote:
@Hans

It can also be because the SGrab is not fast enough to grab the whole window in one frame.

To get correct screenshots of OpenGL it is better to write own code to dump the databuffer to disk and convert it to png.

SGrab vs. buffer dump


Possible, although I've never experienced that. I have had SGrab delay grabbing a frame because of low priority, but never had it smear the graphics.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Home away from home
Home away from home


See User information
@freddix

Quote:

freddix wrote:
The 2 images that are not slanted are logo and sun+moon backdrop
these 2 images does not move.
I think that the problem is the one menthos said.

Thank you for your comments.
Regards,
AmiDARK


In that case, try raising the priority of SGrab. You may also wish to limit the frame-rate at which you're rendering. It's not necessary, but there's no point in rendering at 100+ fps when your monitor is running at 60 Hz.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
@Hans
Yes,
My demo actually run at full frame rate
I plan to add the :
Sync Rate XXX
command to allow user to define the frame rate he liked to have.

Regards,
AmiDARK.

All we have to decide is what to do with the time that is given to us.
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Just can't stay away
Just can't stay away


See User information
Hi @Hans
#8
SGrab cause some bugs in OpenGL :( )

Possible, although I've never experienced that. I have had SGrab delay grabbing a frame because of low priority, but never had it smear the graphics.

SGrab - using JPG - will wringle with default 85% JPEG QUALITY. I use 100% for posting pictures at FLICKr. For example:
http://www.flickr.com/photos/11367727@N07/3923374742/

Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Quite a regular
Quite a regular


See User information
@Snuffy
You cannot compare a card game with a scrolling graphic.
Card game is static and when you take the shot, nothing move on screen (or seem to ~).

All we have to decide is what to do with the time that is given to us.
Go to top
Re: AmiDARK Engine - Alpha WIP - 2D Demo
Just can't stay away
Just can't stay away


See User information
@freddix

Oops, I was referring to SGrab wrinkles.
...a scrolling graphic...
I know, it's called 'parallax scrolling.' I was comparing your demo to a SDLBasic demo-'Shadow of the Beast' which does 15 levels of scrolling.

BTW, my poker table is not static, it's animated. Cards, poker chips, and dealer button move around. Animation is the my current study in SDLBasic. I enjoyed looking into your demo. I'm thinking of using a couple levels of 'parallax scrolling' in my game. They're used a lot in casino games I've seen.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project