Just my luck...
I was going to suprise you with a fully movable bot(point,click,it moves there and adjusts itself on the Y axis, tilting so it doesnt intersect the ground), using a box mesh in place of a real bot until we get meshes...
Printable View
Just my luck...
I was going to suprise you with a fully movable bot(point,click,it moves there and adjusts itself on the Y axis, tilting so it doesnt intersect the ground), using a box mesh in place of a real bot until we get meshes...
Well you can try to implement it with Nemo (it allows direct access to DX :))
The 2 terrain systems are completely different, I added in a function called YIntersect which returns the height of the terrain at a specified X,Z coordinates making it much easier. Also I think I figured out how to use base map's and detail maps.
Edit: Map/mesh vertices have nothing to do with DirectX unless I want to render them. :ehh:
Depends, considering Nemo supports it's own class of mesh(es?). If you use your own method for creating the vertices you'll probably would need to directly implement them via DX instead of Nemo.Quote:
Map/mesh vertices have nothing to do with DirectX unless I want to render them
And that would mean Nemo cant work with them, that would be a problem.
No, thats why you would just have to use the NemoMesh and such :P
Thus limiting me to all the things I have planned for terrain... :(
Thus limiting me to not having to debug/make your code readable. Correction; Making your code actually compile -.-
I'd rather stick to something that's tried and tested and actually works on 99,9% of all computers :P
Edit: Gee.. 1 neg rep. report on this one. Without description and such.. Since it isn't Cade who did it.. I wonder who :p
ToDo for 9/6/2005: Content-Creation-Day :)
- Getting a mech mesh in-game.
- Key handling / Mouse moving the mech
- Added physics to Mech (using CarPhysics of NemoX)
- Getting a start on the Widget/Menu handler class.. (P.I.T.A.)
- Upgrading script engine so in-game scripts can be run for triggered things like the Tutorial (SP)
- Loading, Splash, Main menu, Credits, Multiplayer-New, Multiplayer-Join, Tutorial-Start screens. (Might be Mock-first)
Partial Menu Widget XML.
Going to work on actually using this tonight :)
Code:<!-- GUIMenu_MainMenu plus Children -->
<?
<MWBG>
<!-- MAIN -->
<Menu ID="GUI_MainMenu">
<Background>%FS_TEXTURES%\Menu\MainMenuBG.jpg</Background>
<DefaultCursor>%FS_TEXTURES%\Menu\Mouse_norm.jpg</Cursor>
<ImageMask>FF00FF</ImageMask> <!-- Purple -->
<BackgroundMusic Loop="Yes" RestartOnMenuChange="No">%Fs_MUSIC%\Menus\Theme.mp3</BGMusic>
<Font>Impact</Font>
<FontShader>%FS_SHADERS%\Menu\Metal.shader</FontShader>
<Widgets>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_Tutorial">
<Text>Tutorial</Text>
<Location XAlign="Middle">0,200</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_JoinServer">
<Text>Join Server</Text>
<Location XAlign="Middle">0,250</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_CreateServer">
<Text>Create Server</Text>
<Location XAlign="Middle">0,300</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_Options">
<Text>Options</Text>
<Location XAlign="Middle">0,350</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_Quit">
<Text>Quit</Text>
<Location XAlign="Middle">0,400</Location>
</Widget>
</Widgets>
</Menu>
<!-- OPTIONS -->
<Menu ID="GUI_Tutorial">
<Background>%FS_TEXTURES%\Menu\MainMenuBG.jpg</Background>
<DefaultCursor>%FS_TEXTURES%\Menu\Mouse_norm.jpg</Cursor>
<ImageMask>FF00FF</ImageMask> <!-- Purple -->
<BackgroundMusic Loop="Yes" RestartOnMenuChange="No">%Fs_MUSIC%\Menus\Theme.mp3</BGMusic>
<Font>Impact</Font>
<FontShader>%FS_SHADERS%\Menu\Metal.shader</FontShader>
<Widgets>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_ControlsOptions">
<Text>Control Setup</Text>
<Location XAlign="Middle">0,200</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_VideoOptions">
<Text>Video Options</Text>
<Location XAlign="Middle">0,250</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_SoundOptions">
<Text>Sound Settings</Text>
<Location XAlign="Middle">0,300</Location>
</Widget>
<Widget Type="Button" OnClickScript="" OnClickMenu="GUI_MainMenu">
<Text>Back</Text>
<Location XAlign="Middle">0,300</Location>
</Widget>
</Widgets>
</Menu>
</MWBG>
?>
Gimme a yell if I missed something important ;)
Code:Usage of the GUI XML file..
All the GUI Menu attributes should be under
<MWBG><Menu ID="*">
The ID of the Menu gives it a tag that can be access with the OnClickMenu of buttons.
Menu Properties
- Background
The background property specifies a background that will be rendered when the menu is active.
The value is just a location to the texture. Background has one parameter 'Resize' which if set to "Yes" will
stretch the texture to fit the screen, if set to No it will center the image.
- DefaultCursor
Set the default mouse cursor image.
- ImageMask
Set the masking color (transparent color) of an texture. Default is 0 (Black)
- WidgetGraphics
Set the directory where widget graphics can be found.
Requires Theme.cfg to set the properties of the widget.
- BackGroundMusic
The music that will play on the background while the menu is active. the Music value is the location of the file.
Properties are: Loop and RestartOnMenuChange which both are self-explanatory. (Yes or No as value)
- SoundEvent
This is the SoundEvent. When the mouse is over the button or object and when it's clicked it can generate
a sound event. SoundEvent doesn't have a value. Just 2 parameters called OnHover and OnClick both values are
filenames to wave files.
- Font
Set the default font for buttons (TTF or Bitmap font). Font Value is the name of the font or path to the font. Font only supports one paramter called Shader which allows setting a shader to be overlapped on the font texture.
- DefaultMenu
Set the Default menu when the user presses escape. Normally this should be the parent of the menu.
- Widgets
The Widget group is a certain object that will be rendered on the screen. There are several different types of
widgets available in the GUI Class.
Parameters for Widget-tag
Type - See below
OnClickScript - On click on the widget it will fire this script.
OnClickMenu - On click on the widget it will fire a MenuChange with the value.
(OnClickMenu="GUI_MainMenu" or.. OnClickScript="C:\Script.cfg")
Visible - Set the visiblity of the Widget. ("Yes" or "No")
Transparency - Set the transparency of the object: Default = "0"
Types:
Button - Can be clicked to initiate a menuchange or script start.
TextBox - A textbox where the user can fill in his own text.
ListView - To show multiple data with columnheaders that can be sorted.
Slider - A horizontal slider for change high-value data the easy way.
Image - A image that can be changed.
CheckBox - A Checkbox
Hidden - A hidden widget to store temporary data.
UpDown - A up down value widget for when a slider isn't good enough.
ListBox - A ListBox
ComboBox - A ComboBox
The following Child properties are supported
Text - For buttons and such this will set the text.
Location - Set the location of this widget based upon X,Y Pixel coordinates with a few extras.
(No Default, Value = X,Y) - Location has 4 parameters called XAlign, YAlign, XOffset, YOffset
which support the following values.. XAlign: Left, Middle, Right. YAlign: Top, Middle, Bottom
XOffset has a value of which the L,M or R gets offset by X amount of pixels. The same goes for
YOffset.
Variable - Set a Keyholder variable for this widget. If the value changes on the widget it will
save it's value to the specified key.
InitValue - Initial value for the widget. If Variable is used in this widget it will take that value.
DefaultValues - Allows to set a default value for this widget (doesn't work with Buttons and such). For
listviews these values should be comma-delimited.
Columns - For the listview. This allows to set the columns for the listview. Comma-delimited.
Extra commands for the script engine, No doubt I'm missing a few I'll need later on.. :]
Code:Additional Script commands MWBG:
These script commands are to be used for in-game. Usage outside in-game state might give a few errors or 'problems'
Generic Functions:
- Echo(TextString) : Shows a message on console/top screen.
Actor Support Functions:
- SetWayPoint(WayPointName, X, Y, Z) : Set a waypoint.
- FireAtLocation(ActorName, X, Y, Z, AllowMove) : Actor will try to fire at location (AllowMove = "YES" or "NO")
- FireAtTarget(ActorName, Tag) : Actor will try to fire at tag (could be an actor/object etc)
- MoveActor(ActorName, X, Y, Z) : The Actor will walk to the designated area (Walk on it's own speed)
- MoveActorToWayPoint(ActorName, WaypointName) : The actor will walk to the designated area (set by waypoint)
- TeleportActor(ActorName, X, Y, Z) : Teleport Actor to destination
- TeleportActorToWayPoint(ActorName, WaypointName) : Teleport Actor to destination waypoint
Map Support Functions:
- SetHighLight(KEY, X,Y,Z, RGB-LONG, RADIUS) : Sets a bright spot at location, RGB-LONG = color, Radius is the radius in
units.
- RemoveHighLight(KEY) : Remove the Highlight location
- FadeOut(Seconds) : Fade out in Seconds
- FadeIn(Seconds) : Fade in in Seconds
- MoveCameraTo(X,Y,Z) : Move the camera to the location
Media Support functions:
- PlayMovie(MovieName, AllowCancel) : Plays movie and waits till it's finished. AllowCancel is "YES" or "NO and
allows player to press mouse or spacebar to cancel the movie and proceed.
- PlayWave(WaveName) : Plays a wave file
- PlayWaveEx(WaveName, ActorName) : Plays a wave file originating from an Actor class (3D sound)
Btw, I just realised, what do we need pathfinding for if the terrain is just terrain? Any obstacles could be avoided using locomotion instead.
AI..
Certain missions involve AI NPC and of course the tutorial though that part could be 50% scripted =)
But pathfinding vs locomotion? Pathfinding is a massive grid of nodes, locomotion is if there is an obstacle infront, turn and keep walking, when its gone(some distance between AI and obstacle), turn back.
Not everything is an obstacle yet it's still impossible to walk upon (Downhill/Uphill at sharp angle). Locomotion would only work for basically straight lines from A to B with a few obstacles in the way. Pathfinding is like you said a massive grid of nodes with scores attached, thus it will take a certain path from A to B with a small randomizer so it doesn't take the same path over and over again.
Pathfinding works better on terrains as it's not allowed to walk on all 'tiles' so to speak.
Loading Mock.
Are you sure you don't want to make some menu stuff for D# too..:D
- ØØ -
Feel free to throw a pm or mail with what ya need, I'll see what I can do :)
Thanks. We will see what we need first. Wossy has all ready started on it. So we will see how that turns out. Thanks
- ØØ -
For waypointing, I would use the method created by CountFloyd, in PODBot. Basically, they are a 3D version of Dijkstras (sp?) pathfinding algorithm. They are coordinates, and they have pathways to different nodes. Usually theres a maximum of 4 or 5 so the pathfinding doesn't take too long (and doesn't look to unrealistic). Theres also wayzones. This is basically a random radius around the node, which is where the character can move through.
-----|------
-- = wayzone
| = node
The bot can chose to go straight through the node, or anywhere within the wayzone. When I get my PC I'll redownload the PODBot source, and see if I can't re-invent it for this. Its a really good (if not, still basic) way of doing it.
chem
Sounds good, so no PC yet huh? :P
No :mad:
I'm really starting to get annoyed with mum. Meh, serves me right for being 16 eh?
:|
chem
heh, kiddy ;)
:wave:
Hey, that really does look nice. Is that texture stolen from Counter-Strike? :p
I might have someone who can model. A friend of mine's brother is taking a Game Design course and from what I've seen is pretty handy with 3D studio max.
I'll ask him..
chem
No, freeware texture from TurboSquid :)
Hey, Devion, how will we animate the .x meshes?
Edit #1. I have made a .x rendering class that provides the most basic rendering functions right now, only load and no render, no translate/scale or matrixes. This edit is #1 because I might have more to add ;)
Edit #2. A textured, unanimated .x mesh can now be rendered, translated(moved around), scaled and rotated on any axis.
Edit #3. The bot mesh is now affected by ambient lighting. It seems with no lights, the entire bot mesh is pure white so the texture looks wierd, but with lighting enabled and ambient lighting set to 255,255,255, the bot mesh changes colors to what the designers wanted it to be. I have normals in place, so adding lighting is a fairly easy task. I'm right now, experimenting with stencil shadow volumes...
Check the frames inside the .X, should be something there regarding animation
It might have in the .3ds, but it doesnt seem to in the .x which I converted from the .3ds
I have uploaded the latest version of the terrain rendering source to the ftp. All files and stuff are in their relative directories in the zip. I also unzipped and tested running the .vbp file, runs and compiles fine. I've made some additions you might like, such as the settings window.
Edit: If you Alt+Tab in fullscreen, the exe will crash with an Automation Error, this is because I have not implemented the ability to reset a lost device.
Time to call it a day, I'll get back to you tomorrow with Alt+Tabbing in fullscreen. Btw, handling the resetting of a lost device is more decent than your idea of blocking alt+tab entirely... :p
I'll take a look at it tonight :)
I have gotten fullscreen to support alt+tab to some extent, but d3ddevice.reset is pretty much something of chance, so if you alt+tab out and alt+tab back now, the exe doesnt crash, I can make it do 2 things
1. Keep resetting and reloading the renderer in an endless loop
2. Keep rendering and bieng drawn over another window even if your mouse/keyboard input go there. Bleh... no alt+tab for now
I have gotten a mesh ingame and YIntersect with the terrain working (Don't use the YIntersect code on the ftp, it is completely different and doesnt work properly). I will not post a screenshot/upload any code until I get this fully working... :D
k :]
Here's a quick glance at the tutorial script I'm working on a bit.. basically all the maps will also work kinda like this.. using script inside XML to call upon creating actors and such based on triggers with as default one trigger that will initiate when the map load is complete.
Edit: Removed Map Script as it didn't actually resemble the commands below.
Code:Script commands
FadeIn;
FadeOut;
Fade in and Fade out will make the screen go black for a second. FadeIn and Out support one parameter to set the interval
Without it defaults to +/- .5 second.
LockActor;
UnlockActor;
Lock or unlocks the actor in place. No movement will happen. Normally used for the player not the AI.
KillActors;
Kills all known instanced actors.
KillActor;
Will kill an instance of the Actor. The parameter is the keyname of the actor.
InitActor;
Create an Actor.
There are several parameters for this function.
InitActor("A", "B", "C", "D");
A: Keyname of the actor.
B: Visible name of the actor.
C: Template of the actor.
D: Template deviation. "Default" is standard template.
Ex.
InitActor("AI_MECH_AVALON", "Enemy AI", "MECH_LOCUST", "LOCUST_RANGE_ATTACKER");
In this example we make the Actor called 'Enemy AI' with the key 'AI_MECH_AVALON', which it can be spoken to by other functions.
The Type of this actor is MECH_LOCUST which will load it's mesh, soundbase and so on. The 'LOCUST_RANGE_ATTACKER' is a deviation
and will require a mech lookup of which weapons and such it requires (It deviates from default).
SetActorPosition;
Set the position of a certain actor. First parameter is the Actor Keyname, second, third and fourth are the X, Y and Z locations.
SetActorGroup;
This allows to set a groupkey which can be spoken to for easy manipulation of several actors at once.
It allows countless parameters but the first two should be:
SetActorGroup(GroupKeyName, FirstActorKeyname, SecondActorKeyname, Third, etc etc);
SetScriptTrigger;
When a condition is met by SetScriptTrigger is will execute a script it points to.
SetScriptTriggerToGroup(GroupName or Actor Key, Script to Point to, ConditionToMeet, Who);
The only interesting part of this function is the 'CoditiontoMeet' as it requires a small script to check and return if
the condition is met.
These scripts are set also by Keynames... A few that could be used:
'TOUCH_ALL_ACTORS'
'TOUCH_ONE_ACTOR'
'IN_RANGE_OF_ACTOR'
'ALL_DESTROYED'
'ONE_DESTROYED'
TOUCH_ALL_ACTORS would be met when the 'Who' key touches all Actors in the group.
TOUCH_ONE_ACTOR would be met when the 'Who' key touches at least one actor in the group.
IN_RANGE_OF_ACTOR would be met when the 'Who' key comes close (<100 units) in the group.
ALL_DESTROYED would be met when the 'Who' key destroys all actors in the group.
ONE_DESTROYED would be met when the 'Who' key destroys one actor in the group.
VoiceEcho;
Voice echo is namely used for the tutorial. It allows a dialog to be shown and also play a wave.
CreateObject;
Allows the creation of simple objects on the terrain. Used for trees, crates, etc. No Interaction is possible except destroying it.
Usage: CreateObject(Key, TypeClass) { CreateObject("ABox", "OBJ_CRATE5"; }
KillObject;
Allows the deletion of a simple object.
Usage: KillObject(Key) { KillObject("ABox"); }
SetAI;
Sets the AI for a certain Actor class.
SetAI(ActorKey, Standing, Stance)
Ex. SetAI("AI_James", AI_FRIENDLY, AI_DEFENSIVE);
or.. SetAI("AI_JAMES", AI_HOSTILE, AI_AGGRESIVE);
This function works remarkably well with triggers for instance if the player fires upon an AI that's friendly which will turn it hostile.
UnSetAI;
Removes AI settings from Actor.
SetPlayerActor;
Sets the player Actor, requires ActorKey.
Ex. SetPlayerActor("Me");
CreateWayPoint;
Ability to create waypoints used for other functions.
Ex. CreateWaypoint(WayPointName, X, Y, Z);
ActorCommand;
Some Actors have commands in their classes. With this function they are accessible..
Ex. ActorCommand("Me", "ACTION_FIRE", WAYPOINTKEY);
The Waypoint key is not required if the command.
Thats neat...
I'm currently trying to figure out how to translate the 2D mouse X,Y coordinates to 3D X,Y,Z coordinates. The most ovbious way, D3DUnproject, moves the coordinates from the viewport to an area on an invisible sphere, in 3d, exactly the FarZ away.
So I have to figure out something else. Expect the next screenshot/demo to have a mech that can look around and move via point'n'click, and the arrow keys to move manually.
Btw, I've added in AgrDXMM so we can now play .wav and .mp3 with special effects applied(reverb, left/right positional audio, etc)
:)
Edit: About post #88(just noticed), check your CP. I gave you a rep point for it 2 mins ago (positive, lol). So now, you have a +(from me) and a -(not from me) rep point. I could not have given both, as vbulletin only allows 1 rep point per person, and it cannot be changed.
Very nice of you to blame me... :mad:
Kewl :)
That reminds me; Is the 2D of AgrDX working properly at the moment? So I can start implementing AgrDX + Menu/Widget handler? :)
I'll try to fit in AgrDX with the base app tonight by the way, I'll up the code as soon as I got it all working.. If you haven't done so I'll check if your LoadMap function can use the XML map data (which points to the textures and such..)
Soo.. To be a bit more detailed:
Tonight's ToDo:
- Remove Nemo from the Base App.
- Integrate AgrDX with Base App
- Implement common error handler for AgrDX + Terrain renderer module
- Change the configuration script so it actually works for AgrDX
- Split up the PSDs for the main menu and such and make JPG's out of the sliced stuff so I can use it in AgrDX.
- Initially starting Menu Class handler with XML Menu structure.
- Initially start new functions for the script engine (see 2 posts above)
- Move Cade's Mesh code to the Actor Class (If Cade hasn't done that yet ;) *hint hint*)
- Get more coffee cause this is going to be a long night :)
I quote.. "Since it isn't Cade who did it.. I wonder who" - so I didn't say it was you.. It was someone else who gave me a -1 rep :P
AgrDX has 2D. It was designed for 2D!
Cade's mesh code... it is not done yet. It has a bit more before I feel comfortable enough to dump it up on the ftp.
I will upload the terrain rendering system + mesh class on the ftp once I get 3D mouse picking done. The AgrDX on the ftp server supports fullscreen, btw. For tonight, dont bother with the mesh rendering code (or sound code), I've got that under developement on my end, and will upload it
Take a look at AgrDX tutorials! They should help you render stuff in 2D. DXSetTexture, DXRender2DBoxTextured, DXRenderText and DXSetCurrentFont should be what your widget class's rendering should use most of the time.
Okay; I'll just start on the menu rendering code then (Widget based)
Also, when you get home, look at the terrain code, there is now a new form to change windowed/fullscreen and resolution, and to init AgrDX. Use that before showing anything that uses AgrDX and we can use it as a settings/renderer config form.