March 28, 2024, 06:07:17 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


An Aurora game - help needed

Started by Rock Ridge Farm (Larry), May 14, 2006, 06:55:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

DirectX9 really is a mess.  They changed some COM interfaces in mid stream which meade some tutorials on the net useless.  I decided on the least common denominator that works with all current DX9 releases.  And by using the DLL linked with a static version of D3DX9 library it eliminated the COM interface differences.

C and C++ are standardized, the toolkits and extensions are not.  Microsoft has a lot of subtle differences when compared to the ANSI specs.  To be fair, however, you can force any MS compiler to be ANSI complient with a switch.

I was laughing at a post on another forum that was claiming Linux didn't have any standards.  They should try DX programming ;)
Ionic Wind Support Team

kryton9

August 06, 2006, 12:52:05 PM #26 Last Edit: August 06, 2006, 01:11:56 PM by kryton9
Is there a place to get info on what is in the D3DX9 dll so we can get an idea of what features we might be seeing in your engine? So we can start using them on our own till you finish the engine.

Also will there be an option to select opengl or directx on windows as your development preference for the engine? I see that sort of choice in games and in modeling applications, but of course using the those api's compared to letting you program in them is probably a whole another matter :)

Here is the final version:
// Windows Program
// Final Version
// Based off of the breakout example
// for the 2d screen stuff

#typedef UINT unsigned int;
DECLARE IMPORT,timeGetTime(),UINT;

// used for changing the background color of the rich edit control
#define EM_SETBKGNDCOLOR 0x400 + 67
DECLARE IMPORT,SendMessageA(uint hwnd,uint uMsg,uint wParam,uint lParam),uint;

class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnClose(),int;
declare virtual OnControl(int nID, int nNotifyCode, unsigned int hControl),int;
declare virtual OnCreate(),int;
CRichEdit *prEdit;
}

//Global variables
int width,w1g,w2g,w1b,w2b;
int height;
int border_size;
int num_lines;
int topspace;
int bottomspace;
unsigned int border_color;
int fps;
int exit_game;
int mElapsed,mTimer,lastY;
double mAdjust;
MyWindow *pw1;
CWindow *pw2;
C2DScreen *pScreen;

global sub main()
{
Setup();
//Scroll text screen
pw1=new(MyWindow,1);
pw1->Create(width+4,0,200,height*.6,AWS_AUTODRAW | AWS_VISIBLE | AWS_POPUP ,0,"",0);
w1Txt();
//text screen
pw2=new(CWindow,1);
pw2->Create(width+4,height*.6,200,height*.4,AWS_AUTODRAW | AWS_VISIBLE | AWS_POPUP ,0,"",0);
w2Txt();
//2D screen create
pScreen = new(C2DScreen,1);
pScreen->CreateWindowed(0,0,width+4,height,AWS_VISIBLE|AWS_POPUP,0,"2D Multi Screen Test - ESC to exit",0);
pScreen->SetStretchedFlip(FALSE);
sz = pScreen->GetClientRect();
width = sz.right;
height = sz.bottom;
pScreen->SetFocus();
C2DSurface *back = pScreen->GetBack();

//turn off the cursor
pScreen->SetCursor(CS_CUSTOM,0);// if you want the cursor in the 2d screen, comment out this line
//Set our font and text colors
pScreen->SetFont("Ariel",12,600);
pScreen->FrontPen(RGB(192,192,255));
pScreen->DrawMode(TRANSPARENT);

mTimer = timeGetTime();
point tx;
DO
{
back->Fill(0);
ShowStatus();
DrawBorder();

//show game over graphics
tx = pScreen->GetTextSize("The mouse is hidden");
pScreen->WriteText( width/2 - tx.x/2,height/2 - tx.y/2, "The mouse is hidden");
tx = pScreen->GetTextSize("on this screen, but");
pScreen->WriteText( width/2 - tx.x/2,height/2 - tx.y/2+20, "on this screen, but");
tx = pScreen->GetTextSize("not on the others.");
pScreen->WriteText( width/2 - tx.x/2,height/2 - tx.y/2+40, "not on the others.");
tx=pScreen->GetTextSize("Mouse x: "+NumToStr(pScreen->MouseX())+"    Mouse y: "+NumToStr(pScreen->MouseY()));
pScreen->WriteText( width/2 - tx.x/2,height/2 - tx.y/2-40,"Mouse x: "+NumToStr(pScreen->MouseX())+"    Mouse y: "+NumToStr(pScreen->MouseY()));
//ESC to exit at any time
IF( GetKeyState(0x1B)) exit_game = TRUE;

//target 75 frames per second for ball movement.
mElapsed = timeGetTime() - mTimer;
mTimer = timeGetTime();
mAdjust = mElapsed / 13.3333;
fps = pScreen->Flip(1);
} UNTIL exit_game = TRUE;
//clean up and end
pScreen->CloseScreen();
delete pw1;delete pw2;delete pScreen;
return 0;
}

