IonicWind Software

Aurora Compiler => 2D Graphics => Topic started by: Ionic Wind Support Team on March 11, 2006, 10:32:58 AM

Title: Welcome
Post by: Ionic Wind Support Team on March 11, 2006, 10:32:58 AM
This forum is for discusssion and code relating to the upcoming 2D classes in Aurora.  2D will make its debut in Alpha 3.
Title: Re: Welcome
Post by: Barney on March 11, 2006, 01:43:44 PM
I would really like to see the 2D functions implemented through 3D hardware. The best example of the power of such implementation are sprite libraries for Blitz3D. Most notably Sprite Candy. Far better than anything available as pure 2D implementation. Aurora 2D functions accelerated by 3D hardware will easily be capable of creating quality shareware games for quite large audience.

Barney
Title: Re: Welcome
Post by: pirate on March 24, 2006, 09:08:38 AM
Which DirectX version will it be? If DirectX7, will it be via DirectDraw or Direct3D?
Title: Re: Welcome
Post by: Ionic Wind Support Team on March 24, 2006, 02:39:57 PM
I usually do 2D through DirectDraw.  Also looking into simulating 2D with 3D.
Title: Re: Welcome
Post by: Protected on March 29, 2006, 12:37:06 PM
Paul, when is Alpha 3 expected? I was working on something with IBasic standard but I think I'll have to stop - it's running very slowly with all those calculations :P How much faster than IB standard can Aurora (with this library) be?
Title: Re: Welcome
Post by: John S on March 29, 2006, 01:42:43 PM
I'm not an expert, but isn't IBStd an interpretted language.  If so, than Aurora, being compiled will be much faster.

When I ran this small app (with 100 million cycles) it took 10 seconds ( on my 2.2 GHz AMD ) :



/*
timer.src
Compile this program to run in a console window.
*/
global sub main()
{
string endtime, starttime = FormatTime();
float starting, ending, sine, square, number = 0;
int n = 100000000;  // 100 million

for( int x = 0; x < n; x++)
{
   number = number + 1;
   square = number * number;
   sine = sind(number);
}

endtime = FormatTime();

writeln("\n    The start time is: " + starttime + "\n");
writeln("\n      The end time is: " + endtime + "\n");

starting = StrToNum(StrRight(starttime,2)) + 60*StrToNum( StrMid(starttime,4,2) ) + 60*60*StrToNum(StrLeft(starttime,2));
ending   = StrToNum(StrRight(endtime,2)) + 60*StrToNum( StrMid(endtime,4,2) ) + 60*60*StrToNum(StrLeft(endtime,2));

writeln("\n                 After " + NumToStr(n) + " cycles\n");
writeln("\n      The end time is: " + NumToStr(ending-starting) + " seconds\n");

do{}until getkey() <> "";

return;
}



editted to add hours conversion to app just in case someone is still running an IBM XT   ;)
Title: Re: Welcome
Post by: Ionic Wind Support Team on March 29, 2006, 01:50:23 PM
Quote from: Protected on March 29, 2006, 12:37:06 PM
Paul, when is Alpha 3 expected? I was working on something with IBasic standard but I think I'll have to stop - it's running very slowly with all those calculations :P How much faster than IB standard can Aurora (with this library) be?

As soon as I finish it ;)

Title: Re: Welcome
Post by: Protected on March 29, 2006, 02:00:31 PM
IB standard is compiled, though in a fishy way :P

I only tried with a sample, but I think it would take more than 30 minutes to run that program in IB standard  ;D (3ghz dual core)
Title: Re: Welcome
Post by: Ionic Wind Support Team on March 29, 2006, 02:10:26 PM
IBasic Standard is a byte code interpreter.  Pro is a true compiler, so is Aurora.
Title: Re: Welcome
Post by: Protected on March 30, 2006, 11:16:06 AM
byte code interpreter = compiled in a fishy way ;D

