Space Simulator Issues

I’m trying to design a large space battle with as many fighters as Blender can handle (ideally over one hundred, but that may be asking for the impossible). The AI use several “squadron leaders” on each side, each chasing one enemy fighter and being chased by one enemy fighter using track to. This forms a train. Then each fighter is copied to form squadrons.
Fighters in squadrons clump together.
When using collision avoidance protocols with radar sensors and motion actuators, framerate slows and fighters seem to spin out of control for no apparent reason. They could be colliding.
I need a way to regulate fire so that not every fighter is shooting at the beginning when the two sides charge and intersect. I would probably use a pulse, but I need one that goes on for a while and then off for a while.
Thanks for any help you can offer. I’ve been using Blender since last summer, but not very much, resulting in newbiehood. :smiley:

Hi Kaet!
I will advice you to stay away from radar and near sensors. For the avoidance, you should fake it with an invisible space object. You could also use a track to closest object script or something to avoid the train…
Good luck!

It would be better to learn Python for this - this delves into the field of AI, which is something that is best not left up to logic bricks. If you would like to learn Python, I have started a series on it on my game development tutorial blog, Game Up!

Well, I had this previous file in which I actually made the system work fairly well. Only the player could shoot at the time, but I think I had a hundred fighters in there, and the squadron system was working. I think they were scattered at the beginning because when the two sides engaged, they all collided and scattered. (That’s my theory.) I’ve tried to learn Python a couple of times, but it’s as if I can’t figure out what I need to know. I just need to buckle down and do it. Maybe this summer.
I just tried the first one again, and the framerate (which had been lagging for some reason) is better now. I’d post a .blend, but I have no idea how. Could someone help me with this? Anyway, if I get a chance, I’ll post both the old and new versions, as the old is an example of how the “train” system actually worked once. By the way, two questions: in terms of framerate lag, how much more do you sacrifice by using logic bricks rather than the equivalent Python code, and what is a poly (is it a vertex, face, edge, total of all of them…)?

To post a blend, when you post a reply, go to Advanced mode, and click on Manage Attachments and add the blend file. Alternatively, upload it to a file-hosting service like MediaFire, and attach the file’s URL here.

Python gives you more flexibility, and external Python scripts can be fairly fast.

As to your other question, a polygon (poly) is a face - for example, a cube has six polygons (one for each side). Polygons can have four vertices each, or three vertices each (e.g. a pyramid has four polygons, each consisting of three vertices).

Maybe you could try boids? The logic is pretty simple, so it’s a good entry point for you to pick up some python-fu :slight_smile:

I actually looked into boids when I was first trying to do this. However, they don’t appear to be supported by the game engine. (If I’m wrong, let me know.) I’ll post the .blends soon, I think. By the way, thanks for all the help. This is an incredibly fast-responding forum.

That page is pseudo code, You have to translate it to python. But blender can handle simulations like that - no problem.

When I first started my project I had to test many things first, and at that time, I was using logic bricks for almost everything. I had 1500 simple enemies with radar detection and still got decent frames. It depends on how you organize your scene, how close are the ships, how many you see at the same time, etc… To get started in python, split your game apart, and take each thing at the time and try doing it in python (ask around) study how and why it works. Then go read a python tut, and come back with another question. My first question in bge python was how to get an object to move in python… Good luck!

Originally, I was actually hoping I might be able to have a thousand fighters…probably wishful thinking…Anyway, it looks like it might actually be possible to have a few hundred – my fighters are something like twenty poly. (The enemy ones, that is; I haven’t figured out the friendlies.) The AI on the new .blend is messed up right now, as all of the enemies follow the player and only one friendly attacks anything; the others just head off into space. The controls on the old one are horrible; I was using dRot. (Okay, I don’t get this. Everybody talks about dLoc and dRot, but on my computer they’re just Loc and Rot.) The controls (on the new one) are: Arrow keys for pitch and roll, “a” and “f” for yaw, “s” and “d” for slow down and speed up (I think), “w” to fire one gun, and spacebar to fire the others. On the old one, just use the arrow keys. You can fire with the left mouse button, but I don’t recommend it, as the bolts were very high-poly (I was even more of a newbie than I am now) and they slow everything down. Actually, I couldn’t get the old one to upload, but I might try again in the future with help. Anyway, here goes.
(Edit) Did I offend everyone or something…? No one seems to be responding!
(Edit 2) Oh, I forgot to mention that my capital ship models are very simple and the textures are horrible because I have no idea how to UV unwrap…


Gametest.blend (1.08 MB)

Just so everyone knows, these problems haven’t really been solved. I still need your help! Thanks.

I still need help…