SUB Setup
{
//Our initial settings
width = 440;
height = 480;
border_size = 7;
num_lines = 10;
topspace = 40 + border_size;
bottomspace = border_size;
border_color = RGB(192,192,255);
fps = 0;
exit_game = FALSE;
w1g=0;w2g=0;
}

SUB DrawBorder()
{
C2Dsurface *back = pScreen->GetBack();
back->DrawFilledRect( 0,0,width,border_size,border_color);// top
back->DrawFilledRect( 0,height-border_size,width,border_size,border_color);// bottom
back->DrawFilledRect( 0,0,border_size,height,border_color);// left
back->DrawFilledRect( width-border_size,0,border_size,height,border_color);// right
RETURN;
}

SUB ShowStatus()
{
pScreen->WriteText( border_size+10,border_size+10,"This is the 2D screen area");
pScreen->WriteText( border_size+10,45,"FPS: "+str$(fps));
RETURN;
}

SUB w1Txt()
{
string s$ = "";
if (w1g =0 and w2g =0){w1g=160;w1b=120;w2g=115;w2b=105;}else {w1g = Rand(255);w1b = Rand(255);}
pw1->setwindowcolor(rgb(100,w1g,w1b));
SendMessageA(pw1->prEdit->m_hWnd,EM_SETBKGNDCOLOR,0, rgb(100,w1g,w1b));
//SendMessageA(pw1->prEdit->m_hWnd,EM_SETBKGNDCOLOR, true , 0);   // set back to windows default color
pw1->prEdit->SetDefaultColor(rgb(0,0,0));
pw1->prEdit->SetMargins(10,10);
pw1->DrawMode(TRANSPARENT);
pw1->WriteText(5,20,"scrollable text/input");
pw1->WriteText(5,50,"rgb: r: 100    g: "+NumToStr(w1g)+"    b: "+NumToStr(w1b));
for(x=0;x<11;x++)
{
s$ = s$+"test line # "+NumToStr(x)+Chr$(13);
}
pw1->prEdit->SetText(s$);
}
SUB w2Txt()
{
if (w2g!=115 and w2b!=105){ w2g = Rand(255);w2b = Rand(255);}
pw2->setwindowcolor(rgb(100,w2g,w2b));
pw2->DrawMode(TRANSPARENT);
pw2->WriteText(5,20,"text screen");
pw2->WriteText(5,50,"rgb: r: 100    g: "+NumToStr(w2g)+"    b: "+NumToStr(w2b));
}

//MyWindow Implementation
MyWindow::MyWindow(){ }
MyWindow::_MyWindow(){ }
MyWindow::OnClose(),int { Destroy(); return 0; }
MyWindow::OnControl(int nID, int nNotifyCode, unsigned int hControl),int
{
select nID
{
case 1: //This Color button
if(nNotifyCode = 0)
w1Txt();

case 2: //Color Below button
if(nNotifyCode = 0)
w2g=0;w2b=0;
w2Txt();
case 3: //Both button
if(nNotifyCode = 0)
w2g=0;w2b=0;
w1Txt();w2Txt();
case 4: //Rich Edit Control
if(nNotifyCode = 0)
w2Txt();
}
return 0;
}

MyWindow::OnCreate(),int
{
AddControl(CTBUTTON,"ThisColor",0,270,78,20,0x5000000B,0x0,1);
AddControl(CTBUTTON,"ColorBelow",78,270,88,20,0x5000000B,0x0,2);
AddControl(CTBUTTON,"Both",166,270,34,20,0x5000000B,0x0,3);
AddControl(CTRICHEDIT,"",10,135,180,125,0x50B000C4,0x200,4);
prEdit = GetControl(4);
return 0;
}

Rock Ridge Farm (Larry)

I like it - just one question - is there a way to put a windows wrapper around the whole thing?

kryton9

August 06, 2006, 01:39:18 PM #28 Last Edit: August 06, 2006, 02:52:28 PM by kryton9
You mean make it all classes and OOP instead of my mix of minimal classes and procedural spaghetti ?ÂÃ,  ÂÃ,  :)

If so, I am in like a no man's land. I am seeing the beauty of classes and OOP, but am not there in feeling natural with it and thinking that way. I guess I always just jump in and start coding never really planning, and that comes from being an architecture major. I used to plan and plan before I put anything on paper and then my profs would get mad at me. They would say we can't read your mind, so I just got in the habit of just jumping in and designing as I went. I then transferred those habits to programming and it was fine back in the day.ÂÃ,  But with OOP, to really make it sweet and effective as Paul is doing with his classes for Aurora, I am a long way away from being there.

