Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Normandy

Pages: 1 2 3 [4] 5 6 ... 24
46
@laurimann:
I imagine that to do this smoothly on a sphere, you may need to rethink your coordinate mappings, since you'll always have issues trying to map a method designed for a 2d orthonormal basis onto a sphere (cf. Hairy ball theorem), although that's not to say that 2d methods are useless, since most of us tend to use and design around flat maps anyways!

I thought of two ways of circumventing this issue. This first one/two I documented here http://www.bay12forums.com/smf/index.php?topic=76404.msg1957246#msg1957246 (though the stuff I put there is very informal; also read Nadaka's post directly following). The idea break the sphere into an icosahedron, and define a locally flat coordinate system in each of the 20 sub-triangles that doesn't have issues cropping up with poles and such. With the (r,c) coordinates I set up it is possible to determine the coordinates of all of the neighbors of a triangle grid without branching logic (unless the triangle is on a triangle boundary, but that is easy to determine as well), and it is possible to store the triangle grid data in constant-length arrays.

However, the triangle method is simply a different way of storing 2d data on a sphere that has nicer symmetries than other methods of putting data on a sphere. To actually solve the issue of plate tectonics however, you still need to deal with coordinate mappings, which I got around by simply reposing the problem as simulating plate tectonics on 20 separate flat maps that have boundary conditions imposed by the neighboring sub-triangles (i.e. how fast the plates should be moving, how much material is being added/subtracted, etc...). This method has the benefit of using the same exact mechanics (and if you're clever about isolating your coordinate system from your math, the same exact code) as plate tectonics on a 2d grid (but using triangles instead of squares), so methods could transfer easily (in theory) between 2d and 3d surfaces that can be broken up into a triangular grid (I can imagine fantastical objects like ringworlds with plate tectonics...).

An alternative method for dealing with the issue is to completely scrap the idea of using 2d methods on a 3d object and instead think of grid cells as points floating in 3-space that simply constrained to lie on a 2-sphere using constraints from classical mechanics. That is, instead of each grid point only having a 2d velocity, have a 3d velocity, and if the direction of this velocity vector is not tangent to the surface of the sphere, then apply a force on the grid point to bring the velocity back onto the sphere. You will still need to come up with a discretization of the sphere surface (such as the icosahedron discretization) but then there are no artifacts due to choice of coordinates (although there still might be lingering artifacts from discretization since it is impossible to uniformly put a grid onto a sphere, but I feel triangle artifacts are less jarring than rectangular artifacts since triangles form hexagons and pentagons, which feel more natural than right angles...). The previous 'z-axis' of your work can then simply be reinterpreted as perpendicular depth, and can be continued to be treated in much the same way (since the sphere is locally flat and so over small scales we can ignore curvature effects).

47
My votes:

Extra chairs in office for meetings
Return of the Guild Masters
Yearly Status Report

The yearly status report and the extra chairs in the office (so diplomats and liasons don't go running around) are just small details that I feel would make a few details easier to manage (i.e. tracking fortress growth and the status of meetings).

Return of the guilds ftw.

48
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: April 20, 2012, 04:59:07 pm »
@AlStar:
Responding to your points in order,

This is actually a bit of dark compiler magic. Whenever you have identical string constants in a program, they are all assigned the same memory address (reference), so the == comparison works since they're all the same object. However, if you were to enter the string during runtime, then it would not work.

"Knight" is not a variable name. It's a string constant. Y is a variable name.

The benefit of making things arrays is that it's more easily extensible, i.e. if you wanted more or less slots you can just change a single number (i.e. declare a final int numSlots), and there's a lot less copy-pasting of code.

It's just a bad habit to not give actual names to your variables. It decreases code readability which in turn increases time spent programming. Especially if other people need to read your code. There are cases when you don't need to give variables descriptive names (such as index variables, when the variables follow natural english (i.e. equals(x)), or when using commonly accepted abbreviations (such as v for velocity). Otherwise, it'll just make code a pain to read and debug.

As for a condescending attitude, blame it on the internet. Imagine me reading them not in a haughty tone but in a helpful tone. I'm trying to be as straightforward as possible, so I am indeed being quite terse and unapologetic, which more often then not comes across as condescending without the benefit of body language or intonation.

49
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: April 20, 2012, 02:38:50 am »
You know, it's funny - I've just pretty much always used static in pretty much everything. I'm surprised it hasn't bitten me in the ass before this.

As a Java programmer this really hurt me on the inside. Static is used to declare shared variables and global classes within classes (or run static blocks of code). Only use it when you actually need it.

Also, you have several other weird things going on in your code. '==' cannot be used to compare strings in Java, you need to use String.equals(). Also, it's really strange to do "Knight".equals(Y). I suppose it works, but it's not idiomatic. Whenever programmers have a large list of variables that differ only in indexing, we use arrays, i.e. slot1, slot2, ... should instead be Item[] slots = new Item[8] (note that you still have to individually initialize each slot, since initializing arrays of objects in Java sets all the values in the array to null).

You should use more descriptive variable names. A function with arguments A, B, C, b, c, d, e, f isn't going to tell you much (even if you've written comments, it's just so much easier to program if your variable names are in plain english), you're bound to forget what everything does, and calling it item() is kinda undescriptive. Variables in Java are usually multi-word things written in camelCase, i.e. lowercase first letter and uppercase letters whenever you reach a new word.

Consider reading up a bit more on programming in Java before proceeding with your project, especially since you don't seem to yet have a grip on OOP, which is vital to programming in Java.

50
I don't think that K is actually important. Any sort of 'breaking up' of the rubik's cube into lower-dimensional stickers which preserves the original structure of the cube won't introduce new allowable rotations, so the problem then becomes exactly the same as solving the original cube without broken-up stickers. Also, note that in the tesserect puzzle, each of the squares on each of the cubes that compose the 3-faces of the tesseract are exposed, so there really isn't a natural way of turning these cubes into normal rubik's cubes that would preserve the original structure of the tesseract (at least none that I can think of).

51
Ah wow! I'm really glad you shared your work with us.

I've been really busy with college, so I haven't had much of a chance to follow up on this project, so we'll see about this summer. Unfortunately I'm not majoring in Geophysics or anything like that so any of my progress proceeds purely in my free time.

I think I'm repurposing this thread for people to just show off what they've been doing in terrain generation, since I won't be doing anything interesting anytime soon, heh.

So feel free to continue sharing any interesting developments with us!

52
I've always liked the simple, monochrome fonts without special symbols (the Unknown 12x12 tileset used to be my favorite before I got a larger screen. Anyone else like this set?), plus one of the muted color schemes from the wiki (still deciding on my favorite). The muted color schemes really help reduce eye fatigue, and the simple bold lines that make up most characters lead to a really simple, uncluttered view of the game.

Personally, I just really like that the ASCIIcode page 437 is so simple and abstract it makes it easy to see what's going on at a glance. I would have to agree that sometimes it is annoying that all dwarves of the same profession have the same tile, especially since dwarves of the same profession usually work in the same (or similar) areas, but I use Dwarf Therapist to deal with Dwarves on an individual basis anyways, so it's never been much of an issue for me. And as for multiple creatures having the same tile, for the most part the creatures that occur in Fortress Mode come back again and again, so it becomes easy to identify which tile is for which creature after a little while with a fort, IMO.

53
I've also experienced this, where I dig into a spire and see a bunch of demons in another spire, only to find that hell itself is more or less empty. Bug maybe?

54
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: March 13, 2012, 01:42:20 pm »
I have a feeling it's because you didn't declare leftPressed and rightPressed as volatile.

You also are using Thread wrong; a thread should either be constructed with a Runnable object (i.e. Thread myThread = new Thread(myRunnable)) or should have an overloaded run() function. Call myThread.start() to start the thread. As a rule, constructors should never be used to run anything but initialization code.

55
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: March 12, 2012, 09:51:27 pm »
Are you sure you meant

Code: [Select]
        public GameWindow(){
                window = new JFrame();
                keyHandler = new KeyHandler();
window.addKeyListener(keyHandler);
window.setFocusable(true);
window.requestFocus();
                //Then I make and add all the buttons, including the play button
        }
And not:
Code: [Select]
        public GameWindow(){
                window = new JFrame();
                keyHandler = new KeyHandler();
window.addKeyListener(keyHandler);
window.setFocusable(true);
window.requestFocus();
window.add(this);
                //Then I make and add all the buttons, including the play button
        }
this? You never actually add a GameWindow to the window frame that you've created.

As an aside, this is not an idiomatic way of using swing. What you should be doing is when the GameWindow (which extends JPanel - so it's not actually a window; windows are Frames, not Panels) is created, assign buttons to the GameWindow (i.e. this.add(myButton)), then in your main method create a JFrame and add the GameWindow to the newly created frame (i.e. GameWindow myGW = new GameWindow(); JFrame myFrame = new JFrame(); myFrame.add(myGW)). This is since each interface object in swing should generally only deal with its child elements (i.e. a panel shouldn't be creating its parent frame).

56
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: February 01, 2012, 12:22:39 am »
the ascii of 1-9 is 1-9.

The ascii value of 1-9 is actually 49-57.

57
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: January 22, 2012, 01:40:33 am »
@Mephisto:
Argh, I eat my own words. It actually is a function declaration. Ironically, it's because I've been programming in Java so long I forgot some basic C++, haha.

@RulerOfNothing:
You're right, it isn't, but for the wrong reason.

Constructors for primitive types in C++ are kind of nebulous. You can write something like int m(5); or int *n = new int(6); which sure look a lot like constructors for int. Whenever you leave out the parens, you're calling the default constructor (I forgot this fact, heh), i.e. Object myObject; calls the default constructor for Object. Someone with a degree in CS correct me if I'm wrong, but I'm fairly sure that constructors also implicitly allocate memory for the object they are constructing, so something like int myInt; implicitly calls the int default constructor.

Also, apparently function declarations can have a non-global scope, even if their definition is in the global namespace, which is really odd. It's kind of difficult to come across in practice, but something like this:

Code: [Select]
/* myFunc.cpp */
int m() { return 32; }

/* main.cpp */
#include <iostream>
int main() {
  {
    int m();
    std::cout << m() << std::endl;
  }
  int m = 5;
  std::cout << m << std::endl;
}

is apparently perfectly valid C++ (at least according to Cygwin MinGW; different compilers may think differently), which is really odd since C++ doesn't allow nested functions. You can't even use it like a function pointer. Anyone care to elucidate what's up with this?

Also, as an afterthought, it should be pointed out that C++11 fixes this by making initialization use curly braces instead of parens.

58
Creative Projects / Re: Programming Help Thread (For Dummies)
« on: January 21, 2012, 08:14:33 pm »
Actually, int nLeave(); is a declaration of an integer using the default constructor. For example, Object myObject(myInt); declares an object myObject and initializes it with a constructor from Object that takes an integer.

59
Well, I've learned multivariable calculus now, and I'm taking a class on solid-state chemistry next semester, so I'll be ready to start again maybe later in the spring. As far as musings on the project go, I haven't changed my basic plans, but I haven't looked over them carefully either, so there's not much news on that front.

60
Creative Projects / Re: Creating a game with C++
« on: September 07, 2011, 04:14:08 pm »
It should be noted that it's alot harder to screw something up in c++, or c, than in Java.

And anything you do screw up you should be able to find much easier.

While indeed you could conceivably construe this statement and the meanings of "harder" and "easier" to make what eerr said true, for most purposes it's a lot easier to screw things up in C/C++, and finding things that have screwed up almost entirely depends on programmer skill and what debugger/IDE combo you're using, not on the language you're programming in.

Pages: 1 2 3 [4] 5 6 ... 24