[QUOTE=geel9;28611016][url=http://sikuli.org/]Sikuli[/url][/QUOTE]
Aw it doesn't support windows :(. Never mind, the front page lied.
[QUOTE=NorthernGate;28610455]Isn't it up to the programmer to decide how he uses an available function?[/QUOTE]
Not in this case. ToString should be a human-readable representation of the object. Visual Studio also uses ToString to display in the debugger.
[QUOTE=Ortzinator;28611664]Not in this case. ToString should be a human-readable representation of the object. Visual Studio also uses ToString to display in the debugger.[/QUOTE]
When debugging this stuff I want to see the bytes.
[QUOTE=NorthernGate;28610455]Isn't it up to the programmer to decide how he uses an available function?[/QUOTE]
Well yes, that's exactly our problem here. It can lead to programmers abusing the language.
Looking at that class in a debugger is going to shit a bunch of byte output in the display instead of useful information. Also, there's really no gain over a simple utility function that converts the byte array to a string on demand. It could even be implemented straight into the base class if he wanted.
[QUOTE=high;28611898]When debugging this stuff I want to see the bytes.[/QUOTE]
Then inspect the serialized byte array in the object - not the object itself - for the bytes.
[QUOTE=jA_cOp;28611955]Then inspect the serialized byte array in the object - not the object itself - for the bytes.[/QUOTE]
And if he wants a display, there's an attribute [I]just[/I] for that (named DebuggerDisplay)
[code]
[DebuggerDisplay("{DebugString}")]
public class User
{
private string Name = "John";
private int Age = 12;
private string DebugString
{
get { return string.Format("Name: {0} | Age: {1}", Name, Age); }
}
}[/code]
Note: I made it a getter property here because he'll most likely want to run a function to convert that byte[] into a string, so it was a good example. In this case I could've just done DebuggerDisplay("Name: {Name} | Age: {Age}")
[QUOTE=high;28611631]Aw it doesn't support windows :(.[/QUOTE]
[url=http://sikuli.org/download.shtml#win]What?[/url]
[QUOTE=NorthernGate;28610455]Isn't it up to the programmer to decide how he uses an available function?[/QUOTE]
Not when MSDN says something about it:
[quote]ToString is the major formatting method in the .NET Framework. It converts an object to its string representation so that [b]it is suitable for display.[/b][/quote]
[editline]15th March 2011[/editline]
IMHO, if your datatype is roughly a scalar, then you should just represent that value as a string. Otherwise, your ToString() should return something like:
[code]
{ PropertyOne = Foo, PropertyTwo = Bar, ... }
[/code]
[QUOTE=Jawalt;28610714]Working on getting a first usable version of my grapher done, which I'm calling until I can find another name Cosmonaut (love that word :P)[/QUOTE]
[url]www.dotomator.com[/url]
Knock yourself out.
Does anyone have a tutorial or an algorithm or anything for generating procedural cities?
Something like this:
[img_thumb]http://img263.imageshack.us/img263/1261/48259781.png[/img_thumb]
[QUOTE=Richy19;28617290]Does anyone have a tutorial or an algorithm or anything for generating procedural cities?
Something like this:
[img_thumb]http://img263.imageshack.us/img263/1261/48259781.png[/img_thumb][/QUOTE]
[url]http://www.vision.ee.ethz.ch/~pmueller/documents/procedural_modeling_of_cities__siggraph2001.pdf[/url]
Read this paper if you're interested.
[img]http://filesmelt.com/dl/mp1.png[/img]
So I wrote a quick hack to put 2 player multiplayer into my Mario (PS3 controller & keyboard), and my mom who has probably never played a video game had great fun. She didn't want to kill the Goomba because "It does nothing bad".
[QUOTE=Richy19;28617290]Does anyone have a tutorial or an algorithm or anything for generating procedural cities?
Something like this:
[img_thumb]http://img263.imageshack.us/img263/1261/48259781.png[/img_thumb][/QUOTE]
[url]http://dl.dropbox.com/u/50837/City_Generation.zip[/url]
There. Don't know where I got it, but it's a whole folder full of stuff on this.
[IMG]http://i.imgur.com/DW6Rl.jpg[/IMG]
[editline]15th March 2011[/editline]
[IMG]http://i.imgur.com/8hB31.jpg[/IMG]
Maybe most of you have seen this already, but [url=http://dl.fefe.de/optimizer-isec.pdf][b]here[/b][/url]'s a document describing how different compilers optimize your code. It discusses things like inlining and bitwise substitutes for multiplication and division.
Anyone know a good set of C# tutorials? I'm trying [url=http://archive.gamedev.net/community/forums/default.asp?pid=84]these[/url] ones, but they're from 2007 and I'm not sure learning from them is wise.
Unless its something like XNA, tuts from 2007 will be fine.
.NET hasn't changed that radically since then.
Once I gave up learning rotation matrices which I weren't really gonna use anyway, progress sped up quite a bit.
My project has turned into more of a programmer's approach to mapping in hammer than a simple terrain generator.
[img]http://i.cubeupload.com/bhnihn.png[/img]
That yellow lump in the highlighted displacement is "Blk"
[cpp]
Map MyMap = Map();
// Generate some terrain with a resolution of 7, smoothing value of 2.0, and noise 1000
Terrain Gen( 7, 2.0 );
Gen.Generate( 1000 );
// Use the terrain we generated before as a displacement
Displacement Disp( &Gen );
Disp.SetSize( Vector( 4000, 4000, 10 ) );
Disp.SetPosition( Vector( 0, 0, -3950 ) );
// Create a hollow block encompassing the entire displacement
HollowBlock Hollow( Vector( 0, 0, 0 ), Vector( 4000, 4000, 8000 ), Vector( 0, 0, 0 ), -32 );
// and set the inwards-pointing texture to skybox
Hollow.SetMaterial( SIDE_INNER, "tools/toolsskybox" );
// Create a block at the tip of the terrain at point 10, 10.
// This has a size of 50x50x50
Block Blk( Disp.GetPoint( 10, 10 ), Vector( 0, 0, 0), Vector( 50, 50, 50 ) );
// Add them to the map
MyMap.AddSolid( &Blk );
MyMap.AddSolid( &Disp );
MyMap.AddSolid( &Hollow );
// Write the map info, then go through each of the child elements and write their translated content to the file.
MyMap.Output( "Output.vmf" );
[/cpp]
[QUOTE=Dr Magnusson;28619957][cpp]
Map MyMap = Map();
[/cpp][/QUOTE]
If the code is C++ then you don't need to do stuff like this. "Map MyMap;" will do.
Same for Java.
Edit:
Rate me dumb, of course it's not Java.
But it would work for Java.
Actually, having looked at it, when you wanted to use any of MyMap's methods you'd need to do that. I assumed that later on he'd used a method to assign a Map object to MyMap before using its methods. Just ignore me, I'm being an idiot.
[QUOTE=Jack Trades;28618585][img_thumb]http://i.imgur.com/DW6Rl.jpg[/img_thumb]
[editline]15th March 2011[/editline]
[img_thumb]http://i.imgur.com/8hB31.jpg[/img_thumb][/QUOTE]
Could you make high-rez versions of those so I can have new desktop wallpapers?
[QUOTE=Dr Magnusson;28619957]That yellow lump in the highlighted displacement is "Blk"[/QUOTE]
I am not a yellow lump. :saddowns:
Trying to make a simple GUI to get my head around... something.
[code]import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
public class Gui extends JFrame{
private JLabel cashLabel;
private JButton updateCash;
private JTextField updateField;
public String cash = "0";
public int updateAmount;
public Scanner input;
public Gui() {
//general constructor crap
super("MoneyMan");
setLayout(new FlowLayout());
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
System.out.println("Error setting native LAF " + e);
}
//event handler for the button
class Handler implements ActionListener {
public void actionPerformed(ActionEvent e) {
cashLabel.setText("£ " + updateField.getText());
}
}
Handler handler = new Handler();
//constructing the GUI
cashLabel = new JLabel("£ "+ cash);
add(cashLabel);
updateCash = new JButton("Update Cash");
updateCash.addActionListener(handler);
add(updateCash);
updateField = new JTextField(5);
add(updateField);
}
}
[/code]
I have the feeling I'm doing something very very wrong.
[b]Edit:[/b]
Okay, mucked around and hacked together a retarded solution. How fix?
Is there an android version of love?
[QUOTE=DeadKiller987;28621934]Could you make high-rez versions of those so I can have new desktop wallpapers?[/QUOTE]
[img]http://cdn.fpcontent.net/fp/ratings/funny2.png[/img]
Messing around a bit with the Android NDK. Getting Lua up and running was easier than I expected.
[img]http://images.overvprojects.nl/SS-2011-03-15_22.08.16.png[/img]
[QUOTE=Staggy11;28618472][url]http://dl.dropbox.com/u/50837/City_Generation.zip[/url]
There. Don't know where I got it, but it's a whole folder full of stuff on this.[/QUOTE]
Haha wow, that's my archives. I've amassed it over the years. I am very passionate about city generation. I posted it there:
[url]http://stackoverflow.com/questions/2233644/what-content-have-you-made-seen-made-using-procedural-techniques/2233709#2233709[/url]
I was just about to link it to that guy, but apparently it already went around the internet!
[QUOTE=Xeon06;28623221]Haha wow, that's my archives. I've amassed it over the years. I am very passionate about city generation. I posted it there:
[url]http://stackoverflow.com/questions/2233644/what-content-have-you-made-seen-made-using-procedural-techniques/2233709#2233709[/url]
I was just about to link it to that guy, but apparently it already went around the internet![/QUOTE]
[media]http://www.youtube.com/watch?v=yI5YOFR1Wus&feature=fvw[/media]
That is incredibly awesome.
Getting back into SFML and I have this doubt. I want to have a dynamic data structure to hold all my drawables. For now what I have set up is a c++ list of pointers to sf::Drawble.
I want this list, as well as the RenderWindow, to be accessible by different functions across the program and not just main.
I know I can just pass a pointer around as one of the function's arguments, but I would like to avoid this, as it gets messy really fast from my experience.
So the question is, do I make these global variables, do I keep them in the main() and pass pointers around or do I do something else?
Sorry, you need to Log In to post a reply to this thread.