edited: I will try it though as it will be a good excercise and maybe help in making that transition.

edited again: I printed out the source code, can't even remember the last time I printed out code from a printer to look at, anyways, I think I can really simplify the program dramatically, if some ideas work.
will post again soon

edited again: My idea didn't work, the idea was to just make one screen as a class. So I just tried to throw a rich edit onto the 2d screen, but you get this flicker, which makes sense as it is for doing quick flips of the screen buffers. I guess I could cut out the third window and make it part of the second window, so there would be 2 classes, will keep testing out ideas:)

Ionic Wind Support Team

Quote
Is there a place to get info on what is in the D3DX9 dll

There is no such thing as a 'd3dx9.dll'

Ionic Wind Support Team

kryton9

The dll that is used with Aurora for the directx stuff, that allows Aurora to use directx ?

Ionic Wind Support Team

dx3d9r.dll is the engine itself, which was written by me.   The 'r' stands for 'release' btw.  My private debug version is dx3d9d.dll

There is nothing there that isn't already available in the classes.   All 120 functions are supported by the 3D classes in Rev 7.  Rev 8 has 138 functions at the time of this post.

Ionic Wind Support Team

kryton9

Not unusual for me, I misunderstood. I thought there was a dll that as a developer you had to access to that would allow you to use directx9 without being .net compliant compiler. I never understood you were writing something from scratch. So does that mean that eventually there will be all the routines in the engine we could want? Do you have a list of what commands you plan on having at completion, even if they are not developed yet?

Thanks for your efforts. Now that I sort of see the light of OOP and Aurora, I don't want to go back to regular old style programming as in darkbasic pro and want to go all oop with aurora.

I started a game in dbpro, it will be a massive game, but made out of series of games that make up the whole. There will be different worlds, lots of stuff in space, lots of stuff on ground. It will be a relaxing game at times where you can just enjoy the scenery and look for certain things, then barter those for equipment etc. And then of course venture into space and even a fantasy type universe where anything can happen. I want this to be a project I work on the rest of my life and just keep adding to it. So I need a nice solid foundation to build on that can offer me the stuff I need to present my ideas.

I play games a lot and really enjoy the eye candy more than the actual game play in most of them. With the new nvidia card, unreal 2004 looks so different as does serious sam 2 compared to the ATI card. The same for Battlefield 2 and I haven't even reinstalled half life2 yet. I had bought it for the gateway, and the early levels ran ok, but it bogged down and so I just stopped playing wanting to appreciate its master artwork and game play. I am probably going to wait to play it still till I get my new video card, the same with Battle Field 2.

Anyways the point is playing those, I want to do things maybe not cutting edge but at least not too far back from those games as time goes on. So that is why I am so questioning about directx and what will be so impatiently.

Thanks for understanding and shedding any light on if all of this will be possible with Aurora and the engines you plan on developing.


Ionic Wind Support Team

Plans...hmmm.

I tend to work on one thing at a time in the engine.  Today was 3D sprites.  Next I might figure out some sort of particle system.  Other than that it is what the users request and what I have time for.

DirectX has always been a COM interface and you can access directly from Aurora with the right include files (see Sapero's win includes).  It is the D3DX9 utility library from the SDK that is difficult to access, and that contains the code for shaders, skinned X meshes, etc. 
Ionic Wind Support Team

kryton9

Paul, I wish I had your knowledge, but till I get close I will keep hammering away to dig what I can from you :)

By 3d sprites, do you mean billboarding and also the base for a particle system? I am drooling in anticipation.

I won't bombard you with a list till I see how you implement what you are doing and till I can get a graps of how to use what is there.
As Zumwalt is showing a lot can be done already that at the surface I never realized. And I still have no idea how your cube map example is working. So there are lots of mysteries already to work out. In the meantime I am going to get into the 2d as I sort of started on it.ÂÃ,  Already alot to play with and with your great ability to put out updates and new releases there will be plenty of more cool goodies to play with.

Ok, now another confusion to me. I saw Sapero's windows include files and also Parker and Zen's All common includes or classes, forgot the name at the moment. I didn't know if they were already a part of Aurora and if not how we know where to put and use them now? I tried once and messed up my Aurora files.

Rock Ridge Farm (Larry)

OK - got the main screen working - now my next issue.
I need to know how to create 2d sprites.
I am using the following ascii representations (this is from the ascii version of the game):

