AGS 3D

Started by DoorKnobHandle, Sun 15/05/2005 15:21:53

Previous topic - Next topic

Kweepa

#100
It shouldn't kill the framerate.
Most of the framerate drop that happens now (when a lot of spheres are thrown into the scene) is due to culling and clipping using the scripting language. If necessary I can optimise this with view frustum culling.

The best option would be perspective textured triangles. I'll check what Allegro has to offer.
I'm not sure I want to go that route (fully textured), but I guess it would be useful to texture map one side of a cube (for signs, posters, etc)...

[EDIT] Allegro has plenty of options (probably triangle3d() is the best). But part of the point of this 3d engine to see what can be done with AGS, not to start changing AGS to add features just to support it that would be no use to anyone else. And as you say, the graphics have an old-school charm that texture mapping might ugly up if overdone.
It is working out to be quite an easy way to make a 3d game though. AGS's scripting system is a beautiful thing.

Current todo list:
- player collisions
- primitives (cylinder :), hemisphere, toblerone, tetrahedron) [EDIT] done
- improve sorting
- inventory system (cycle with [ ] keys or mouse wheel, use with left mouse button)
- look at on right mouse button
Still waiting for Purity of the Surf II

GarageGothic

Quote from: SteveMcCrea on Wed 17/08/2005 15:44:57[EDIT] Allegro has plenty of options (probably triangle3d() is the best). But part of the point of this 3d engine to see what can be done with AGS, not to start changing AGS to add features just to support it that would be no use to anyone else.

Actually I had a hidden agenda asking this, as I could really use this kind of sprite deformation for my own shadowbox script :)

Nice to hear about the to-do's

DoorKnobHandle

Awesome ( needless to say, I think... :) ), this is going to be a great script module once it's ready, I sense...

Where do you take all the time to work on this, Steve? ;) An amazing update every night... :o

Anyways, keep it up.

HeirOfNorton

First of all, this is amazing!!!

Anyway, a couple of points to consider/ponder regarding texture-mapping...

I should like to point out that, in some ways, the AGS3D engine is in fact quite a bit more advanced than the the engines used in Wolfenstein3D and Doom. This is, afterall, a true 3D engine, while those were not. Internally, Wolfenstein and Doom were really just top-down shooters, and the programmers just used some tricks to render them in (apparently) 3D. The AGS3D engine is more like Quake, with a genuine bonafide 3D game world.

