Jump to content

  • Log In with Google      Sign In   
  • Create Account

viper110110

Member Since 11 Nov 2008
Offline Last Active Yesterday, 05:47 PM

#5277158 thesis game dev programming related

Posted by on 20 February 2016 - 09:30 AM

Procedural terrain generation is a common one I've seen a few people do (myself included).

 

Network prediction might be an interesting one, or implement some sort of graphical feature. I'm not sure your school's policy on working with your friends, but mine was that your part of the project had to be runnable and marked on its own.




#5256945 Game development with assembly. Where to start?

Posted by on 12 October 2015 - 06:48 PM

I'm not entirely sure about game dev in assembly, but I do know that rollercoaster tycoon was made in assembly except for the parts to interface with windows and directx. My guess would be that you have to do something along those lines.

 

Alternatively, make a game using ascii art?




#5237130 If-else coding style

Posted by on 27 June 2015 - 12:18 PM

 

 

Hi,

This isn't strictly game related, but I like you guys so I thought I'd post it here. I work with C# for my job, and we have to undergo code reviews. Yesterday I finished a work item and used code similar to the following in several places:

SomeType GetSomething 
{ 
    get 
    { 
        if (somecondition) 
        { 
            return something; 
        } 
        else 
        { 
            return null; 
        } 
    } 
}

My code review was completed as "needs work" on the grounds that the above code was "very misleading", which I don't get at all. I understand the "else" isn't necessary here, but I think it not only makes it much more readable, but perfectly follows the way the getter would work if you were to describe it in English: "If this is true, return that; otherwise, return null". Without the else, if you didn't look into the "if" block you might think that the getter ALWAYS returns null. With it, you instantly understand that either the "if" block executes and returns, or the "else" block executes and returns, without even looking at the contents of either of them.

Even if you consider the above to be unnecessary, I still don't get how you could call it misleading. It does exactly the same thing as the alternative he was suggesting (remove the else and just return), only it's much more explicit about it: which is the exact opposite of misleading.

Anyway, I just had to rant about that. I love my job, but everyone I work with is a very experienced coder from different backgrounds, and sometimes our ideologies conflict. What are your thoughts?

 

 

Personally i would invert the logic

get {
 
    if (!somecondition) {
        return null;
    }
 
    //code goes here
 
    return something;
}

 

 

I like what you did, and if I recall correctly its what resharper and/or stylecop will suggest to reduce nesting.

 

The right thing to do is to find out exactly what your coding standards should be at your place of work. If there is no hard established standard, you should ask about establishing one. Where I work, we have a wiki article describing the standard and an emacs config that enforces it.




#5214104 Delaunay Traingulation

Posted by on 02 March 2015 - 11:12 PM


I would greatly appreciate it if I could take a look at how you solved this!

 

https://www.dropbox.com/s/3nb5lkh8yybrlbs/voronoi%20stuff.zip?dl=0

 

That should contain everything I did related to voronoi/delauny. You might also need Vector2 and Vector3 classes. Everything from the link I posted should still work. Use is as follows:

        float* xValues = new float[numNodes];
	float* yValues = new float[numNodes];

	for (int i = 0; i < numNodes; i++)
	{
		xValues[i] = RandomFloat(size);
		yValues[i] = RandomFloat(size);
	}

	VoronoiDiagramGenerator vdg;
	vdg.generateVoronoi(xValues, yValues, numNodes, 0, size, 0, size, 0.0f);

	points = vdg.outputPoints;
	edges = vdg.outputEdges;
	edgeEndPoints = vdg.outputEndPoints;

You can access the delauny triangulation through:

points[i]->edges[j]->GetOppositePoint(points[i])



#5214035 Delaunay Traingulation

Posted by on 02 March 2015 - 03:30 PM

I'm working on exactly your problem for my honours project. I've found that the code here http://www.skynet.ie/~sos/mapviewer/voronoi.php is easier to use than Fortune's original C code. I've modified it to output vectors of the input points, the edges, and the end points of the edges. The end points for the edges are joined together, so if two lines end at the same point, the line class points to the same end point. I could send you my code if you'd like.

 

Map_Generator_2015_01_31_23_08_42_53.jpg




#5193633 Need a short name to replace a really really long function's name

Posted by on 19 November 2014 - 11:10 AM

I think long function names are generally a good thing as they are more descriptive. As long as you have some sort of autocomplete, you shouldn't have to type it all out, and most nowadays support just typing the initials (SPBOCP). If you are looking to reduce the length of the names, think about what information is implied by the function parameters and return type.

 

If I have a function

public List<Friend> GetListOfFriendsByID (int id)
{
    //Return new list with my friends
}

I can see that it clearly returns a List and I can clearly see that I am passing in an id. I can now shorten the name to

public List<Friend> GetFriends (int id)



#5182946 UDP Multiplayer Movement Jitter.

Posted by on 25 September 2014 - 12:08 PM

I think what you would be looking for is a very simple incrementing ID system. Basically, when the server sends out an updated position, the first time it will have an ID of 1. Then the next time it is 2. 2 is greater than 1, so we can update our client based on the new position. Then the server sends out packet 3, but it never reaches the client. Then the server sends out 4, which reaches the client. 4 is greater than 2, so update the position. Then 3 manages to find its way to the client. 3 is not greater than 4, so ignore it.




#5181020 Optimization philosophy and what to do when performance doesn't cut it?

Posted by on 17 September 2014 - 08:40 AM

I frequently find myself having to choose between a more readable line and a faster line. I then leave myself a big comment like this:

// Performance: use Hard2ReadFunc1() + Hard2ReadFunc2()
x = EasyToReadFunction()