I COULD buy IB pro, but I'd rather buy Aurora...
Title: Re: Welcome
Post by: Barney on March 30, 2006, 04:12:53 PM
I thought this part of the forum is about 2D in Aurora, not about the IBStd or Pro. Stay on topic, please.

Barney
Title: Re: Welcome
Post by: Ionic Wind Support Team on March 30, 2006, 09:51:20 PM
Actually it was technically on topic.  Protected was asking about 2D speed in comparison to other languages and we were just helping him out.

I'll decide what is on topic ;)  Unless you want to volunteer to be a moderator of course  ;D
Title: Re: Welcome
Post by: Barney on April 01, 2006, 05:04:01 AM
No, thank you. I already moderate two train sim forums and that's quite enough for me right now... :)

Barney
Title: Re: Welcome
Post by: Zen on April 03, 2006, 03:08:07 AM
Just out of interest, apart from when you finish it, do you have a rough idea of when the 2D stuff will be ready for us to play with?

Lewis
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 03, 2006, 06:48:36 AM
Working on it now.  And it will be in the next update.  At least most of it.


global sub main()
{
openconsole();
C2DScreen s;
int fps;
s.CreateFullScreen(640,480,32);
do
{
fps = s.Flip();
} until GetKeyState(0x1b);
s.CloseScreen();
print(fps);
while GetKey() = "";
return 0;
}
Title: Re: Welcome
Post by: pirate on April 03, 2006, 08:54:54 AM
Are you coding it from scratch or will it be a conversion of an existing library, like CDX for an example?
Title: Re: Welcome
Post by: Parker on April 03, 2006, 09:15:32 AM
I'm guessing it will be written using just DirectX, and will be much easier to write than IB's due to supported classes...
Title: Re: Welcome
Post by: Zen on April 03, 2006, 03:54:48 PM
Hmmm, Paul in your example you have openconsole, i dont remember using openconsole in IBasic Pro, or was it just hidden from us all?

Lewis
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 03, 2006, 06:24:03 PM
Written from scratch with similar commands to my other languages.

Compiled as a Windows target so I used OpenConsole so I could print the FPS somewhere.
Title: Re: Welcome
Post by: Parker on April 03, 2006, 08:03:46 PM
OPENCONSOLE's always been there in IBasic (std and pro) and Aurora.
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 03, 2006, 09:09:37 PM
Guess it need more explanation for those that don't know ;).  OpenConsole opens the system console window when your program is compiled as a windows target.  This lets you use the console library commands along side of a regular windows.

While developing 2D and 3D libraries I will use it as a quick way of printing debugging messages.
Title: Re: Welcome
Post by: tide on April 03, 2006, 11:18:27 PM
Thanks, Paul! I'm looking forward to it. I have some simple animations running and the flicker is rather distracting.

Quote from: Ionic Wizard on April 03, 2006, 06:48:36 AM
Working on it now.ÂÃ,  And it will be in the next update.ÂÃ,  At least most of it.


global sub main()
{
openconsole();
C2DScreen s;
int fps;
s.CreateFullScreen(640,480,32);
do
{
fps = s.Flip();
} until GetKeyState(0x1b);
s.CloseScreen();
print(fps);
while GetKey() = "";
return 0;
}

Title: Re: Welcome
Post by: Zen on April 04, 2006, 02:14:39 AM
Sorry, i didnt mean i never saw OPENCONSOLE in IBasic, i just meant i dont remember using it in 2D or 3D stuff.

I used openconsole all the time in IBasic as i wrote a lot of console n cgi programs etc

Lewis
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 09, 2006, 08:39:18 AM
Still working on the 2D classes.  Primitive drawing functions are done, you can create multiple 2D windows which Pro couldn't do.  The sprite functionality is a bit more robust with a few more properties and an automated list of sprites that can be drawn and moved together.

Also have a few sound classes that I've been working on for managing midi, waves, and sound effects. 

