Page 1 of 1

Game Development : 3D engine

Posted: Fri Oct 06, 2006 2:24 pm
by dc0d32
Hi,


i am developing a 3D game engine. i had coded a very simple 3d engine last year, but it could not handle mesh, lighting, texturing etc. Now that my coding skills (should) have sharpened, i have started thinking about those complex things.

the first and one of the most critical problems is about the data structures for storing this mesh and texturing info etc so that accessing and transformations are quick.

Another problem is that my friends may use this for any kind of game. So i need to make it as generic as possible. although the configurable parameters will be decided among us, can someone enumerate all such parameters that you would like a readymade game engine to support (for whatever 3d game types)?

how about modeling the actual game? should that be done using something like a world editor, or script that gets interperted or compiled (and probably optimized).


i am a part of the college game devel team. we plan to take part in various game devel competitions.

the (only) restrictions we have are
- do not use any 3rd party libraries, specially display libraries (and as it follows, no DirectX or OpenGL)
- all the rendering routines have to be custom
- language : c/c++ and assembler.

(this topic should have been in the SCI etc section. but since i am right now concerned about very low level rendering part, i ask it here)

thanks in advance.

Re:Game Engine : Representing 3D objects and ....

Posted: Sun Oct 08, 2006 9:12 am
by dc0d32
i do not really know how windows handles display. can someone explain that?

can i get access to or call ioctl on the display driver device? is there any way to access the device (something like \Devices\PCI\VGA0 or something)? Any API calls? Undocumented?

how do i access a device in windows? I know the NT Object model, but can't find API to do the job....

How does DirectX invoke the driver? how does it use the acceleration provided by the driver(not really)? i'm sure there is a well defined interface a dispay driver must follow for DirectX to take services from it. I dont know what.

(I can afford to limit my game to Windows NT)


please, please, please help.

Re:Game Engine : Representing 3D objects and ....

Posted: Mon Oct 09, 2006 10:48 pm
by Ytinasni
To draw to the screen in windows (9x and NT variants), you use one of 5 methods:
- The Window functions
- GDI (and GDI+)
- Direct3D
- OpenGL
- Direct Driver Access

I'm not sure how far you're going with 'no third-party apis', but i'll assume no Direct3D and no OpenGL.

The window functions are limited to the 'standard' windows controls (windows, buttons, text-boxen, etc).

Direct Driver access works if you know what the ioctls and the device to access are, and those differ between driver versions, not to mention different vendors. They are generally undocumented.

That leaves GDI, which is fine for 2D graphics but tends to fall short in that it is a 2D, not a 3d one. As such, the hardware acceleration on the gdi functions tends to be rather limited.
How does DirectX invoke the driver? how does it use the acceleration provided by the driver
Direct3D and OpenGL invoke the driver via an extra module that is supplied by the vendor and linked into the Microsoft D3D or GL frontend. I dont know of any way to get access to info about that without paying Microsoft.

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 3:02 am
by Pype.Clicker
in most cases, the vendor driver will by itself export its functions as D3D or GL ... sometimes those function calls are directly translated into device-specific I/Os, sometimes they are broken down in several lower-level device-specific I:O (and people say the feature is "emulated in software").

Other parts of e.g. an OpenGL library is the GLUT (utility toolkit) which, e.g. allows you to quickly create a sphere, a mesh out of bezier/NURBS, etc... in a device-independent way. And you could very well decide not to use it (they are typically offered through a separate library as the GL "core").

So if you want to talk directly to the hardware without GL and D3D, you'll be very much stuck like OSdever's are as there is no (except for very specific devices) common way to achieve that.

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 8:56 am
by ark
do not use any 3rd party libraries, specially display libraries (and as it follows, no DirectX or OpenGL)
Is this a restriction imposed by the competitions or by you and your friends on yourselves?

Without those graphics libraries, you're doomed to the same kind of nonsense that plagued computer programs in the DOS days: having to provide your own driver for every type of hardware that you intend to support. I would have to wonder what kind of game development competition would make you focus on super low-level things that are increasingly irrelevant to game developers - libraries like DirectX and OpenGL exist primarily so that game developers can forget about that kind of stuff for the most part.

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 9:27 am
by dc0d32
Joel wrote: Is this a restriction imposed by the competitions or by you and your friends on yourselves?
No. The competition needs that.
Joel wrote: Without those graphics libraries, you're doomed to the same kind of nonsense that plagued computer programs in the DOS days: having to provide your own driver for every type of hardware that you intend to support. I would have to wonder what kind of game development competition would make you focus on super low-level things that are increasingly irrelevant to game developers - libraries like DirectX and OpenGL exist primarily so that game developers can forget about that kind of stuff for the most part.
I would love to go for Direct3D. But then, rules are rules. About the low level thing, the part of the world where i live actually does not try to move forawrd quickly. They are still stuck with the Borland VGA graphics libraries provided with Turbo C++ 3.1.
Unfortunately, i was asked to do my CG assignments using those libs. They say that they are not testing how good you are at 'game' development, but how you 'develop' the game. Crap. We plan to give them both. :)

-----------------------------------------