Having said that... While texture mapping may prove to be prohibitively difficult without some major additions to AGS itself, those same tricks that Wolfenstein and Doom used MIGHT be feasible. (I've already got a couple of ideas on how it could be implemented.) Doing it this way would have all the same limitations of those engines (and then some), and I'm not sure whether it could be integrated with the current AGS3D system, but it could be done. And look really cool...  ;D

Just something to think about

HoN

P.S. Hey, CJ, how high on your list of things to do is the possibility of creating a DynamicSprite from a PORTION of another image (instead of the whole thing)? While not completely necesarry for my upcoming experiments in the AGS-Wolfenstein engine (tm), it would make things much easier, and I know others would find it useful for their own projects.

Kweepa

You make a good point!
Doom-style texture mapping could be done, if you disable look up/down or use skewing rather than rotation for the look up/down.
It would be quite easy to import textures for experiment too - just use the tiled sprite import and select a one column tiling.
I look forward to seeing that!
Still waiting for Purity of the Surf II

Gregjazz

#105
Quote from: SteveMcCrea on Thu 18/08/2005 02:33:23
You make a good point!
Doom-style texture mapping could be done, if you disable look up/down or use skewing rather than rotation for the look up/down.
It would be quite easy to import textures for experiment too - just use the tiled sprite import and select a one column tiling.
I look forward to seeing that!


Right. How much would speed factor into that? I'm asuming then you'd have to split up a wall into columns for each pixel of the texture map.

EDIT: Whoops, that might not work very well... the texture map would have to be stretched/skewed to work properly. I shouldn't be talking about matters I know little about.

Kweepa

I think you have the right idea, Geoff.
For each column on the screen, you work out which wall can be seen, which column of the texture to draw and what height that column should be. Then use RawDrawImageScaled on the one pixel wide image that represents that column of the texture.
Alternatively you can, for each rectangular wall, work out the height of the wall at each end. Then for each screen column, interpolate the height and the texture column and draw with RawDrawImageScaled. Done.
Still waiting for Purity of the Surf II

Gregjazz

Quote from: SteveMcCrea on Thu 18/08/2005 05:58:43
I think you have the right idea, Geoff.
For each column on the screen, you work out which wall can be seen, which column of the texture to draw and what height that column should be. Then use RawDrawImageScaled on the one pixel wide image that represents that column of the texture.
Alternatively you can, for each rectangular wall, work out the height of the wall at each end. Then for each screen column, interpolate the height and the texture column and draw with RawDrawImageScaled. Done.

So then columns of the wall on the screen would have to reuse some of the columns from the texture map in order to stretch its X axis, correct?

Kweepa

Yes, that's right.
Look closely at the left hand wall here.

You can see that each column is a scaled up column from the original texture, drawn half above the centre of the screen and half below.
You can download the original Wolfenstein3D source code (and of course the Doom source code) from iD to see exactly how JC did it.
Still waiting for Purity of the Surf II

Gregjazz

So then it seems like until AGS has better image manipulation functions (or a graphics accelerator), pretty much the realistic way to go would be the wolfenstein/Doom method, where textures are observed from only certain angles. Okay, I understand the situation better now, thanks.

Gilbert

Hehe, since technically each sprite is a rectangle, if we have something like the following function we can do many more things:

RawDrawSpriteInterpolated(int slot, x1, y1, x2, y2, x3, y3, x4, y4)
which is to draw the sprite by interpolating (linearly) it's four corners Upper-left, Upper-right, Lower-right, Lower-left into a qualateral defined by room coordinates (x1,y1), (x2,y2), (x3,y3), (x4, y4) respectively.
Of course the scaling won't be correctly following perspective but would make some nifty effects easy to do I think.

* Gilbot V7000a is just day dreaming while at work.

Kweepa

Since Allegro has such functions, with perspective correction, we could even have
RawDrawSpriteInterpolatedPerspective(int slot, sx1, sy1, sx2, sy2, sx3, sy3, sx4, sy4, float z1, z2, z3, z4);
Where the x and y are screen coordinates and the z are distance of the point from the screen.
Still waiting for Purity of the Surf II

Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

Quote from: SteveMcCrea on Thu 18/08/2005 14:58:57
RawDrawSpriteInterpolatedPerspective(int slot, sx1, sy1, sx2, sy2, sx3, sy3, sx4, sy4, float z1, z2, z3, z4);
Where the x and y are screen coordinates and the z are distance of the point from the screen.
But then CJ has to update the engine so a function can take more than 10 parameters, or am I lagging behind? ;)

Kweepa

Doh! :=
Ish, nice blimp!

For an update, I'm making some internal changes to the engine
- already changed the camera over to cache a transform matrix
- now improving the sorting to find the best dividing plane between primitives
Still waiting for Purity of the Surf II

Kinoko

Wow, this is some amazing stuff!! I havent read the entirety of the replies to this thread so someone might have mentioned it before, but you could totally make a Hunter style game (used to adore that game...) with this.

Good luck with further improvements!

Gilbert

Actually I'll suggest making a window for Scid's bar, it'll be cool if you can see outside from within it, all you need to do is to make a wall into 4 rectangular blocks...

Rui 'Trovatore' Pires

I've been having fun with it, I think it's trés kewl - I'm amazed at how big the "floor" can be, allowing for quite huge spaces!

I just thought I might as well ask about the feasibility of some things - feasibility, mind you. Like, "d'you think it'll ever be possible". Apart from collision detection, will it ever be possible to move the cubes/pyramids/whatever, or the characters/objects? Like a character walking someplace, or moving a cube back and forth. And d'you plan on making a way to allow the polygons to be hotspots, like that disco ball being a hotspot?
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

Gilbert

Quote from: Rui "Brisby" Pires on Fri 19/08/2005 08:43:03
Apart from collision detection, will it ever be possible to move the cubes/pyramids/whatever, or the characters/objects? Like a character walking someplace, or moving a cube back and forth.
Heh, why not? You can move/scale/colour the primitives in edit modes already.

Rui 'Trovatore' Pires

#119
Whee! :)

EDIT - Another optional goodie thingy would be to allow a mouse cursor. You know, cross-hairs, or a REALMyst-style-hand. I tried just setting an image to the WALK mode, but it jittered a lot as the cam moved.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk