89 Forum Posts by "coln"
At 12/7/14 06:15 PM, Sandbocks wrote: My two cents, for whatever it is worth to you.
I agree. If you put as much effort into your schooling as you did into fooling your dad you would no doubt have A's or at least B's by now. You would also have the benefit knowing by yourself how to fool your dad, even though you wouldn't have to. So it's a win-win for you if you just get A's and B's.
I hate to break it to you, but sharpnova is right. Programming your game is not a "privilege" for us. Mostly because you're positing in (a) a slow forum and (b) most everyone that regulars here has a full-time job deep within the programming world or some sort. He's also right in the fact that programming plays just as much (if not more) of a role as graphics, sound, etc.
I did see that you were willing to pay, which is correct, since no one will program your game for free unless they're a very nice friend. You might have to work a deal with the programmer, but those details can be arranged so be prepared to negotiate. Although I could be wrong, from your post it sounds like you aren't prepared to pay much since you list "add this to your resume!" as a benefit (it's only a benefit if the game is FANTASTIC, and I mean utterly amazing).
This isn't to scare you away from programmers, but unless someone is either super nice (rare), super talented and super young (a little rare), or bored/needs a hobby (not so rare), they don't like working for free (would you work for free?)
I'd suggest looking in the Collab forum.
It's a pain at first, especially if you aren't familiar with assembly at all, but reading the manuals for the chip and looking at given examples (or online examples) is really the best way to learn it. There are so many microprocessors, microcontrollers, and CPUs that writing a tutorial and a step-by-step series (like there are for specific languages) would not only be a huge undertaking, but it would almost be a distraction from learning rather than a help.
Reading manuals is a slow and tedious process, but once you begin to understand the basic fundamentals of one processor's instructions/capabilities, the same features appear on most every other processor, give or take a few features. The semantics might change, but the application is roughly the same.
If you really want to learn assembly, I'd suggest getting a good "intro to microprocessors" book. Since assembly is simply instructing the processor to do certain tasks, understanding those tasks makes assembly very understandable.
At 11/14/14 08:55 PM, DragonaxGames wrote: Hello. I'm new here, so please forgive me if this has been answered before. In my game that I uploaded here, the space ship is controlled with the arrow keys. But if you use these keys, the browser window goes up and down. Is there a way to fix this? Thank you for your help.
It appears that the answer can be found by using an event's .preventDefault() method. A little searching came up with this result. Some of the script might be a little confusing for a beginner to understand, so if you have any questions about it feel free to post back here.
At 9/15/14 02:13 PM, 4Doctodragon wrote: It's been a while since I've taken an Algebra class. I was trying to figure it out online but how would I have a function of Y curve such as below? The code that's on the image is what I'm currently working with and, as you can see, it's pretty linear.
It's a lot easier to simulate gravity than it is to calculate Y using X.
Here's pseudo code for one way of doing it.
var gravity = 1;
var positionX = 0;
var positionY = 0;
var speedX = 10;
var speedY = 10;
For each frame:
positionX += speedX;
positionY += speedY;
speedY -= gravity;
if positionY <= 0 {
positionY == 0;
}
Anyone familiar with cluster computing or slave/master computing? I have a few old computers lying around (they aren't too terribly powerful) and I wanted to get some use out of them. I've been looking around and the best solution I've come up with so far is Synergy, but that's just a KM switch, so they're still 3 separate computers working independently.
I don't necessarily need to do heaving computations on it, but I would like to combine their efforts to turn 3 crappy computers into 1 decent 3-core computer. I know from research that this is quite difficult with such a small scale and not really worth it unless I want to render video or figure out genetic folding.
Any thoughts?
At 9/6/14 11:52 AM, WoogieNoogie wrote: I enjoy semicolons and braces. One of the projects I work on is in Coffeescript, and it annoys the hell out of me.
Don't get me wrong, I like them too. I have just created a habit of not using them since I've been on a Python kick recently. I haven't played with Coffeescript yet though. What is the purpose of it (genuinely asking)?
Ahhhh! I've been writing in Python so long that when I go back to C (or any other language), I forget to type semi-colons! Oh the pains....
At 9/4/14 06:18 PM, coln wrote: time.sleep(1)
Apparently Selenium has its own set_speed function that dictates how fast operations are carried out. With more research I have no doubt you could find a better way of doing it that what I posted above, haha.
At 9/4/14 05:46 AM, sharpnova wrote: Anyone?
I think Selenium might be your solution. I haven't messed around with it too much, but by using the "send_keys()" method to an element on the web page you could probably set up a timer script to dictate how fast send_keys is called.
Here's a modified example from one of their own examples.
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get('http://www.yahoo.com')
assert 'Yahoo!' in browser.title
elem = browser.find_element_by_name('p') # Find the search box
string = "Characters you want to send"
for c in string:
elem.send_keys(c)
time.sleep(1)
elem.send_keys(Keys.RETURN) # Submit the form
browser.quit()
At 8/31/14 07:20 PM, KatMaestro wrote: Git is difficult to chew on for beginner. However it's the best source-code management out there. Best alternative to SVN. Don't beat yourself because you couldn't push or commit the project on first try.
I would also like to emphasize this point. The learning curve is quite steep, however the documentation and community help out there almost counter-balances that curve. When you're lost (and you will be if you try to learn Git), just google your question and you'll get at least 3 or more hits with the answer to your question. It'll probably feel like you're hacking together your first few repositories, but once you get the hang of it the complexity of Git is reflected in its power.
At 8/28/14 12:18 PM, MykeiXWolfe wrote: What is it, and how/where does a 5 year-old man-child learn this strange new world.
Git is a version control system that manages files (of any kind) inside of a project. This allows you to see into the history of your project's revisions, access them, and merge older files with newer files, or vice versa.
There are many version control systems out there: git, svn, mercurial, heck even Google Drive is a version control system.
If you are interested to learn more about it (and git), try reading Git's Documentation. Even if you don't end up liking git, it has a lot of information that pertains to many version control systems.
At 8/16/14 10:05 PM, Diki wrote: I feel like that isn't what you're saying because that seems kinda crazy.
Well, sort of. I want http://example.com/foo/bar to rewrite to http://example.com/subdir/foo/bar but not actually redirect there.
Then I want http://example.com/subdir/subsubdir to redirect to http://example.com/subsubdir to preserve relative links and such.
I know this is incredibly stupid and round-about, but my host does not allow for directory pointing or for parent folders above public_html (which is incredibly frustrating).
Also, someone has answered this question here if anyone is interested. The difference is using REQUEST_URI for the rewrite and THE_REQUEST for the redirect.
The simpler answer would be to change hosts but I still got half a year left on this one and I'm trying to deal with what I've got
I am currently using shared hosting and have no way to put my files outside the "public_html" folder.
To work around this, I want to .htaccess my "root" site to a subdirectory using the script below:
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !^/subdir/
RewriteRule ^(.*)$ /subdir/$1
Which works great, except for when I navigate to www.example.com/subdir/. That url does not redirect to anywhere. This is a problem for relative urls and such.
Is there a way to continue rewriting my root to a subdirectory while also rewriting www.example.com/subdir/ to www.example.com?
At 7/13/14 10:59 AM, Diki wrote: I made a thing!
Genuinely curious: why? What is the use of turning XInput into keyboard/mouse macros and essentially controlling a computer, I assume?
At 7/9/14 12:03 PM, milchreis wrote: But I don't think that's what you asked for.
If you just want to get your hands dirty I don't think hardcore theoretical computer science is the way to go.
Pick one of the languages and go for it.
If you made your choice we can probably point out some resources that will help you get started.
milchreis is right. His funny comments aside, if you have NO idea what you're doing, then learn some boolean logic first and then program, but chances are you have an idea what and if-then-else statement is and therefore you will probably learn (and refine) most of these concepts while you're programming. Theory is great, but once you get on the street you can (and should) keep the theory in mind, but you will eventually learn things by experience better.
I feel like you should read a lot, then learn by doing, and then read more and ask questions on the forums or elsewhere.
At 7/7/14 05:58 PM, MSGhero wrote: That actually solved an issue I was having when testing the performance of the pool. If you're interested, put() is now:
Haha yea thanks. I just wanted to make sure, if it was on purpose or an accident. You never know when you'll find that bug, haha.
Interestingly, just for fun I ran performance tests and found out that using .indexOf slowed down the put() function by 20%. Now, of course I haven't compared the benefit of not have a million indices with the same object, but ya know.
At 7/7/14 09:54 PM, RemminyCricket wrote: I know you can copy and paste layer by layer into an empty graphic, but that's time consuming.
Hold down shift while selecting multiple frames (or simply drag to select multiple frames), right-click and select copy. Then, inside a new graphics object, select the empty frame, then right-click and select paste.
You must select frames on the layer, not the layer itself, in order to copy and paste multiple layers.
At 7/7/14 04:47 PM, MSGhero wrote: If it's already in the pool, that should be an error. It doesn't matter the order of points in the pool because you're grabbing an anonymous one, and it's a waste if it's already there.
I'm a little confused. Calling get() only reduces the "count" int, and doesn't actually take out the object.
pool.preallocate(5);
var obj = pool.get()
pool.put(obj); // _pool.indexOf(obj) != -1
_pool.indexOf(obj) != -1, so the object does not get destroyed or put into the pool?
At 7/7/14 02:57 PM, MSGhero wrote: Getting and putting use array access rather than creating Node objects or using the expensive push and pop array methods. For your second question, you could preallocate() a bunch of points at the start.
I was under the assumption that linked lists would be faster for this sort of task, since push and pop on linked lists are negligible. I guess array assignment wouldn't really cause a big fuss, especially if the index already exists. Here's what I was using (it was also static), but I'm gonna try out the arrays and see how it goes.
public class Pool {
private static var pools:Object = {}
public function Pool() {}
public static function get(classType:Class):* {
var className:String = getQualifiedClassName(classType);
if(className in pools && pools[className].length){
return pools[className].pop().data;
}else{
pools[className] = new LinkedList();
return new classType();
}
}
public static function put(o:*):void {
var className:String = getQualifiedClassName(o);
if(!(className in pools)){
pools[className] = new LinkedList();
}
pools[className].push(o);
}
}
I just want to point out that if, in your code, you add an object that exists in the _pool array already, it does not get destroyed, nor put into the pool.
var obj1 = pool.get();
var obj2 = pool.get();
pool.put(obj1); // now at _pool[0]
pool.put(obj2); // now at _pool[1]
var obj3 = pool.get(); // now references _pool[1] (old obj2)
pool.put(obj3); // Does nothing, _pool.indexOf(obj3) == 1
Thanks again for the tremendous amount of help. I know I'm barraging you with somewhat petty questions
I thought I would just leave an update here (and maybe another question). Using the object pool. There are now 0 vector creations per frame! Woohoo! There is only an initial bump, but once they are all created everything runs beautifully.
My only question is that now I have a lot of linked list node creations and deletions per frame. Each time an element is retrieved or disposed, pop and unshift are called respectively. Now, I'm not sure that this is a problem (it's not a problem yet), but is this approach alright? Or should I create a specific number of nodes to start, and just clear the data rather than removing the node (like C++'s vector class)?
By the way, thanks for all the help. I really, really appreciate it!
At 7/6/14 11:08 PM, MSGhero wrote: What the nape physics engine does is it asks if you want to modify the original vector or create a new one, "add(v:Vec2, createNew:Boolean = false)" or something like that.
Also this nape physics engine is making me cry since I have spent weeks writing physics crap which runs way worse than this library. Ahaha well, learning experience I guess!
At 7/6/14 11:08 PM, MSGhero wrote: What the nape physics engine does is it asks if you want to modify the original vector or create a new one, "add(v:Vec2, createNew:Boolean = false)" or something like that.
Interesting. So would this require a Vec2.store(v) function that I would need to call after every finished vector?
At 7/6/14 09:41 PM, MSGhero wrote: But an object pool would be good. And seeing if you can seriously reduce the number of points you're using.
I just discovered the object pool idea not too long ago, but never thought to use it for vectors! Thanks!
At 7/6/14 09:44 PM, MSGhero wrote: Thisis how I do steering, and it takes maybe one or two new points per frame, if any at all. If you were controlling each pixel of the car, then maybe 200 points would be ok, but that does seem excessive.
Okay so I super simplified it to just seek and wander and now a single vehicle uses ~10 vectors to calculate steering. Integrating a path bumps the number to ~100. I am too using a method similar to the link you posted. (I think I need to look a little closer and extraneous vector creations).
Here's what I think might be a problem:
position = steering.add(velocity).mul(speed);
In the above example, in order to prevent steering from being modified, the vector class has to create a new vector like so:
public function add(v:Vector2D):Vector2D {
return new Vector2D(x + v.x, y + v.y);
}
public function mul(num:Number):Vector2D {
return new Vector2D(x * num, y * num);
}
Now, I can create a slightly less intuitive version that adds and multiplies to the current vector (x += v.x, return this, etc), and that reduces the number of calls slightly. But I still can't see any way to avoid cloning the vector in order to not modify the original in the case above.
Whew sorry for the long post
Hello! I am using a custom vector class to replace/extend AS3's Point class. It has everything the Point class has plus basic math operations and other goodies.
I'm using this vector class in a steering simulation for large crowds of "vehicles." My problem is, each vehicle has roughly 200 vector creations (and deletions) per frame. In other words, it requires about 200 vectors to calculate all the steering properties. If I add in a pathway (of vector points) for the vehicle to follow, that number rises to about 500.
My question is, is this a large amount of vectors per vehicle? If so, I'm not exactly sure how to reduce this amount. I have gone through the code and upon inspection I believe that all vector class creations are necessary to calculate a successful steering simulation. By the time I get up to 10-20 vehicles on the stage the FPS starts to drop, which is not ideal, as I have a goal of roughly 100-200 vehicles at a time.
Am I looking at this catawampusly?
At 7/5/14 09:00 AM, milchreis wrote: Yes, you should still start with python.
Not that I have much weight on the matter, but I agree with Python. It's intuitive, it's relatively easy to learn, and it will let you start programming simple things from day 1.
I also recommend using the book Diki posted
At 6/16/14 03:46 AM, milchreis wrote: mvc is more or less just a standardised way to build a relationship between objects.
Here's a video on how how to roll your own:
https://www.youtube.com/watch?v=tlgrYh9_Hpk
Hmm. That video was very informative. Thank you for the links. I shall have to research more into this. Thanks again!
At 6/15/14 08:33 PM, milchreis wrote: The answer is: Events.
As part of what I described above.
Or in more sophisticated frameworks employing the mvc pattern, like robot legs for example.
Okay, so would you recommend I used events, or employ an MVC pattern? I know the answer is in part how complicated do I want this thing to get, but I am using this in part as a learning tool, so I am open to complexities.
If events, what event would I dispatch for a variable change? Say, "isDragging"? I don't want to recreate a drag mouse down, mouse up, and mouse move on every plugin to figure out whether a movieclip is being dragged. It would be easier to just check if the variable "isDragging" is true or not.
At 6/15/14 07:26 PM, MSGhero wrote: I thought your frames were like frames of animation or of a movieclip. They're usually called "States."
Okay, so using a static class (aka a class with all static methods/properties), is the best way to create states?
At 6/15/14 07:36 PM, milchreis wrote: You write a class for each one, in which you handle the specific functionality.
What is the problem?
My problem is more of a question. Is that the best way to do it?
I'm currently working on a level editor which has many plugins (such as an OS-style selection box, a pathway drawer, etc). I'm trying to link the different plugins to the level editor without dependencies on the LevelEditor.as static class,That's what Events are for.
My question was more of, should i riddle the plugin with frame-specific options, or should the frame pass parameters to the plugin.
I'm not sure what you mean by "static class".
A class is never static.
Members of a class can be static.
When I said "static class" I meant a class whose methods and properties are all static.
But your Frame01 class does not full fill that requirement.
So what do you mean?
That was a mistake on my part. That should be a static member.
This all seems very very vague.
I apologize. I am just not very good at explaining what my problem is. I'll try again:
I have game states. Each state has a static class to represent it (as defined above). Each state requires "plugins" (sound manager, button handler, movieclip mover, etc). Each plugin needs to communicate with each other (i.e. "if button handler is clicked, play the sound manager"). What is the best way to get them to communicate with each other: passing parameters via the current state's static class (i.e. initPlugin(someMember)), or by accessing the current state through the plugin (i.e. StaticState.someMember).
At 6/15/14 06:51 PM, MSGhero wrote: If you give more info on what you're trying to accomplish overall (not the specific code thing you're trying to do), we can give a better explanation.
Hmm. If that's the case...
I'm creating a game with different frames (main menu, level select, levels, credits, etc.). Each frame has different needs. For example the main menu and level select needs a button handler, while the levels frame needs to be able to handle the level data/level artwork/etc.
I'm currently working on a level editor which has many plugins (such as an OS-style selection box, a pathway drawer, etc). I'm trying to link the different plugins to the level editor without dependencies on the LevelEditor.as static class, however I need to know things like "is the mouse click for plugin A or plugin B?"
If static classes for frames aren't the way to go (I'm not really sold on them, since they haven't been helpful), what would be the best way to organize stuff like that? Does the Main.as class handle the frames? If so, what about plugins?

