Freerefill Posted June 19, 2009 Share Posted June 19, 2009 So I've been a bit quiet for a while. Holed up in my cave, typing furiously, my brow furrowed in deep thought as wisps of magic floated around me. Ok, well, not really. I have been working really hard on this though. A few weeks ago, I posted that I was working on something big. Well, it failed. Spectacularly. It can be salvaged, though, so expect it in a few more weeks. In failure, however, I realized the potential that it had and set myself to bringing it out. That, too, has failed. But, not as spectacularly. I have drawn out what I believe to be a fair bit of potential, and that which I have drawn out, I've put to some really funky use. If I may take some time to qualify before going on.. in the last few weeks, I asked a few questions that seemed completely unrelated. They were, in fact, quite related. First, the spinny thing. I asked, hypothetically, what one would do if one wanted to set something on their screen spinning and, whilst it was spinning, continue to add input. There was code posted on how to spin things.. but the latter part, remaining open for further user input, was left behind. I think this was a mis-communication, and if it caused any ill feelings, then I apologize. Second, the grvecs circle thing. What I meant was that I had been googling for some time and found very little information on what I wanted. Searching for "grvecs" produced many copies of the AutoCAD help file on that very function, and nowhere on any of my searches did it explain how to draw a curve. Again, I believe there was a miscommunication there, and I again apologize. Lastly, I know almost all of the questions I've asked have been very outside-the-box and, in the eyes of many, completely useless, hairbrained, silly, pointless, whathaveyou. I almost think it's at the point where I've lost some respect due to my unwillingness to "sharpen" the code I'm working on and my willingness to do things that seem like a waste. The code I'm about to post is pretty much an amalgamation of all of that; it was an off-the-wall idea that kept bouncing until I created a sparkler that took into account gravity and air viscosity. So, keep that in mind when you look at my code. Try looking at it not on a line-per-line basis, but on an overall "here's another method of manipulating information" perspective. To run the code, type "grplay" at the command line. Once running, the following options are available: CFOL - Create a line to follow the cursor CIR - Click to draw an expanding circle SPARK - Turn the cursor into a sparkler FIRE - Click to create fireworks DEFENSE - Defend the bottom of the screen from incoming missiles CFOL works best when using "redraw" instead of "regen". If you use "regen" and leave your mouse stationary, it will retract to the mouse. Not sure why, really... If you're running CIR, SPARK or FIRE, check your zoom factor. It's based on actual points in space, so if you're too far zoomed out, everything will look like a dot, or contrariwise, everything will expand so much you won't be able to see it. It is -highly- recommended you use "regen" instead of "redraw" for these functions, but you're free to test both. DEFENSE is a simple game that I made complex by creating it entirely of vectors, as well as tweaking it so that it does NOT depend on your zoom factor. You can zoom in or out as much as you'd like, and it will always remain the same, as it is based on screensize and updates each time through the loop. Speaking of time, this program is also based entirely on physical time and NOT based on "each time through the while loop". I'm sure there are ways to improve my code. The methods I used were more or less spur-of-the-moment, if-the-shoe-fits sort of things. I didn't really research to see if I couldn't find a better function to trim off three characters from a line. I'm sure people with better code knowledge will know how to improve my code, and I welcome the suggestions. Verily, I beg for them. I believe there is a lot of potential for this, not the little toys themselves but for the overall information-manipulation environment... I just don't believe I'm intelligent enough to see all the potential. Thank you all for your time and patience and help over these past weeks. Hopefully, this is one more step in my development, and maybe some day, I'll be as good as the rest of you. All that said, may I humbly present, for your viewing pleasure, GrPlayground. grread_playground.LSP Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 19, 2009 Share Posted June 19, 2009 Ridiculous.... all i have to say (for anyone not from the east coast of usa that's a compliment) Quote Link to comment Share on other sites More sharing options...
jfg Posted June 19, 2009 Share Posted June 19, 2009 Amazing!! but I cant seem to get the DEFEND command to work Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 Amazing!! but I cant seem to get the DEFEND command to work Are you typing "DEFEND" or "DEFENSE"? Quote Link to comment Share on other sites More sharing options...
jfg Posted June 19, 2009 Share Posted June 19, 2009 oops... it works fine. Its really amazing to see what you can do with lisp. Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 oops... it works fine. Its really amazing to see what you can do with lisp. I'm very pleased you like it. ^.^ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 19, 2009 Share Posted June 19, 2009 Very nice! I love that game Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 19, 2009 Share Posted June 19, 2009 Very nice! I love that game It brings me back to when i was a youngster Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 Very nice! I love that game That was just a taste ^.^ I wasn't satisfied with just sparks, I wanted to create something that had a beginning and end. It turned out to be much more than I anticipated, I only wanted a demo to demonstrate the capabilities. It nearly turned into a full-fledged game! But knowing I can do that, I know I can do better. I might improve upon it some day. ^.^ Thanks for the kind words, Lee. ^^ Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 19, 2009 Share Posted June 19, 2009 Quick question: Have had a quick look at the code, but I am intrigued as to what method you use to check for intersections between the expanding circles and the incoming missiles? I see no use of the IntersectWith method... Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 Quick question:Have had a quick look at the code, but I am intrigued as to what method you use to check for intersections between the expanding circles and the incoming missiles? I see no use of the IntersectWith method... muahahaha.. yes, that was one of the tricks I came upon as I was writing the code. Originally I was going to create a selection set for each missile, a fence from the starting point to ending point, to see if it had caught an explosion (would return 'true' if a circle was obtained, nil if otherwise). I realized that wouldn't work for two reasons. 1: if the explosion caught in the middle of the missile line it would still return true, and 2: the circles are vectors, so that wouldn't work period. What I did have, however, was the circle radius. Every time I updated the circles, I checked the circle data (since it was not an object) against each missile location. Quite simply: as each circle was updated, check the distance between the center point of the circle and the location of every missile in existence. If the distance between the missile and circle center is less than the radius of the circle, that would indicate that the missile is within the circle. Thus, remove it. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 19, 2009 Share Posted June 19, 2009 Nice idea Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 Nice idea Speaking of nice ideas, I'm not sure if you noticed but the line following the cursor was entirely inspired by you, though I fell short of the automatically-changing colours. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 19, 2009 Share Posted June 19, 2009 Speaking of nice ideas, I'm not sure if you noticed but the line following the cursor was entirely inspired by you, though I fell short of the automatically-changing colours. I was going to mention that actually - I feel honoured Quote Link to comment Share on other sites More sharing options...
Freerefill Posted June 19, 2009 Author Share Posted June 19, 2009 A few other things to mention, if you haven't figured it out already: Play around with the environment variables with the fireworks and sparkler. You could create a sort of flamethrower by turning the spark colour to yellow or bright red, and setting the gravity to a very low negative number (say, -50). Same with the fireworks: try and tweak the air viscosity, the velocity of the particles and the gravity to perfectly simulate a real firework! Many functions can be "turned on" and left on as you're doing other things. For example, try turning CFOL on and SPARK on, then making fireworks or defending yourself from missiles. And on that note, there's a little secret in the DEFENSE function, which makes creating fireworks a lot of fun. See if you can find it! I'd also like to mention that, because of the way the environment functions, it was a trip to create the game. So much that needed to be set up was already up and running, I just needed to pass data around. It turned the Defense program from the gods know how many lines into a mere 154, and that's counting comments and extra lines and parentheses. This is huge. My last game was Breakout, and ran over 800 lines. Once I find the free time, I think I just might create more games for this.. maybe even create a GrArcade.. now that would be cool. Quote Link to comment Share on other sites More sharing options...
CAB Posted June 19, 2009 Share Posted June 19, 2009 More games: Army Ants Quote Link to comment Share on other sites More sharing options...
harrison-matt Posted May 8, 2010 Share Posted May 8, 2010 Absolutly Entertaining, However, quick question, anyone know where i can find materail on gr functions? I haven't the slightest idea where to begin to look! Thanks again, great program. Matt Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 8, 2010 Share Posted May 8, 2010 The Visual LISP help files are your first port of call - in fact the same goes for all functions really. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.