Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » 3D Model

This thread is locked; no one can reply to it. rss feed Print
 1   2 
3D Model
Steve Terry
Member #1,989
March 2002
avatar

For some reason on my joystick it always reports a -1 value in the x direction until I press right, then it reports 1, so if I press nothing I always move left.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

gering
Member #4,101
December 2003
avatar

http://thegering.gmxhome.de/files/demo4.zip
fixes problem with joystick?? first level data

The boxes look very ugly... I would be very happy if someone could help me with it ;D

__________________________________________________________
[ FreeGameDevLibs ]

Steve Terry
Member #1,989
March 2002
avatar

Yep that seems to fix my joystick issue.

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

gering
Member #4,101
December 2003
avatar

You have an analog stick right?

__________________________________________________________
[ FreeGameDevLibs ]

Steve Terry
Member #1,989
March 2002
avatar

I have two kinds of controllers, one is a MS Force Feedback Joystick and the other is a GF PS2 nockoff type joystick with dual analog as well as the D-Pad. I'm not sure if allegro even handles analog through the joystick API but I'm acutally really curious as to what it can support, I mean my joystick contains about 12 active buttons, dual analog, and a d-pad, as well as dual shock, but I'm sure allegro doesn't have an API for the dual shock part, would be interresting if it did though :)

___________________________________
[ Facebook ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

gering
Member #4,101
December 2003
avatar

I am using windows joystick functions.

    if (joyNr < 0 || joyNr > 3) return 0;
    if (!isJoy[joyNr]) return 0;
    
    JOYINFO joyInfo;
    if (joyGetPos(joyNr, &joyInfo) != JOYERR_NOERROR)
    {
        isJoy[joyNr] = false;
        return 0;
    }

    if (joyInfo.wXpos < 16384) return -1;
    if (joyInfo.wXpos > 49151) return  1;
    return 0;

[EDIT]
http://thegering.gmxhome.de/files/demo5.zip
collision detection

__________________________________________________________
[ FreeGameDevLibs ]

Paul whoknows
Member #5,081
September 2004
avatar

Frames in PNG file format attached!
I was testing demo5 and WOW!:o, looks really cool!, collision detections works fine.
To avoid a 4-directions playability was a clever idea, it feels very different from a bomberman clone, too much better!
In demo5 shutdown error messages appeared only the first time I run the application.
They said something like "hWnd can't unregister some class", I don't remember now:D
EDIT:
Are you using some kind of circle-collision-detection? how it works? that is really good!8-)

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

gering
Member #4,101
December 2003
avatar

Thank you Paul - you are too good to me ::)

my collision detection is at moment only circle - but it should be circle/bounding box hybrid. Here is some code:

1void cPlayer::Collision()
2{
3 float dx, dy, d;
4 
5 for (int iy = 0; iy < LEVEL_HEIGHT; iy++)
6 for (int ix = 0; ix < LEVEL_WIDTH; ix++)
7 if (cGame::level.data[ix][iy].visible)
8 do
9 {
10 // calculate distance player <-> box
11 dx = x - cGame::level.BoxPositionX(ix);
12 dy = y - cGame::level.BoxPositionY(iy);
13
14 d = sqrt(dx*dx + dy*dy);
15
16 // is too near?
17 if (d < PLAYER_R + LEVEL_BOX_R)
18 {
19 // move away
20 if (dx > 0) x += abs(dx)/33; else x -= abs(dx)/33;
21 if (dy > 0) y += abs(dy)/33; else y -= abs(dy)/33;
22 }
23 } while(d < PLAYER_R + LEVEL_BOX_R);
24}

[EDIT]
NEW DEMO!
http://thegering.gmxhome.de/files/demo6.zip
8 directions:o, better movement

__________________________________________________________
[ FreeGameDevLibs ]

Paul whoknows
Member #5,081
September 2004
avatar

You're welcome, just let me know about your future releases!!!

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

Tobias Dammers
Member #2,604
August 2002
avatar

Quote:

I have two kinds of controllers, one is a MS Force Feedback Joystick and the other is a GF PS2 nockoff type joystick with dual analog as well as the D-Pad. I'm not sure if allegro even handles analog through the joystick API but I'm acutally really curious as to what it can support, I mean my joystick contains about 12 active buttons, dual analog, and a d-pad, as well as dual shock, but I'm sure allegro doesn't have an API for the dual shock part, would be interresting if it did though

