PLUGIN: Razorblade 3D - full-blown, modern 3D within AGS!!

Started by DoorKnobHandle, Sun 08/08/2010 16:55:17

Previous topic - Next topic

lan

Quote from: dkh on Thu 31/03/2011 18:09:45
Sorry for being so slow at responding, I'm extremely busy due to an internship currently.  The errors mean that something goes wrong when trying to render meshes, but apparently only some fail (the pipe and hand mesh) and the rest appears to work fine. What that is that's going wrong I really can't tell. Do you have access to a different machine and could try it out there? I and others have used the plugin and tested it out and it seemed to work for everybody so far except you. :D

I will try to install AGS and the razorblade plugin onto another machine within the next days...thanx for that hint!

Quote from: dkh on Thu 31/03/2011 18:09:45At the moment you can only create models/levels and so on in 3DS MAX. Don't know what exactly you mean with integration into AGS in future versions? Integrating a 3d model editor to use seems incredibly hard and time-consuming, wouldn't hold my breath on that one.

a 3d model editor which is seamlessly into the ags ide (incl. walkable areas, regios, hotspots and so on) that's exactly what I meant. nevertheless razorblade is a cool plugin...if only it would work on my machine ;-)

Amalgam






Amalgam

btw i think you mentioned in your video that you made a 3D studio max importer/exporter ,do you still have those?



Icey

Click the links and they download automatically.

ig299


Icey

No prob, Take the plugin and drop it in the Main AGS folder. Usually located in the Program Files folder.


Icey

Ok that part I can't help with. I tried this plug-in a while ago and failed. I think you would be better of ask here. Quick Post

ig299


straydogstrut

#95
I never did get around to trying this first time around so here's what i've managed to suss out from this thread and the documentation that comes with the plugin.

I cannot take credit for this as I found all the answers in the original thread/documentation/code/AGS manual, but hopefully a summary is useful to bring it all together. I've made assumptions so please feel free to correct me if i'm wrong as this is my first time using a plugin ;)

** Pre-requisites for using the plugin **


  • AGS 3.2.x

** Installing the plugin **


  • Download the plugin and extract
  • Put the AGS Razorblade Plugin.dll in the main folder where AGS is installed (This is the same folder where the AGS Editor.exe is)

** Running the demo Game **


  • Download the demo game and extract
  • Start the AGS Editor and choose Open an Existing game
  • Find the Razorblade 3D Testgame and select the Game file
  • If the plugin is installed correctly you should see the active plugin listed under the Plugins node in the main tree in AGS (right hand side of the program)

Run the game but be aware that if AGS is installed anywhere other than 'C:\ AGS 3.2.1 SP1' (for example, mine is at C:\Program Files\AGS 3.1.2) it will complain about missing textures. This, it seems, is due to the 3DS Max models supplied with the demo game referencing absolute paths. You can dismiss these errors and the game will still run with a default texture. I no longer have 3DS Max on this machine to test the suggestion of changing the setting in the preferences unfortunately.

The demo game features an environment to move around in. WASD keys to move and arrow keys to move the light source around (IJKL can also be used but are commented out in the code). Left mouse click will cast a ray towards the location of the click and report on what was hit (like a gunshot in any FPS). The base model will return "hit nothing" while the lightbulb will tell you the name of the model hit. Note there is no collision detection in the plugin (this is intentional, it's a graphics engine primarily) so you can move through objects.

** Using the plugin in your own games **


  • Having installed the plugin, launch the AGS Editor and start a new game
  • You should see the plugin listed under the Plugins node in the main tree in AGS - right-click it and choose Use This Plugin
  • Make sure that Default Graphics driver is set to Direct 3D 9 Hardware Acceleration
  • Any models and shaders you want to use can be placed in subfolders in the main game folder called models and shaders respectively like the demo game.
  • Models should be in .dmf format (I haven't seen a link to the exporter previously mentioned)
  • The default texture default.png should be placed in the main game directory - I could not get the game to run without this but again presumably this is a path referenced by the demo models themselves?

Going by the demo game, the 3D scene is created in the GlobalScript file - the main bits to look at are:


  • The variables declared at the top of the GlobalScript.asc file (a boolean to track whether the initial setup has been done and integers for the models, lights and shaders).
  • The init function which sets some defaults (background colour, camera culling and clip distance), adds the the object models, shaders and lights
  • A crosshair GUI (see the example in the demo game under the GUI node) is placed and shown at the end of this function
  • The HandleControls() function calls the PlayerControl and AttachWeapon functions found in the Camera script (look under the script node) to allow camera movement and update the placement of the gun
  • The rest of the handleControls function sets up key presses to move the light source around
  • The GameStart() function sets the max FPS, positions the mouse, camera and shows some debugging info
  • The repeatedly_execute() function checks if the initial setup has already been done and if it has does stuff with the shaders that is beyond me ;) It also calls the HandleControl() function described above.
  • Finally the mouse_click() function contains the hit testing code (notice we added an extra model for the hit test)

The documentation that comes with the plugin is excellent and lists many of the commands available. This includes a description of what they do so you can work it out just by looking up the function call in that file.

** Publishing the game **

It has been mentioned that the models and shaders folders should be added to the Compiled folder when publishing the game. I have not tested this.

Hope that helps. Thanks again to dkh for the plugin, it's awesome. Here is another link to the mouth-watering video  :)

DoorKnobHandle

Thanks for collecting that information and compiling this excellent document, straydogstrut! I greatly appreciate that!

I should really allow other file formats to be loaded, if I could only find the time... :(

straydogstrut

No problem! :) Just out of interest, did you ever release the exporter for 3DS Max and can this be found online somewhere?

ig299

is the health bar provided or do you have to make it yourself?

straydogstrut

You'd have to roll your own. Please realise that dkh has provided a super-awesome 3D graphics engine with a tech demo showing off models, lights and shaders, not a full blown FPS engine.

As described earlier in this thread, the plugin replaces rooms and characters, but all the other AGS functionality exists: you can easily put together a health bar using a GUI (as you would expect).

I knocked up something pretty quick just by reading the manual and a couple of searches in the forums. It may not be the best way - I haven't really done anything with AGS before - but I:


  • Made graphics to represent the different levels of health: full, 75%, 50%, and 25%
  • Made a GUI for the health bar and assigned my full health image as its' backgroundGraphic
  • Created a Global Variable to store the player's health (playerHeath)
  • In the game_start() function I set the initial value of the player's health (100)
  • In the repeatedly_execute() function I had an IF statement set the backgroundGraphic of my health bar GUI based on the current value of playerHealth. I ended that statement with an ELSE setting the graphic to zero, making the graphic invisible (no health)
  • So long as playerHealth was above zero, I subtracted from it whenever a condition was met, otherwise I set playerHealth to zero. I chose to subtract health whenever I left-clicked on anything but the lightbulb, but obviously you could use any condition

To keep this thread clean, if you have questions unrelated to the plugin itself, i'd recommend you search the forums and start a new topic if necessary. Good luck!

SMF spam blocked by CleanTalk