My lack of posts recently just means I have my head down working ;)
Title: Re: Welcome
Post by: sapero on April 09, 2006, 03:47:06 PM
I'm working with C headers. >4 MB is done, 40MB left :-[
Title: Re: Welcome
Post by: Protected on April 10, 2006, 05:33:35 AM
That's pretty cool Paul. Can you use PNGs as sprites? WIth alpha channel support?

Also, it would be nice if the image data (or music data) could be loaded from a string instead of a file. I plan on bundling all the info required for my 2D environment into a single file, and it's clumsy if I have to write down all the separate files in a temp folder when the file is being loaded...

This is a completely unrelated question, and maybe it was already asked somewhere else in the forums, but any plans for an easy-sockets library? I mean, one with not only raw TCP/UDP functionality but also the most commonly used protocols already implemented... HTTP, FTP, maybe NTP... It would add value to Aurora :P
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 10, 2006, 08:35:11 AM
Mike has Socket Tools

http://www.ionicwind.com/forums/index.php?topic=399.0
Title: Re: Welcome
Post by: seberbach on April 10, 2006, 09:22:44 PM
Quote from: Ionic Wizard on April 09, 2006, 08:39:18 AM


Also have a few sound classes that I've been working on for managing midi, waves, and sound effects. 

My lack of posts recently just means I have my head down working ;)


I am very interested in sound classes, not just for games, but for transforming one commercial/artistic sound format, as played or recorded in real time, into another.

More particularly, there is much difficulty (contoversy and hesitation) in professional circles, surrounding any standardizing of recording and playback formats, such as how do you manipulate, concatenate, make multichannel, etc. even the lowly .WAV files? Really, there should be no limit to the number of simultaneous channels. (other than limits of the hardware bandwidth)

Which is left, right, center? Which is rear? Overhead? How many channels? How to compress?  Microsoft is being looked toward to "make a standard", (because anyone who tries will have thjjeir innovation co-opted if they do it well) but where is it?  I can't hold my breath forever.

Steve

Steve
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 10, 2006, 09:39:07 PM
The limit is determined by hardware.  There is a bit more standardization now then there was a few years back. DirectSound works with any manufacturers sound card but the bandwidth is still limited by the DSP chip used by the card.

Professional audio cards are available that have true 8 and 16 channel output, without needing to mix through software or a DSP.  Those cards are very pricey.

http://www.digigram.com/products/getinfo.htm?prod_key=11600
http://www.digitalaudio.com/DIGITALAUDIO/myarticles.asp?P=5215&S=75&PubID=4401&UT=admin&UID=520

If your into digital recording on a budget then you'll need at least a 4 channel card, dedicated hard drive for streaming the raw input data without any loss, and a good sequencing program. 

Paul.
Title: Re: Welcome
Post by: Protected on April 11, 2006, 07:36:48 AM
Thanks for pointing out about socket tools, I didn't notice ~_~

QuoteThat's pretty cool Paul. Can you use PNGs as sprites? WIth alpha channel support?

Also, it would be nice if the image data (or music data) could be loaded from a string instead of a file. I plan on bundling all the info required for my 2D environment into a single file, and it's clumsy if I have to write down all the separate files in a temp folder when the file is being loaded...

Any answer to this?  ;D
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 11, 2006, 08:59:04 AM
No PNG yet ;)  But it will be added.

You can store any data in resources.  You can also create a sprite through code just by writing to a buffer.
Title: Re: Welcome
Post by: Zen on April 11, 2006, 10:17:16 AM
Yay PNG Support!!! im guessing this will also support PNG transparency.

Thank god for that. I tried to make an XML driven 2D interface but gave up because there was no PNG support.

Lewis
Title: Re: Welcome
Post by: Protected on April 11, 2006, 03:41:40 PM
That's great news  :)
Title: Re: Welcome
Post by: Ionic Wind Support Team on April 17, 2006, 03:28:04 PM
Moving along ;)