Allegro in windows should support all joystick input windows can handle, that is, every control shown in your control panel should be accessible in allegro. If your joystick has 12 buttons and the control panel shows them all, allegro should find them. Allegro does not support joystick output (as in force feedback) though.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

gering
Member #4,101
December 2003
avatar

Has anyone ever used DevIL (OpenIL). I'm not getting it to work correctly. I need it for loading image files - I have rewitten my engine the past two days, to work with DevIL - and now I can load images without crash, but they get not scaled correctly... :'(

__________________________________________________________
[ FreeGameDevLibs ]

relpatseht
Member #5,034
September 2004
avatar

I've used devIL, but that thing is riddled with memory leaks and bugs, Im surprised you can get it to work without crashing, I couldn't.

Fladimir da Gorf
Member #1,565
October 2001
avatar

What's wrong with BMGLib?

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

gering
Member #4,101
December 2003
avatar

First I tried: "GD Graphics Library" http://www.boutell.com/gd/
But it has a bug in scaling (colors get wrong)

Then I tried FreeImage http://freeimage.sourceforge.net/
But can't get the .a file, only the .lib
(If someone can post me the .a, I can try again ;))

Now I am trieing DevIL http://openil.sourceforge.net/
But it's bugy, isn't it? Can't get it to work right... :'(

Quote:

What's wrong with BMGLib?

- It has no scale function.
I need to scale, because OpenGL textures must have a dimension of a power of 2. And I want to scale my image to the nearest power of 2 and draw it stretched. :-/

[EDIT]
An other solution would be to write my own scale function. Does anyone have some code??

__________________________________________________________
[ FreeGameDevLibs ]

relpatseht
Member #5,034
September 2004
avatar

well, as for the freeimage thing, since it is on sourceforge, you must have access to source, which means you can compile your own .a

gering
Member #4,101
December 2003
avatar

README.minGW said:

pexports freeimage.dll | sed "s/^_//" > freeimage_gcc.def
dlltool -U -d freeimage_gcc.def -l libfreeimage.a

I tried this, but pexports returns an empty file :'(
Can someone help me out??

__________________________________________________________
[ FreeGameDevLibs ]

Fladimir da Gorf
Member #1,565
October 2001
avatar

Quote:

- It has no scale function.
I need to scale, because OpenGL textures must have a dimension of a power of 2. And I want to scale my image to the nearest power of 2 and draw it stretched.

I wouln't recommend that. Instead use a larger texture than needed but set the texture coordinates so that it's properly rendered. Or you could just use OpenLayer for the heck of it - it looks like your game is in 2D anyways. And you'd get all the fancy stuff of OpenLayer as well and still you could type in your own OpenGL code anywhere in your code as you want!

So why to spend days do something you could do in 2 lines in OpenLayer?

Bitmap bmp( "gfx/mybmp.png" );
bmp.Blit( x, y, opacity );

(PS. If everything goes well OpenLayer 2.0 will be released today, with all the nifty new stuff!)

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

gering
Member #4,101
December 2003
avatar

Quote:

I wouln't recommend that. Instead use a larger texture than needed but set the texture coordinates so that it's properly rendered.

What if the png is one pixel lager? It's a waste of video-ram.
What does OpenLayer do if pixture is 800x600 (background image) but biggest texturesize is 512?

Quote:

Or you could just use OpenLayer for the heck of it - it looks like your game is in 2D anyways. And you'd get all the fancy stuff of OpenLayer as well and still you could type in your own OpenGL code anywhere in your code as you want!

I do like OpenLayer. But it's the firest time I'm coding my own engine, so it's part of the project, too. I thought at using OpenLayer for the visual part, but I decided to do it using OpenGL to learn a bit. ;)

__________________________________________________________
[ FreeGameDevLibs ]

Fladimir da Gorf
Member #1,565
October 2001
avatar

Quote:

What if the png is one pixel lager? It's a waste of video-ram.

Yeah, it is, but if it would be stretched 1 px smaller it'd look more "out of focus" and especially not exactly the same anymore as the game developer might have wanted. You could always stretch the images beforehand if you wanted. Adding an option to stretch the image would be quite trivial but I bet it wouldn't be used that much...

Also OpenLayer 2.0 uses non-power-of-two textures if they're suppoerted.

Quote:

What does OpenLayer do if pixture is 800x600 (background image) but biggest texturesize is 512?

Well, the texture would turn out completely white... Maybe OpenLayer should take that in account as well.

Quote:

I thought at using OpenLayer for the visual part, but I decided to do it using OpenGL to learn a bit. ;)

