3D GameStudio FAQs and tips

home > Teaching > 03-04 VEs > FAQs and tips


 

 

 

Most recent questions and tips are added at the top of the page.

  1. My entities are stuck on/in the ground, why? Usually , it means that your model is not centered properly in the model editor. The middle cross should be located around or slighty above the middle of the model. However, if your entity is very small, you probably still won't be able to make it move on the ground. Here's my answer to a student about this:
    "The reason why you can't put your entity right on the ground is because of its size: it's small! Not that there is anything wrong with using small entities, but, as you have noticed, the smallest possible hull (my.narrow = on) is too big for the entity, which explains why you have to move your entity so far above the ground to prevent collision with the ground. So here are a number of options, sorted by increasing complexity: - move your entity above the ground as much as necessary. This won't look very realistic, but one has to accept the limitations of the 3d engine. - An equally easy solution is to make your ground passable. This way, you can put your entity as close as you want to the ground. The catch is that, if you have entities landing on the ground or bouncing off it, it won't work any longer, as they will simply go through the passable ground. - You could scale everyting up in your level so that your spiders are not so small. - implement your own collision detection. To summarise, if everything in your level happens on the ground, the easiest and most effective option is number 2."
  2. Don't understand gravity, but need to keep entities on the ground
    You can try either of these 2 "hacks": build a thin invisible wall around mountains or hills you don't want your entities to bounce off. Alternatively, amend your bounce event routine so that the bouncing vector always remain horizontal
  3. Problems with gravity and ph_setgravity doesn't solve them
    If you have added hills to your VE, you may find that, using ent_move entities climb hills fine but do not decrease there height when they move away from the hill. So it looks as though they are floating in the air. Simply setting the gravity using ph_setgravity won't solve the problem. This function applies to entities that are registered with the physics engine. So there is a number of things you need to do before this works, and note that you can only register one entity at the time with the physics engine on A6 commercial edititon. To learn more about how to use the physics engine, do a search in the manual for "phent_". However, I recommend that you implement your own gravity. Two versions of this are given in the manual, one is very simple and the second one is slighlty more sophisticated. To find the code, do a search for "gravity" in the manual and read the section entitled "Falling Down". Here's a quick description of the algorithm that will prevent your entities from floating in the air: Using the trace function, determine the distance d between the entity and the ground. If d is greater than d0 = 0, decrease the height of the entity by d. If you have problems with d0 = 0, because maybe your model isn't centred proprely in the model editor, center it properly. If you still have no luck, try adjusting the value of d0 until you achieve the desired behaviour.
  4. Problems importing 3D Studio Max models from 3DGS
    There are different ways of doing this:
    (a) Export 3D studio Max models (max) to the 3DGS model format (mdl): This should be the preferred solution but can prove problematic. Firstly you need to install the 3DS to MDL plugin in MAX. This is very easy: extract the latter zip file and follow the instructions in the readme file. Once this is done, you should be able to export any max model to mdl. Now, some of you have experienced problems doing that. Here are some error messages you might get and how you can solve them:
    - No material error: This occurs because the export plugin doesn't let you export meshes that haven't been allocated a material. A quick fix for that is to allocate a material to the whole model (ideally you'll want to do it element by element, for aesthetic reasons). In addition to that, the material needs to be standard! To add a material to a model, select your model, then, in the rendering menu, select the Material/Map Browser option. Then, in the material browser, choose a standard material: standard materials can be found in the Mtl Library in the Browse From box on the left side of the drowser. To apply the material to the model, drag and drop the material onto the model.
    - Not Standard Material error: Indeed, you must use standard material for exporting to mdl. See above to fix this problem.
    - No Mapping error: If you encounter this error, apply a mapping to the problematic objects. Select the element (or the whole model if the whole thing causes a problem) and in the Modifier List model, select UVW Map.
    If you come across other errors, please let me know.
    (b) Instead of exporting mdl models, try importing 3DS models from the 3DGS model editor: in 3D Studio Max, export your model as a .3DS model. Then, from the 3DGS model editor, import it. It's as simple as that and doesn't require any of the fiddling described above! Unfortunately (!), with this method, animations need to be exported/imported frame by frame and textures are not exported.
    (c) There's another option, which works well BUT requires version 6.13 of the 3DGS model editor. Of course, version 6.12 is installed in the lab, so this will only be good for those who can install the latest (demo) version of the model editor. There is a good description of the solution in this forum thread.

    IMPORTANT NOTE: If you have invested time and effort creating models for the coursework using 3D Studio Max and cannot export them, even after reading the above, do not duplicate your effort using the 3DGS model editor. Although it won't look pretty, simply use very simple mdl models in your level and submit your max models too. If you do this, you need to take it into account in your evaluation, tp ensure user feedback is meaningful. That said, I trust that you'll be able to export your models from max to mdl. In any case, I'm happy to answer any queries.

  5. In tutorial 6, the slug's collision event doesn't seem to work once it's immobilised (health <= 30). Why?
    Remember what function does the collision detection: ent_move. So if the slug doesn't move, it doesn't detect entities that collide into it. Therefore if you want the slug's health to decrease when it's hit while behing immobile, you must do it in the predator's collision event function.
  6. How do I get a random number between -n and n?
    random(2*n)-n;
  7. Since I've added scripts to my level, I can't move in the scene any longer. Why?
    If you have added the default 3DGS scripts to your level, some basic level settings are now active (inspect the scripts to find out what they are). One of these settings is such that you have to hit the "0" key to enable/disable movement in the scene.
  8. How do you zoom in and out in the model editor?
    Click on the position icon (next to the select icon). Then right-click in any of the view while moving up (to zoom in) or down (to zoom out).
  9. How can I create different animations for a single 3D model with the model editor?
    The model editor lets you create as many animations as you like. Say you have created a 10 frame animation for a biped called walk1, ..., walk10. To create a swim animation for your model, simply name the next frame swim1 and add new frames for your swim animation. You may end up with an overall frame collection comprising, for example, walk1, ..., walk10, swim1, ..., swim6, run1, ... run8. To use any of these animations, use ent_animate as explained in Tutorial 4
  10. In C-Script, what does x+=1; do?
    x+=1; is a shortcut for x = x + 1;
  11. I use ent_move to move an entity and it goes through the wall a little before bouncing off. Why?
    This happens if you use large entities. Detection collision is based on two types of objects: bounding boxes and hulls. Do a search on "collision detection" using the manual search function and read the Collision detection section to learn more on this topic.
  12. How can I create a terrain?
    Terrains can be created in seconds with the model editor: in the model editor, choose New Terrain. To shape the plane, use the magnet tool, which is on the far right in the icon toolbar. Alternatively, terrains can be created from pictures, as illustrated by this brief tutorial created by a 3DGS user. The latter tutorial uses Paint Shop Pro, but you can carry out a similar job using Photoshop.
  13. My question is not listed here?
    With a bit of luck, your tutor might be able to answer it and if your question is good (or frequent), it will make its way to the FAQs. Otherwise, search the user forum.