as far as i know, GDI supports 2D hardware accelerations (surprisingly though, GDI+ does not!). But i dont know how it will fare coexisting with other 'windows', which try to repaint themselves (or i can go for full screen mode). Again, i will be trying to make a new 3D engine on top of the basic 2D hardware accelerated GDI.

Does that sound good? i doubt.

----------------------------------------

By any way, can i trigger 'int 10h' in userland? Tell the Driver to shut up while i'm here, and kinda map the LFB into my address space and things (i know that isn't normal, and path is full of pits).



Thanks.

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 11:51 am
by gaf
Is this a restriction imposed by the competitions or by you and your friends on yourselves?
No. The competition needs that.
Any idea why they asked you not to rely on libraries ? If the point is just to avoid that some high-level library is used as does half of the work for you, basic OpenGl/DirectX might still be permitted. In case that you're supposed to write your own 3D routines, you might still use DirectX or OpenGL for 2D hardware acceleration. If 3rd party libraries are however forbidden altogether, you'll have no other choice but returning to the Borland VGA library as GDI is also a 3rd party tool.
They say that they are not testing how good you are at 'game' development, but how you 'develop' the game. Crap. We plan to give them both.
If they're not interested in eye-candy, you probably shouldn't waste too much on implementing some fancy hardware acceleration. That might also be the reason why you've been told to use Borland's acient VGA library: Focus on the actual game and add some nice graphics if you happen to have some time left at the end of your assignment.

regards,
gaf

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 12:05 pm
by dc0d32
GDI is not a commercial rendering libary i guess. Although third party, it is the basic thing you need to draw anything in windows, analogous to the Borland Library as a basic thing to draw dots on the screen in DOS. My platform just happens to be windows. It should not create trouble imo. But thanks for pointing that out. I'd better ask the management for that. :)

and if they turn down windows, i still have the option of DJGPP, and using accelerated 2D(VBE3.0 i guess).

------------------------------------

coming back to the original thing,

how do i store things?
How do i model the game ie. the arena, players etc.
Should i go for a script like SCI? or make a new game frontend each time i need to create a new game?

Re:Game Devel under Windows NT

Posted: Tue Oct 10, 2006 1:23 pm
by gaf
Although third party, it is the basic thing you need to draw anything in windows, analogous to the Borland Library as a basic thing to draw dots on the screen in DOS.
But GDI does come with a lot of little helper functions that are supposed to make programming a tad easier (f.ex. bitmap loading). If you're supposed to build an engine from the ground, you're probably not even allowed to use such basic tool classes.

Apart from that GDI is not really known for its great speed. In fact it's poor performance was one of the reason why game developers sticked to DOS as their platform even when windows was already quite popular.

If you're allowed to use GDI then there also shouldn't be any problem with using DirectDraw or Direct3D for 2D. From what I can tell they just don't want you to use any additional functionality apart from the primitive drawing functions..
How do i model the game ie. the arena, players etc.
Maybe you could use blender to create the models ?

cheers,
gaf

Re:Game Devel under DOS

Posted: Wed Oct 11, 2006 12:03 pm
by dc0d32
after comparing the GDI with my simple dumb LFB, hand coded non-accelerated graphics primitives, for now, i shall stick to DOS and good-old djgpp.

i was unable to enable 2D acceleration. The function pointers in the structure are all null, but i know for sure that my card supports 2/3D acceleration [S3ProSavageDDR266]. i followed the instructions exactly as told in Ralph's list.

does anyone have a working code to enable and use 2D accelerated functions, preferably in djgpp? i see no point in reinventing the wheel.

@gaf : is the source format supported by blender - the 3D studio format, compatible with the 3DSMAX source? Because i had done some search and some work is going on in parallel to use scenes modelled in 3DSMax. Being free, blender looks a better option though.

Re:Game Development : 3D engine

Posted: Thu Oct 12, 2006 11:28 am
by gaf
I was unable to enable 2D acceleration. The function pointers in the structure are all null, but i know for sure that my card supports 2/3D acceleration [S3ProSavageDDR266]. I followed the instructions exactly as told in Ralph's list.
I guess you've tried to setup VBE/AF ? According to the documentation only banked modes are supported by the driver and the VESA 2.0 interface must be used.
Is the source format supported by blender - the 3D studio format - compatible with the 3DSMAX source ?
I'm afraid you're asking the wrong guy ;). Maybe this thread from the blender board is of any help ?

regards,
gaf

Posted: Tue Oct 24, 2006 11:31 am
by dc0d32
as i found out, VBE/AF standard never came up to be readily usable :(
i shall stick to the good-old dumb LFB with page flipping.

I am thinking of making the game, ie. porting the game on to my kernel, since DOS gets me no services other than the filesystem and being a host for DPMI. Functionality of both can be implemented into the kernel easily(if it has to be) or the game will run as a normal application. what i gain more is the pure and custom 32bit pmode, inherent multithreading, strong keyboard and mice support(since i have the driver architecture quite built up), and if required, custom video drivers (taken from the linux sources), sound cards, networking and what not.

Sounds better, doesn't it?