char shapes[5][8][5][6] = {
"  ^  ",
" /+\\ ",
" |+I ",
" |+I ",
" \\_/ ",

"   -/",
" /++|",
"/++//",
"|+// ",
" -   ",

"     ",
"/--\\ ",
"|+++>",
"\\--/ ",
"     ",

" -   ",
"|++\\ ",
"\\\\++\\",
" \\\\+|",
"   -\\",

" /-\\ ",
" I+| ",
" I+| ",
" \\+/ ",
"  v  ",

"   - ",
" //+|",
"//++/",
"|++/ ",
"/-   ",

"     ",
" /--\\",
"<+++|",
" \\--/",
"     ",

"\\-   ",
"|+\\\\ ",
"\\++\\\\",
" \\++|",
"   - ",

"  ^  ",
"  |  ",
" ||| ",
"|||||",
"\\|||/",

"    /",
"  // ",
"//// ",
"///  ",
"\\//  ",

"     ",
"/--  ",
"---->",
"\\--  ",
"     ",

"/\\\\  ",
"\\\\\\  ",
"\\\\\\\\ ",
"  \\\\ ",
"    \\",

"/|||\\",
"|||||",
" ||| ",
"  |  ",
"  v  ",

"  //\\",
"  ///",
" ////",
" //  ",
"/    ",

"     ",
"  --\\",
"<----",
"  --/",
"     ",

"\\    ",
" \\\\  ",
" \\\\\\\\",
"  \\\\\\",
"  \\\\/",

"  ^  ",
"  |  ",
"  |  ",
" ||| ",
"  |  ",

"     ",
"   / ",
"  /  ",
"//   ",
"//   ",

"     ",
" -   ",
"---->",
" -   ",
"     ",

"\\\\   ",
"\\\\   ",
"  \\  ",
"   \\ ",
"     ",

"  |  ",
" ||| ",
"  |  ",
"  |  ",
"  v  ",

"   //",
"   //",
"  /  ",
" /   ",
"     ",

"     ",
"   - ",
"<----",
"   - ",
"     ",

"     ",
" \\   ",
"  \\  ",
"   \\\\",
"   \\\\",

"     ",
"  ^  ",
"  |  ",
"  |  ",
"     ",

"     ",
"   ' ",
"  /  ",
" /   ",
"     ",

"     ",
"     ",
" --> ",
"     ",
"     ",

"     ",
" \\   ",
"  \\  ",
"   ' ",
"     ",

"     ",
"  |  ",
"  |  ",
"  v  ",
"     ",

"     ",
"   / ",
"  /  ",
" '   ",
"     ",

"     ",
"     ",
" <-- ",
"     ",
"     ",

"     ",
" '   ",
"  \\  ",
"   \\ ",
"     ",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

" xxxx",
"x\\-/x",
"x|o|x",
"x/-\\x",
"xxxxx",

};

kryton9

Larry do you want to keep the ascii look? Or do you want actual graphics to represent those? And if so, is there a graphical list that you referred to make your ascii equivalents. With that info I can help.

Rock Ridge Farm (Larry)

This is a game I wrote 20+ years ago - ascii was all there was.
I would like up-to-date fancy sprites. They must be scalable from the size of a . to the size represented above.

kryton9

Is there a page or website that would have the symbols you wanted. I can see some are arrows, but the other ones, I am not sure what they are. Is there a graphical non-ascii version of what you are after I can look at and also know which colors to use etc.

Rock Ridge Farm (Larry)

They are various ships from large ones to small ones.
There are 8 representations per ship by direction of travel - N, NW, W, SW, S, SE, E, NE.
The ship classes are:
   Mother Ship
   Battlestar
   Star Cruiser
   Light Cruiser


kryton9

Sorry I didn't get back to you sooner Larry.
With sprites you should be able to scale and rotate them, just checked the classes for 2D sprites and I see a setAngleD and setScaleFactor commands, so that will make it easier.

I will make a very simple sprites for you to get the discussion moving further within a couple of days.

kryton9

August 13, 2006, 04:59:36 PM #41 Last Edit: August 13, 2006, 05:01:28 PM by kryton9
Ok this is just a very simple start, because I am not sure what all is needed. I made just simple sprites for the 4 ship classes and also there is a yellow triangle indicating direction. Using the sprite commands you can rotate them to the directions you would like. I made 2 sets, red team and blue team. Hope it gives you something to play with as you develop your program.

These are no eye candy, so don't expect anything cool, I posted one of the bmp's so you can see nothing fancyÂÃ,  :)


Rock Ridge Farm (Larry)

Thanks - I hope to have time to play today - work has been a bear the last couple of weeks -
Auditors.
My goal is to have the main program up and running by the end of the week then start
converting the game logic.

kryton9

Take your time and enjoy coding, will be glad to test it as it comes along.