Game Development Community

Interior size?

by Stefan Beffy Moises · in Torque Game Engine · 04/24/2002 (10:09 am) · 22 replies

Got a little problem here: I'm working on rendering interior objects in Frank B's MapGui... and so far it works showing a little bitmap dot for each interior... but how do I get the size of the Interior object do draw a rectangle respresenting the object?
I'm using
...
if (shape->getType() & InteriorObjectType) {
   Point3F newCoord = shape->getPosition();
   Box3F shapeBox = shape->getWorldBox();
   F32 objX = shapeBox.len_x();
   F32 objY = shapeBox.len_y();
   ...
   // todo: scale object size down to fit in the mapgui
   dglDrawRect(RectI(newCoord.x,newCoord.y,newCoord.x+objX,newCoord.y+objY),mColor);
}
but I'm not sure that's correct..?!
And I'm not sure how to scale it down to fit the mapgui?
Anyone messed around with Frank's code yet?
Thanks!!
Page «Previous 1 2
#1
04/24/2002 (11:59 am)
Nevermind, got it working now... don't know if it's good (and for sure it ain't pretty - it's only rectangles, dude...), but now I got interiors in my map :-))
MapGui with Interiors
The effect can be better seen here...
#2
04/24/2002 (12:14 pm)
right on thats not to shabby (heh i coudnt even get the icon thingy to show up when i tryed that tut so i took it all aout)

a tip:

for the fps and date and time things ,,,if you remove the borders and the fill and arrange them in the main chat hud's empty space they wouldnt look so out of place

some thing like this
pic
#3
04/24/2002 (1:29 pm)
Very nice indeed, should be useful for a lot of people.
#4
04/24/2002 (1:48 pm)
Let me clean up the code a bit and I'll post it if you think it's useful... guess I will integrate it as a toggleable map like this... so it's much more useful and doesn't disturb the playgui... just have to play around with the design/colors... ;-)
#5
04/24/2002 (2:36 pm)
Well, should be okay now... I just integrated one more function / field to set a different color for the interior rectangles... you can see the 2-color version here and grab the source code here - simply follow Frank's tutorial on how to integrate the guiMapCtrl and then replace the .cc and .h files with my new ones, then adjust style and colors in the gui editor... let me know if it works for you and give credits to Frank for using it :-)
Hope you find it useful!
#6
04/25/2002 (8:43 am)
I would love it if you'd post this as a resource or code snippet.
#7
04/25/2002 (3:45 pm)
Just made a small update to the code, you can now switch between filled or outlined rectangles for the interiors... Here is a filled example.
As for a tutorial... maybe I'll find some time this weekend to document what I've done to get these interiors in (anyhow, it wasn't that much... shouldn't be too hard to figure out by reading the code and comments).
Would be cool to get the waterblocks in, too... but I've got no idea how to get their actual outline (position is no problem, but simply painting "water rectangles" wouldn't really look great ;-)... any ideas anyone?
EDIT: Updated the link to a more recent pic of the map gui...
#8
04/26/2002 (9:30 am)
Does the area that's displayed represent the mission area?
#9
04/26/2002 (10:14 am)
No, it shows the whole terrain file and scrolls as you move, so you can walk forever and still have the current region you're in and the nearby interior objects displayed... the little icon (plane) in the center shows the player's current position and orientation.
But maybe the outline of the mission area could be displayed, too... have to look into that, though...
#10
04/27/2002 (8:19 am)
Actually, I like the idea of displaying the mission area... guess I'll go ahead and include it, and maybe I can combine it with Matt's radar so that you can see the other players/bots on the map, too...
#11
06/06/2002 (2:12 am)
Nice work stephan. I take a look at this thread today. Did not know how I missed it ?
#12
06/06/2002 (3:52 am)
Well, it's not perfect, sort of a quick hack, and the scaling of the interiors is not really exact... but it works... feel free to improve it! :-)
#13
06/17/2002 (11:58 pm)
Nice :)

I urge you to make it a tutorial.

Mainly so i dont have to drudge through the forums to search for it in a few weeks when i integrate with a fresh build (going to have to go through every resource :)).

On a diff not im curious if its possible to adapt this into a 3d sense.

If you have ever played homeworld you would understand what im trying to ask.

in homeworld u can effectively zoom out from your current position but continue to rotate , zoom e.t.c

I was curious if a similar thing can be done. The screen would zoom out showing the whole terrain in 3d with ure players position relative to the terrain. Then having the ability to zoom focus and whatnot.

Just asking if its feasable with the current heightmap system ?
#14
06/18/2002 (12:01 am)
Frank, I've got one "problem", though...
the interirors I'm rendering have a different "zoom factor" than the terrain .... so as you move, the buildings "scroll" faster than the terrain in the background (which means everything is in the correct place relative to the player icon, but the interiors are not in the right place relative to the terrain...).
Maybe you could download the latest version here (I've changed/fixed some details) and try it out to see what I'm talking about....?
Where exactly do you set your "scale factor / ratio" for the terrain?
Thanks!
#15
06/18/2002 (12:08 am)
Ian, there are some folks trying to do this, check out this thread... they do it by simple rendering the whole scene in realtime from a fixed angle above the map - the only problem seems to be performance issues...
#16
06/30/2002 (11:36 pm)
"Problem" solved! Now the rendered interiors on the map have the same scale as the terrain, and they are always in the right position relative to the terrain.
Here is a new screenshot (the tiny little orange squares in the map gui at the bottom right of the screen - maybe you can see it better here) - you can grab the updated code file here.
#17
07/02/2002 (10:06 pm)
Another little update...
You can set a minimum threshold value and a "minInteriorScaleFactor" for interiors now - every interior smaller than this threshold value gets scaled by the minInteriorScaleFactor - don't know if that makes much sense, but I had some interiors that couldn't be seen at all otherwise...

I've also integrated some code to render the other players/bots (based on Matt Webster's cool RadarGui).
You can now set a boolean "renderPlayers" from script or in the GuiEditor - if you do,
you also need to set the path to another bitmap, "playerIcon", in the GuiEditor.
Here is a screenshot showing the new guiMapCtrl with the terrain, the interiors (orange rectangles), the player (green "triangle" bitmap) and some bots (green dots which are way too big for this, gotta make some new ones sometime... :-P )

This example gui is intergrated into the PlayGui directly, you could also make it bigger and use its own gui to turn it on/off etc.

Further improvements could be to make the overall scale changeable (terrain AND interiors - you can only scale the interiors' sizes atm), to really render the interiors' shapes/outlines instead of rectangles representing their overall sizes (don't know how you could do this, but maybe it's possible?), etc.
EDIT: Hm, maybe we could even "blown it up" to something similar to the command gui in Tribes 2?

You can get this little thing here...
#18
01/21/2003 (10:42 am)
all the links are gone could you repost it
#19
01/21/2003 (10:55 am)
Beffy's site has moved to here :
tork.beffy.de

You should find all that info somewhere there, you can even see parts of the old site in the archive...
hth
#20
01/24/2004 (12:38 am)
I can't find the mao HUD on the new site. Anyone have a link?
Page «Previous 1 2