20 Liners / StarFighter |
| Author | Message | ||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
You're in a pretty tough ship trying to fend off a ton of little drone fighters. Who will win? Probably not you! But take as many with you as you can! Who wants to live forever? Fast paced: Use the mouse to pitch up/down and turn left/right. Left mouse click to fire. Up key moves you forward. Down key moves you back. The fewer drones left when your shields drop - the better you've done. Advice from StarFighter Command: It is possible to dodge a drone's beam once in a great while, but it's nearly impossible. Still - since it's a matter of life and death, every little bit counts. Your ship moves forward a lot faster than it moves backwards. Flying backwards is a great strategy for shooting the little buggers, but they will catch you. You can shoot much further than the drones can, but they can be damn hard to target at greater distances. Enjoy + Code Snippet "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
nice drones and likr the way they move, will be unpacking this toto make it easier read. well had 30 of the little drones to go how'd I do? I'm not getting you down am I, Ho Look! another fancy Door? |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Thanks. 30 to 20 is about what I regularly have left. Have to see what others get. Edit: If you want to know the basics of the drone AI, check out the code snippets - a post called Lock On Function. That's where the idea evolved from. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Okay - did a bit of work on this today. New features for v1.2: Stars: give a sense of movement. If, by chance, you do manage to defeat the hoard of drones - you move on to the next level, and have to fight more drones (your shields get refereshed as well). Enjoy! + Code Snippet "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
RiiDii Also if there room left how about they exploed and take a few friends with them Also what this bit do in the code? #Constant ObFunc ObFunc : I'm not getting you down am I, Ho Look! another fancy Door? |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
I've got about 22 commands left without rewritting the whole thing. I might give something like that a shot. I was also thinking they should die and take some shields if they hit you. I'll post the answer later. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
#Constant pretty much does a find/replace during compile. Everything after (on the same line) the "#Constant ObFunc :" replaces "ObFunc" anywhere in the code. I use it kind of like Function, but unlike Function - I don't need an EndFunction on the next line. I can also stick them at the end of any line that hasn't used it's full 25 commands - even inside a Function. So now, structure doesn't mean that much using #Constant - it's pretty easy to use all 25 commands for all 20 lines for a total of 500. Also, since it's reuseable, like functions, you can really add far more commands - with a little creative coding. Specifically, the ObFunc is a series of common Position functions, like Object Position X or Limb Position Z. It checks for and pulls them all. Not very resource friendly, but very line conservitive. I also have 4 types of objects to check for: Object, Target, AI, and camera. Object is just any object, as is Target, but I wanted two calls with two return values so I could use them to compare (one at a time just didn't work so well). AI is a default Object that I usually set as Object #2. Using the default AI value allows me to save commands by not having to declare a line ObjectID=2. And Camera, though not used in this code, returns the camera's postion. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Okay - here's some screen shots. First: Made it to Level 3. Level 3 is pretty darn tough. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
And here's one of getting caught in the crossfire. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
Cheers RiiDii , unstand what its doing, but how your doing will take bit more studying. I'm not getting you down am I, Ho Look! another fancy Door? |
||
| Back to top |
|||
|
dj blackdragon3710
User Joined: Fri Nov 5th 2004 Location: In LaLa land |
Quote: " And here's one of getting caught in the crossfire."
Ltterally, made it to 4 <<<<<Used to be "djblackdragon" with being registered in January, 2003, no matter what it says on the left<<<<< |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Quote: "Ltterally, made it to 4"
I wasn't sure it was possible. Congratulations!"Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
The Darthster
User Joined: Wed Sep 25th 2002 Location: United Kingdom |
I can't actually get this to work, what version/ide are you using? Once I was but the learner, now, I am the Master. See my site for amazing games and demos! |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Version = DBPro 5.8 "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Is anyone else having problems with this? Also, if you would be kind and post any comments or feedback - I'd really appreciate it. I'll try to fix any problems that I can. @The Darthster; what error message is it giving you? Also, is it during the compile or the execution? "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
Ian T
User ![]() Joined: Thu Sep 12th 2002 Location: Around |
Hi RiiDii, Great game Could I have a contact email please |
||
| Back to top |
|||
|
Google Ad
AdBot Joined: Aug 26th 2002 Location: Everywhere |
|||
| Back to top |
|||
|
Raven
User Joined: Wed Mar 23rd 2005 Location: Hertfordshire, England |
Well Done ^_^ ![]() |
||
| Back to top |
|||
|
Mr Anderson
User Joined: Tue Oct 14th 2003 Location: NYC |
Everyone must have a really fast computer. I experience slowdown when ever they fire. I have an AMD 2400+ and a nvidia 5200 FX and 512 memory running XP pro. I can complie it I have DBpro 5.8... Am I the only one with this issue? IDIC (Infinite Diversity Infinite Combinations) |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Try this... it might be a little faster. + Code Snippet "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
Raven
User Joined: Wed Mar 23rd 2005 Location: Hertfordshire, England |
i wouldn't worry Mr Anderson it crawls on this system too.. when you fire it's alright; but when the ships are firing just crawls to a stand still. might take a look over it later ![]() |
||
| Back to top |
|||
|
Keemo1000
User Joined: Thu May 26th 2005 Location: 28th Dimension |
Could not determine parameter type of 'Function AIShoot(ObjectID)' at line 5 pls reply--- |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Quote: "but when the ships are firing just crawls to a stand still."
It creates a triangle as a place-holder for the 'beam'. In the original posting, the default collision setting was used; spheres. In the adjusted one, I set collision to boxes.Also, all the stars (not the skybox) had collision on, again - by default. I set collision off for all the stars in the update. These two should increase the speed considerably. There are probably a few other tweeks that can be made if needed. Quote: "Could not determine parameter type of 'Function AIShoot(ObjectID)' at line 5"
What version of DBPro? This was written in 5.8. You might have to spread the code out to get it to work."Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
Raven
User Joined: Wed Mar 23rd 2005 Location: Hertfordshire, England |
Well I was talking about the updated version speed. it might be using the DB/P Collision, it is quite slow even with Boxes. I mean you only want to use the active collision sparingly, have Static Collision for everything else. Also another good idea to use Octree Collision Trees; so that you can then Queue the objects that could potencially be targets. ![]() |
||
| Back to top |
|||
|
mm0zct
User ![]() Joined: Tue Nov 18th 2003 Location: scotland-uk |
it doesn't seem to matter how fast or where i am moving when they fire my health always seems to just keep falling quickly until they stop, is there a way to evade their fire? also is the fire rate supposed to be like one shot every 5-10 seconds? edit: playing the faster vesrion with the run and snipe tactic i got to level three then quit because friends were talking to me on msn. tip to anyone else just trying it for the first tme: hold forwards facing away for quite a long time and turn round, if you can't see them then they are beyond the camera range, then just use backwards away from where they should appear and snipe them untill they get a bit bigger, then repaet. http://www.larinar.tk AMD athlon 64 3000+, 512mb ddr400, abit kv8, 160gb hdd, gigabit lan, ati radeon 9800se 128mb. |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Quote: "my health always seems to just keep falling quickly until they stop"
Each shot from an enemy is 1 point. On level 1, there are 100 of them to start with. That means each round of enemy fire, the shields will take 100 points of damage. The more drones you shoot (and the sooner you shoot them), the less damage you will take.Quote: "is there a way to evade their fire?"
It is possible, but it's more luck than anything else. I originally made the enemy shot instant, which meant no dodging it. Then I added a slight delay (about 50 miliseconds at 60 FPS). This allowed for dodging maybe 1 or 2 out of a hundred shots.Quote: "is the fire rate supposed to be like one shot every 5-10 seconds?"
Yes. It's timed out to be difficult, but not impossible. Also, at that rate, the firing strategy changes. At first, you just take pot-shots into the crowd and hit whatever is in the way. Later on when they are thinned out, you actually have to aim.Quote: "i got to level three"
Level 4 seems to be the best so far.Quote: "it might be using the DB/P Collision, it is quite slow even with Boxes."
It is. And even though I am moving away from using the built-in collision system, it's still efficient on total number of commands - something important for the 20 Line Challenge (and I know there was room left over). Quote: "Also another good idea to use Octree Collision Trees; so that you can then Queue the objects that could potencially be targets"
I've thought of (and coded) similar concepts, where collision boxes are turned on and off as needed. I'd like to hear more about Octree Collision Trees. I'll probably take a look at the code and update it a lot - make a StarFighter II. I'll look at enhancing the graphics, adding explosions, and improving the speed. Might try timer-based movement as well, but that adds a whole lot of commands, complications, and more commands to fix those complications. The TBM isn't the problem in itself so much as the collision system if suddenly, let's say, there is drop in FPS and the drones or the player suddenly moves a greater distance to compensate for the drop. @ Raven, your advice has been very valuable and appreciated. Any suggestions/advice you can offer would be a great help. Thanks. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
RiiDii where you go for your AI stuff, been looking at many sites but its all ?? I'm not getting you down am I, Ho Look! another fancy Door? |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Most of the actual AI is simply turning based on getting distances from the player to the AI and the AI limbs. It was developed over in the Code Snippets forum here… http://forum.thegamecreators.com/?m=forum_view&t=53827&b=6 But I think you have the wrong idea about AI. It’s not something you can just sit down and read a book about (although there are many good books on the subject of AI). AI is simply about telling the computer how to do a lot of little things that make it appear intelligent. The basics of AI are as simple as coding anything else. You start with Input, Processing, and Output. For example: If I see a hammer heading towards my hand, this is input (visual input in this case). The my brain heads over to the files under “H” for Hammer-Impacting-Hand. Once the file is found, my brain reads through the file and figures out ‘this is going to hurt!’ This is processing. My brain, not being very fond of pain, tells my hand to “move it or lose it!” and my hand complies – avoiding the incoming hammer. This is the output. Put them all together, and I appear fairly intelligent because I didn’t hit my hand with a hammer. Coding AI isn’t much more than that… except… You have to code the input yourself You have to create the conditions (“the file”) for processing You have to code the output actions In coding, Input can be many things. Keyboard commands, distances, angles, mouse movement, joystick input, even video cameras are being used now for input. Processing is typically If/Then or Select/Case statements, but can also be straight formulas. Output, for gaming, is usually some sort of movement or action command, such as move forward, turn left, or fire weapon. In the case of StarFighter, the main input was distance. What is the distance from the AI to the player? What is the distance from each of the limbs to the player? The main processing was comparing those distances to pre-programmed values (distances) that I selected and fine-tuned, or compared to the distance to the other limbs in the case of turning. And finally for output, it was pretty much basic turning. If the right limb was closest to the player, then turn to the right. If the left limb was closest to the player then turn to the left. If the AI is too close to the player, then reverse all turning commands. If the AI is far enough way from the player, set all the turning commands back to normal. So here’s how to teach yourself how to code AI. Start by writing on a piece of paper (that white floppy fiberous material sitting in your printer) what you want a particular AI to do. Then break that down into smaller manageable components. Continue until you are pretty sure can’t break it down any more. Example: AI attacks player *AI turns towards player if far enough away *AI turns away from player if too close *AI shoots when player is in it’s “sites” Then figure out each part of each AI step; Input, Processing, and Output. Example: *AI turns towards player if far enough away >>Input --Get distance from player to AI --Get distance from player to each limb >>Processing --If distance from player to AI is greater than 50 --If limb 0 is the closest limb --If limb 1 is the closest limb --If limb 2 is the closest limb --(and so on)… >>Output --Normalize turning (not reversed) --Don’t turn --Turn Right --Turn Up --(and so on)… Once you have a good idea what all your inputs, processes, and outputs are, the next step is to start coding. Not the game code, but test codes. I suggest writing functions for test codes, but you can use subroutines as well. Example: write a function that returns the distance between 2 objects. + Code Snippet Then test your functions individually. Example: + Code Snippet Once you have all you functions working to your satisfaction, then it’s time to put them together in your game code. Use your new functions just like any other code commands or functions. In no time, you will have a library of functions you can use for many purposes, and writing games will be quicker because you won’t have to start from scratch. It’s really that simple. You may struggle with code along the way, but breaking your project and AI down in this manner will help you identify any roadblocks, be able to communicate those barriers to the forum community clearly and concisely, you will get a quick and comprehensive response, and be back to coding in no time. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
HowDo
3DMaster - Champion ![]() Joined: Thu Nov 28th 2002 Location: United Kingdom |
RiiDii thank very much for your reply, given me plenty to think about, the last bit on how to go about very usefull. Hope I can work out how to do this to my 3d connect 5 game, works ok if there are two humans playing it, and even then, if there's winning line you miss a seeing it. Read lots on making maps of winning code and blocks, but as you said above, may just need to work out something that I have made and I know what it is doing. Cheers I'm not getting you down am I, Ho Look! another fancy Door? |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Quote: "RiiDii thank very much for your reply"
You are very welcome.Quote: "Hope I can work out how to do this to my 3d connect 5 game"
You can, that I am sure of. If you will, that's up to you. It may take a little time, so your most important skills to develop might be patience and determination.Quote: "Hope I can work out how to do this to my 3d connect 5 game"
Start with a 2D connect 4 game. Just get the computer to be able to play it's pieces legally. You will learn a lot just doing that alone. Then take what you learn and apply it to your 3D game.Even switch projects from time-to-time, but don't give up. "Droids don't rip your arms off when they lose." -H. Solo REALITY II |
||
| Back to top |
|||
|
The Ringmaster
User Joined: Sat Mar 19th 2005 Location: Cyberspace |
|
||
| Back to top |
|||
|
Mr Anderson
User Joined: Tue Oct 14th 2003 Location: NYC |
Could the slow down be a video card issue. It literally is not playable when the things start firing. Its like taking snap shots. I wonder how come other people initially could play it with no problem. It would be interesting to figure out why. For those that it runs fine, could you post your sys specs I have dual xeon and 2g ram, with geforce 6800 GT, so I know I should not be having any problems unless there is something specific to my hardware and general enough that others can have it to cause the haulting. Cheers IDIC (Infinite Diversity Infinite Combinations) |
||
| Back to top |
|||
|
IBOL
User Joined: Tue Mar 30th 2004 Location: chair |
hey rii, i run 5.2 because it's stable (might switch to 5.9 if it solves more problems than it creates) i can not get you code to run at all...and i tried some things... too bad, it looks interesting and gives me ideas. Question: i don't know much about #constants, BUT, are you saying you can use #constant as a function somehow? it looks like your code does that, but i can't be sure. thanks, bob |
||
| Back to top |
|||
|
RiiDii
User ![]() Joined: Thu Jan 20th 2005 Location: Inatincan |
Kind of. #Constant does a find/replace before final compile of the code. So somethng like this: #Constant wk :Wait Key Print "Hello world." wk wil basically compile like this: Print "Hello world." Wait Key (If you run the debugger, you will see a few differences, but that's the basics.) You can stack commands as well, which would act pretty much like a function: #Constant pwk : Print "Hello World":Wait Key pwk Will work just fine. Nice thing about using #Constant in a 20-liner is that it can be used almost anywhere (even within a function), as long as it's the last command in the line (because anything that follows is considered part of the constant). So, it's usefull to throw in a small set of commands that are used several times in the code to finish out a line of code. Note about using in the 20-Liner: I considered #Constant and the constant declaration to be a single "command", but if I used ":" to seperate out commands within a constant, I considered those as "new" commands, even though techinically they are still part of the #Constant declaration; in order to keep with the spirit of the 20-liner rules. Side note: I've been warned that I might find a problem with doing things this way, but so far, there have been only minor annoyances on a few commands that don't work well with this method. But otherwise - it seems to be cool. |
||
| Back to top |
|||
Sorry, but it has been so long since anyone replied to this Thread that it has been automatically locked.
You may read it but not reply.
You may read it but not reply.
Forum Search
Enter a word or phrase to search our Forum for:
|
|