That way I can save the brain power, but I will only optimize it if profiling leads me to that spot.




#5096871 What program to use to add alpha

Posted by on 26 September 2013 - 12:39 AM


do you need to compute the alpha values from the rgb channels of the current image, or are you using a different image as a source?

 

I am somewhat basing it off the current image. I basically want to take the current image and then stretch the range of values to be full 0-255. That way a dark texture won't always fall below a light texture. The current best way for me seems to be to use paint.net to convert to greyscale, adjust the range manually based on the histogram, then save the greyscale image and import both into the directx texture tool.




#5096446 What program to use to add alpha

Posted by on 24 September 2013 - 12:10 PM

Another method is to create a separate greyscale image that serves as an alpha-channel. You can use the DirectX Texture Tool to load the image into the alpha-channel of an RGBA image to combine the two.

I like this one. I want to be able to manipulate the range of the heights that I am generating.




#5096407 What program to use to add alpha

Posted by on 24 September 2013 - 07:58 AM

I want to use the alpha channel to add height data to my textures. I am currently getting textures online and then using paint.net to convert them to DDS. Problem with paint.net is that I can't set the alpha to zero while maintaining the RGB data. It also makes editing a pain if I want to make changes. I can calculate the height on the fly based on the average of the rgb, but I would prefer to use an actual map so that I can adjust the values myself.




#5043231 There has to be a better way... (to get text)

Posted by on 14 March 2013 - 07:46 PM

Is there a better way to do the following?

 

I tried importing Microsoft.VisualBasic and then using Interaction.InputBox() but it sometimes crashed and otherwise froze the game.

 

string text = string.Empty;

            if (IsNewKeyPress(Keys.A))
            {
                if (CurrentKeyboardState.IsKeyDown(Keys.LeftShift) || CurrentKeyboardState.IsKeyDown(Keys.RightShift))
                {
                    text += "A";
                }
                else
                {
                    text += "a";
                }
            }
            if (IsNewKeyPress(Keys.B))
            {
                if (CurrentKeyboardState.IsKeyDown(Keys.LeftShift) || CurrentKeyboardState.IsKeyDown(Keys.RightShift))
                {
                    text += "B";
                }
                else
                {
                    text += "b";
                }
            }
           //Through z, plus numbers

 




#5037791 Baby's first pixel art

Posted by on 28 February 2013 - 05:15 PM

Looking a lot better! i think what most people do wrong is to go for the classic hard black color for outlining. If you do want to use a "black" outline, soften down the color, make it a bit closer to gray. and people forget shades. 

but yea, a lot of progress comes from trying. try different looks, different mouth, without glasses, other glasses and so on. try try try tongue.png

 

Thanks. I saw a tutorial about a week ago that said start with a black outline for your shape. I guess I forgot to get rid of it after.

 

I spent less than 10 min on this but figured i would show you how you can make it look better:

 

gallery_1_8_1302.jpg

 

Cool. You went with 64x64, which I wasn't originally going with, but I can now see that it makes his jacket look much better. Don't like the face much, but that's just opinion. I think I will go with 64x64 now that I've seen this. You've also shown me some good shading.

 

I changed most of the black lines to darker shades of the bordering colour. I left his shoes, sunglasses, and whatever is in his backpack black. I also gave him thumbs, but I don't think I like the whole thumbs-up thing because he will be holding a gun. I'd like to give him fingers, but I'm not quite sure how to go about that. Would it be beneficial to start over at 64x64? I just thought it would be easier to draw a smaller image and scale it and I don't have my heart set on the pixelated look. Also, his hands were already the same size (3x3) but they aren't level with each other. Should I move them?

 

bloomanfull.png

 

Basically, the lower the resolution, the harder it gets to make the little squares look like they're not little squares. But the higher the resolution, the more pixels you have to deal with. It's a balance between simplicity and complexity.

 

I think your issue is that it looks like you started out already digital, which is tempting to do but not the best way to go. It's almost always better to sketch out a few ideas on paper, preferably after looking at a few references online of similar characters in other games. Paper's important because it lets you throw several ideas out there really quickly without getting too attached to any one. Once you have a handful of sketches, you can then take your favorite parts from each one and start the digital version. For pixel art this is especially important because if you start out with pixels, it can be hard to see how that translates into smoother less pixel-y looking shapes.

 

I definitely did start out digital. I honestly can't draw much at all on paper. It already looks much better on the computer than I would be capable of with a pencil.




#5036726 Baby's first pixel art

Posted by on 26 February 2013 - 09:35 AM

I changed most of the black lines to darker shades of the bordering colour. I left his shoes, sunglasses, and whatever is in his backpack black. I also gave him thumbs, but I don't think I like the whole thumbs-up thing because he will be holding a gun. I'd like to give him fingers, but I'm not quite sure how to go about that. Would it be beneficial to start over at 64x64? I just thought it would be easier to draw a smaller image and scale it and I don't have my heart set on the pixelated look. Also, his hands were already the same size (3x3) but they aren't level with each other. Should I move them?

 

bloomanfull.png




#4998295 Non power of two texture in DirectX

Posted by on 06 November 2012 - 07:39 PM

I am trying to load textures in the same way as the rastertek tutorials do it, but when I get to the font tutorial, the texture for the font won't load. After some thorough detective work, I determined that it was because one of the texture dimensions was not a power of two. How can I get directx to load any texture regardless of size?

Edit: Just figured out that he uses a power of two texture for the font and posted a different texture on his website (with a bad size). Regardless, I would still like to know how to handle non-power-of-two textures




PARTNERS