Should have an update tonight.... finally.  Or tomorrow morning depedning on what the wife has planned for me.  The code below represents the basic structure of the 2D classes.  The screen class is derived from CWindow making it easy to use any of the API based graphic commands with a 2D surface. 

It also allows you to derive your own class from C2DScreen if you want to use message handlers and such.  But it is not necessary as all input can be handled directly from the DirectInput class.  Or just by checking for keypresses. 

By using this class structure you can use windowed/full screen mode by just changing one line of code. 



global sub main()
{
C2DScreen s;
int fps;
int block = 0;
int dir = 1;
int frame = 0;
int s2frame = 0;
int s2xdir = 4;
int s2ydir = -4;
int x = 100;
int x2 = 0;
int y = 200;
int y2 = 400;
int ydir = 4;
int xdir = 4;
//s.CreateFullScreen(800,600,16);
s.CreateWindowed(0,0,800,600,AWS_CAPTION|AWS_VISIBLE|AWS_SIZE,0,"2D Test",NULL);
s.SetStretchedFlip(false);
C2DSurface *back = s.GetBack();
C2DSprite sprite1,sprite2;
if(!sprite1.Load(s,getstartpath() + "Mouth.bmp",0,0,3,TRUE))
{
MessageBox(s,"unable to load sprite",getstartpath() + "Mouth.bmp");
}
if(!sprite2.Load(s,getstartpath() + "Mouth.bmp",0,0,3,TRUE))
{
MessageBox(s,"unable to load sprite",getstartpath() + "Mouth.bmp");
}
sprite1.SetMaskColor(RGB(87,87,87));
sprite1.SetRenderMode(RENDER_TRANSROTOZOOM);
sprite1.SetAngleD(180);
sprite2.SetShadowOffset(-20,-20);
sprite2.SetMaskColor(RGB(87,87,87));
sprite2.SetAlpha(180);
do
{
Back->Fill(RGB(0,50,255));
s.WriteText( 180,0,"PRESS LEFTMOUSE TO CLOSE, FPS: " + NumToStr(fps));
//play with the sprites
sprite1.SetFrame(frame);
//sprite1.RenderXY(back,s.Mousex()-10,s.Mousey());
sprite1.RenderXY(back,x,y);
sprite2.SetFrame(s2frame);
//draw a sprite and an alpha shadow
sprite2.SetRenderMode(RENDER_TRANSSHADOW);
sprite2.RenderXY(back,x2,y2);
sprite2.SetRenderMode(RENDER_TRANS);
sprite2.RenderXY(back,x2,y2);

fps = s.Flip(1);

IF sprite1.CollisionTest(sprite2,1)
{
xdir = -xdir;
s2xdir = -s2xdir;
}

//adjust sprite1 direction
x+=xdir;
if((x + sprite1.GetWidth()) > 800 | x < 0 )
xdir = -xdir;
y+=ydir;
if((y + sprite1.GetHeight()) > 600 | y < 0 )
ydir = -ydir;

frame += ((x2%10) = 0);
IF frame > 2
frame = 0;

//adjust sprite2 direction
x2 += s2xdir;
if((x2 + sprite2.GetWidth()) > 800 | x2 < 0 )
s2xdir = -s2xdir;
y2+= s2ydir;
if((y2 + sprite2.GetHeight()) > 600 | y2 < 0 )
s2ydir = -s2ydir;

s2frame += ((x2%10) = 0);
IF s2frame > 2
s2frame = 0;


} until GetKeyState(0x01);
s.CloseScreen();
return 0;
}


Title: Re: Welcome
Post by: Zen on April 17, 2006, 03:34:12 PM
Wow this looks well thought through Paul. I could never of thought of a better design if i did it myself :D
Keep up the good work.

Lewis
Title: Re: Welcome
Post by: LarryMc on April 17, 2006, 04:57:21 PM
Awh shucks!
That's so easy I'll let my driver do it! ;)