You could always use both or rip parts of OpenLayer you'd like to use inside of your own code. ;)

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

gering
Member #4,101
December 2003
avatar

http://thegering.gmxhome.de/files/demo7.zip
Rewritten image loading code - now using FreeImage, new level graphic :)

If someone downloads it, please tell me your cpu load when running the game, and what cpu you got.

__________________________________________________________
[ FreeGameDevLibs ]

Paul whoknows
Member #5,081
September 2004
avatar

It takes about 4 seconds to start the game, in my P4 2400, 128ram, fx5700le.
Sprites looks more "blured" now, I don't know if that is good or bad.

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

gering
Member #4,101
December 2003
avatar

I mean, while the game is running - how much CPU in [%] does it eat? (in Task-Manager). I am changing my code, to not down sample textures anymore, only if necessary.

__________________________________________________________
[ FreeGameDevLibs ]

Skalle
Member #4,139
December 2003

I tried your newest demo. I don't know much about my computer specs, but i can at least tell you this: It's about 2 years old. It didn't take long to startup, a couple of seconds. Task manager showed it used about 10% of CPU, under 15% most of the time, and occasionally 25% for some random stuff going on inside my computer.

About the sprite being blurry: if you are fine with this then nevermind. It shouldn't be as blurry if you could change the 40x70(?) png pictures to 64x64, because then OpenGL doesn't have to antialias them i think.

There is one thing you might want to get rid of too: the faint purple line surrounding the outline of the dude( if you will use this dude). If the artist, Paul right?, renders the 3d model, but without antialiasing there wont be the purple line. If you don't want the purple line but antialiasing then i think the OpenGL can fix that with filters or whatever. If you won't use this dummy dude at all, then perhaps you should keep this in mind anyway.

I wish you good luck with your game, I'll be back to check it out when you update :)

Paul whoknows
Member #5,081
September 2004
avatar

Quote:

how much CPU in [%] does it eat? (in Task-Manager).

min:12%, max%21%,

Quote:

If the artist, Paul right?, renders the 3d model, but without antialiasing there wont be the purple line.

Aliased front dummy animation:

http://www.freeimagelibrary.com/images/PaulPaul/dummyfrontaliased.gif

Looks blocky here, but inside the demo looks a bit better (I replaced these frames in demo7), however I don't see a big direfence, and there is still some pink/purple halo, how could that be?

Shutdown error messages:
Release device context failed!
Could not release hWnd!
Could not unregister class!

____

"The unlimited potential has been replaced by the concrete reality of what I programmed today." - Jordan Mechner.

gering
Member #4,101
December 2003
avatar

I am wondering about the shutdown errors:

1void Z::KillGfxWindow()
2{
3 if (screenFull)
4 {
5 ChangeDisplaySettings(NULL, 0); // switch back to the desktop
6 ShowCursor(true); // show mouse pointer
7 }
8
9 // is there a rendering context?
10 if (hRC)
11 {
12 // release the DC and RC contexts
13 if (!wglMakeCurrent(NULL, NULL))
14 {
15 MessageBox(NULL, "Release of DC and RC failed!", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
16 }
17 // are we able to delete the RC?
18 if (!wglDeleteContext(hRC))
19 {
20 MessageBox(NULL, "Release rendering context failed!", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
21 }
22 hRC = NULL;
23 }
24
25 // release the DC
26 if (hDC && !ReleaseDC(hWnd, hDC))
27 {
28 MessageBox(NULL, "Release device context failed!", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
29 hDC = NULL;
30 }
31
32 // destroy the window
33 if (hWnd && !DestroyWindow(hWnd))
34 {
35 MessageBox(NULL, "Could not release hWnd!", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
36 hWnd = NULL;
37 }
38
39 // unregister class
40 if (!UnregisterClass("OpenGL", hInstance))
41 {
42 MessageBox(NULL, "Could not unregister class!", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION);
43 hInstance = NULL;
44 }
45 
46 isInitOpenGL = false;
47}

anyone see smthing wrong?

NEXT DEMO:
http://thegering.gmxhome.de/files/demo8.zip
image is not scaled down to fit the texture, better collision detection :o

[EDIT]
other thread about BomberMan:
http://www.allegro.cc/forums/view_thread.php?_id=531297

[EDIT]
DEMO: demo9.zip

http://thegering.gmxhome.de/files/screenshot2.jpg
(demo9)

__________________________________________________________
[ FreeGameDevLibs ]

 1   2 


Go to: