Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

176 Neutral

About Ahnfelt

  • Rank
  1. Where's Waldo?   Find as many people in red-and-white-striped shirts as possible.
  2. Ahnfelt

    'Exploration' pathfinding algorithm?

    I'm no AI expert myself, but maybe you could use Dijkstra's algorithm to find the nearest unexplored tile (or tiles).
  3. Ahnfelt

    'Exploration' pathfinding algorithm?

    Well I think that sounds like a good start. Are there any behavioral downsides to it, or are you concerned with efficiency? Anyway, I like that you're not going for the standard-ish walk-around-in-rings AI that so many RPGs feature.
  4. Ahnfelt

    'Exploration' pathfinding algorithm?

    You could store the tiles or areas where the monster has explored, and then if there's nothing interesting around, go towards the nearest unexplored area. This way the monster isn't aimless per se, but just appears to be searching or exploring.
  5. You might want to consider following the official style.
  6. Ahnfelt

    Language Syntax

    I really care for JavaDocs and similar systems. Since types + method name typically doesn't contain enough info, it is vital. For example, does the method return null? Does it throw an exception? Does it require that some argument isn't null? And then there are more complex stuff such as side effects. And there may be examples of use or runtime complexity involved. I love documented methods, and an IDE that pops up the JavaDoc when I'm auto-completing does a lot for my productivity.
  7. Ahnfelt

    Language Syntax

    I like the Python syntax to some degree, because it doesn't require parenthesis around everything. For example, I find "if x > 23:" cleaner than "if(x > 23) {". I don't use Python at all, so it has nothing to do with familiarity. It's not as ambiguous as C-like languages, for example: if(x > y) doStuff(); doMoreStuff(); Works as intended if you write it in Python, whereas the indentation is only misleading in C. It also does away with the extra punctuation (semicolons at the end of each line). I am working on a language myself, and I'm sort of happy about the syntax. Example: val x = [1, 2, 3, 4, 5, 6, 7, 8, 9] val l = x.Length Console.writeLine(l) if x(2) < 5 do # stuff end The first point is that there are no statement-ending tokens. Actually, semicolons would be sequence-delimiting, since there are no statements in the language, only exressions. However, if a line doesn't end with an atom, a closing parenthesis or an identifier, a "semicolon" is inserted between it and the next line. This is what allows the multi-line array literal at line 1. A variable (or a val-binding) lasts for the rest of the sequence. At line two, the array's length is gotten. Case is more significant than in most languages, and methods must start with a lowercase letter. When an uppercase identifier is used where a method is expected, it expands to a call to the getter - for example, x.Length expands to x.getLength(). Similarly, x.Foo = y expands to x.setFoo(y). Uppercase identifiers that are encountered where a value is expected resolve to the "object" of the corresponding name. Unlike most languages (but like Scala), instead of having static methods and initializes, every class has a "companion object" of which there is only one instance. There aren't any "member variables" as such, but all methods are declared in the constructors scope, so they can use any variables declared there. For example: class Bar(x: Int) do val xTimesX = x * x methods fun getX(): Int do x end fun getXTimesX(): Int do xTimesX end end The parenthesis after the class name contain the parameters to the constructor. Between "do" and "method" goes the constructor body, and after "methods" goes the public functions. Every value is an object. The only thing that can be accessed from outside an object is it's public functions (it's methods). The constructor is simply a method in the companion object, which is created implicitly. If we wanted to explicitly write it (for example, to provide more functionality): object Bar do # We're not in the mood to do anything here methods fun get(x: Int): Bar do class(x) end end The "class(x)" part calls the constructor of the Bar class, and is only directly available inside the companion object. In another file, if we want to get a new instance of the Bar class, we write "Bar.get(42)". No, we're too lazy to type all that, so we write "Bar(42)". An expression followed by parenthesis expands to "get" called on the expression, so the two are equivalent. Similarly, "x(y) = z" expands to "x.set(y, z)". If you look back at the first example, you will notice that array access uses this trick too. The "get" and "set" methods are defined for arrays, so you can say "myArray(3)" and "someArray(7) = 42" and those methods will be called. Other operators can be defined for user types by defining the corresponding methods. First class functions are simply objects with a "get" method that corresponds to the desired function. (And there's lexical scoping and full closures.) And the last thing I think I can stuff in here (which hurts, since I haven't covered variants and pattern matching, and so on): val r = for x in [1, 2, 3], y in [5, 6, 7] where (x * y).even() do x * y end Is like a list comprehension that returns the list of the products [1*5, 1*6, 1*7, 2*5, 2*6, 2*7, 3*5, 3*6, 3*7] except those products that are odd. Feedback appreciated.
  8. Ahnfelt

    Nicollet.Net : my blog.

    I find it amusing that all the errors you have written about in the unit testing post are due to dynamic typing/variable creation ;-) I am probably going to read every last of your posts. Languages and abstractions, my favorite cup of tea. But before that I am going to nit pick a little on the layout, so feel free to ignore if you don't care. I have a hard time reading the light gray inline code on the white/gray striped background. The font size seems to be locked down, so they are rather small on my display. Screenshot: In template.css, line 19, for example, there is absolute pixel value font sizes: font-size:12px; Anyway, I look forward to reading through your posts. Keep up the good work! [Edited by - Ahnfelt on October 2, 2008 6:28:20 AM]
  9. Ahnfelt

    Casual game - multiplayer only

    There are plenty of casual multiplayer games. Multiplayer pong (yes, there are actually quite entertaining and popular versions of this, with 6+ players in non-rectangular settings), guess-what-I'm-drawing games (iSketch), and so on. They are very popular and as such they make a lot of sense. But I have never come across a really casual cooperative game. That would be an interesting project.
  10. Well it's freeware too, by definition (since it's free of charge). Anyways, you really should use version control. I recommend Subversion. You can do it locally or on a server (there are plenty of free ones for open source projects, but if it's proprietary you really should set up your own).
  11. Ahnfelt

    Dreams disappearing from memory fast

    Quote:Original post by Zipster To augment what Bregma said, they've done tests where subjects are asked to memorize random sequences of words and then recall them afterward. The tests have shown that the first dozen or so words in the sequence were remembered with high success, along with the last couple of words. However the words in the middle of the sequence suffered the most. The theory is that the words towards the beginning of the sequence have been established in long-term memory the longest and thus they're easier to recall, while the words toward the end of the sequence are still lingering in short-term memory so they're also easier to remember. The words in the middle don't have the benefit of still being strong in short-term memory or being established in long-term memory, so they're harder to remember. By that logic, it should get easier to remember as time goes by, as the words have been established in long time memory longer and longer. So after, say, 10 minutes, you should be able to remember all the words - but it only gets harder as time passes by. From my personal experience, (which is worth squat as a scientific argument, I know) there are two ways to learn something: associate it with something you remember well or swot it until it sticks. In the cache/harddisk version, what process decides what should be written to disk? That is the interesting part of the model, and I've yet to read a coherent description. Though I admit I haven't been looking all that hard (I'm in Computer Science, after all). I find the theory described in the following book (I assume, because I've only heard his lectures so far) to be the most interesting and elegant I've heard yet. He argues that there is no distinction between remembering and experiencing. You can skip directly to chapter 4 (page 56): Peter Naur: An Anatomy of human mental life. I hope the book is as good as the lectures.
  12. Ahnfelt

    Google Chrome

    I ran with Google Chrome as the default browser for a couple of weeks (well, when on Windows anyway). However, it had some quirks with Facebook, where certain buttons wouldn't respond to clicks at all. There were some other minor, but annoying compatibility issues. Although they may not be Chrome's fault, it just doesn't compete with Firefox. I really liked it's interface. All aspects of it. I think it's close to flawless. But some more settings (hidden somewhere far into those two menus) would be nice, and I find it hard to live without adblock plus, and the JS debugging tools are very processor hungry and doesn't reach the knees of Firebug. I will try it again once it's no longer beta*. * I'm only being semi-sarcastic here. I do hold some hope that it won't last more than half a year or so to get there, and not forever like ... any other Google product I guess.
  13. Yeah, you can safely ignore tools that are not well documented. If you're using a good IDE and an object oriented language, the auto completion popup also has doc comments*, which are part of the documentation. Just type out the name of the variable that contains your object, then a dot, and you can browse through the methods available for it, with the documentation popping up if you pause on any of them. This will help you learn new methods, but not how to combine methods into a program. For that you should read a real manual and some examples. Look at the library's homepage. * this feature comes with most big IDEs, but I can't remember if it's enabled by default. NetBeans has it on by default I think.
  14. Ahnfelt

    [web] google sites?

    No, Google Sites is a wiki. You can't reprogram to fit specific needs. A subset of HTML is allowed, but that won't help you make a game. Unless you're building an intraweb or collection of articles or something like that, it's going to be a hindrance rather than a help to use this service. You can use Google App Engine if you want to stay with Google's free hosting and know (or want to learn) Python.
  15. Ahnfelt

    What's the point of references

    It is never a good idea to duplicate functionality, this applies to language design too. The functionality of references is a subset of that of pointers (apart from syntax). However since C++ builds on top of C, it was a sensible way to introduce a way around the implicit unchecked cast of pointers (from nullable to non-nullable) at every method call and field access. One way to think of it is: Pointers: nullable variable addresses with arithmetic. References: Non-nullable constant addresses. It's a really awful mixup of properties that should have been split up into not-nullable/nullable, constant/variable, no-arithmetic/arithmetic with sensible defaults, but wasn't partially due to backwards compatibility. But as it is, references provide the functionality you need most often, and a syntax that is friendly. Use it by default and replace with pointers where you discover you need them. Java and C# don't use references in the C++ sense. In both languages "references"can be null and are variable.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!