Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 09 Jan 2007
Offline Last Active Feb 18 2015 10:27 PM

#5147841 Do you have any tips to share on making/creating a level editor?

Posted by tom_mai78101 on 18 April 2014 - 03:06 AM

Understood. smile.png


I got my own custom level editor finished, with the main features, "New", "Save", and "Open", done. Even though I started working on the editor with a different set of rendering pipeline down the road, I used what I learned from here to create it. biggrin.png  It's a wonderful experience, and I'll probably share it on the Developer's Journal.

#5134934 This is what atan2() does if given two Vector2D points on 2D plane?

Posted by tom_mai78101 on 26 February 2014 - 09:13 PM

My mind cracked into place. Now, it is obvious to me.

Thank you for all of your time. Problem solved.

#5134120 Is that a ordinary way to develop console game on PC?

Posted by tom_mai78101 on 24 February 2014 - 09:42 AM

EDIT: I see that I might be getting incorrect conceptions on this, therefore I'll remove them. I'll leave this post blank and move on.

#5134119 OpenGL ES 2.0: Text from TextView isn't showing up

Posted by tom_mai78101 on 24 February 2014 - 09:28 AM

Okay, for the Asus Transformer Pad, I have finally found the cause:


Stack Overflow Q&A tells me that because of the generated bitmap, on some devices, the bitmap size is a power of two, therefore the texture is drawn to the screen. On other devices, such as the tablet, due to its sheer resolution scale, the generated bitmap is not a power of two, therefore it shows up as nothing.


In order to combat this issue, I need to use GL_CLAMP_TO_EDGE or use a source texture from the /res/drawable-noapi folder. The latter prevents Android from density-based scaling from occurring.


Thank you for your time.

#5129640 Before You Graduate From Computer Science: Blog Post by Peter Barrett

Posted by tom_mai78101 on 07 February 2014 - 11:58 AM

Here is a blog post written by Peter Barrett, who happens to have 1 final year left before he is about to obtain his Computer Science degree.


Link: http://peterbarrett.ie/before-you-graduate-from-computer-science/


I just happened to stumbled upon this blog post of his, and found that it contains good (it's great for me, unknown for others) advices for those of you who are about to graduate with a Computer Science major, or had just graduated, but are unsure of what to do next.


I hope Peter's advices helped you and helped others to follow. Cheers!

#5127166 Memory leaks are always contained inside processes, aren't they?

Posted by tom_mai78101 on 29 January 2014 - 03:50 AM

My question has been answered in a meaningful way. Thank you all.

#5118519 How to split up pathfinding? How to implement divide-and-conquer on pathfinding?

Posted by tom_mai78101 on 21 December 2013 - 03:04 AM

Here's an attachment of a ZIP-ed JAR file, containing the current working state of the divide-and-conquer A* pathfinding.


To start, click anywhere in the screen. The pink pixel means the starting node, and the green pixel means the ending node. The background is grayed out, so that the whiter, lighter colors of the path can be displayed easily to the eyes.


Attached File  astar_pixel.zip   16.15KB   56 downloads


One of the paths generated created this path, shown below:




I followed your advice on splitting the screen up into 4 sectors, with each sectors having their portals connecting to each adjacent sectors. I don't know what I've done to get this path. Here's the code for the path above:

	public ArrayList<Node> makePath(Node start, Node goal) {
		System.out.println("Making path from sectors...");
		if (tempPath == null)
			tempPath = new ArrayList<Node>();
		Sector startingSector = findSector(start);
		Sector endingSector = findSector(goal);
		if (startingSector == null || endingSector == null) {
			System.out.println("Something is wrong...");
			return null;
		System.out.println("Calculating different segments of paths from each sectors...");
		System.out.println("The first path...");
		tempPath = createPath(start, startingSector.centerNode);
		System.out.println("The second path...");
		tempPath.addAll(createPath(startingSector.centerNode, endingSector.centerNode));
		System.out.println("The last path...");
		tempPath.addAll(createPath(endingSector.centerNode, goal));
		System.out.println("Paths complete.");
		return tempPath;
	private Sector findSector(Node node) {
		for (Sector sector : sectors) {
			if (sector.boundingBox.hasNode(node))
				return sector;
		return null;

//Box class - the "boundingBox" member is a Box object.

	public boolean hasNode(Node node) {
		int x1 = this.width + this.x;
		int y1 = this.height + this.y;
		if (node.x >= this.x && node.x < x1 && node.y >= this.y && node.y < y1)
			return true;
		return false;

I wanted to ask myself, what else could go wrong?


Java out-of-memory error. There's an infinite loop that for some reasons, the parent of the node is always that same node. (node.parent == node is always true).


So, just to make sure, I did this, in order to stop the infinite loop:

	private ArrayList<Node> recreatePath(Node node) {
		int counter = 0;
		ArrayList<Node> results = new ArrayList<Node>();
		while (node.parent != null) {
			if (node.equals(node.parent)) {
				if (counter > 5)
			node = node.parent;
		System.out.println("Size of path: " + results.size());
		return results;

It might be possible this can cause the weird path in the picture shown above. Got any hints?

#5118483 How to split up pathfinding? How to implement divide-and-conquer on pathfinding?

Posted by tom_mai78101 on 20 December 2013 - 08:54 PM

May I ask, did you use recursive methods to complete this task?

	public ArrayList<Node> createRecursivePath(Node start, Node goal) {
		Node median = getEstimatedMedianNode(start, goal);
		if (median != null) {
			ArrayList<Node> results1 = createPath(start, median);
			ArrayList<Node> results2 = createPath(median, goal);
			return results1;
		else {
			ArrayList<Node> results = createRecursivePath(start, getEstimatedMedianNode(start, median));
			results.addAll(createRecursivePath(getEstimatedMedianNode(median, goal), goal));
			return results;

I know my recursive skills are bad, but I'm thinking I might be going in the right direction. Somehow...

#5101145 Game Programming Books (C++)

Posted by tom_mai78101 on 13 October 2013 - 06:46 PM



There are a bunch of questions asking for game programming books. We have compiled a list of recommended books for you, by following the link shown above. The link can be found at the top of the webpage, where the navigation bar is at.

#5100057 Eclipse: How do you start stepping into/over like how Visual Studio does it i...

Posted by tom_mai78101 on 09 October 2013 - 08:49 PM

In Visual Studio, when you press the Step Into (F11), or Step Over (F10), the compiler automatically builds the program, before stopping at the first line of code, whether it's written in C++ or assembly. It is sometimes useful when it comes to getting to know unfamiliar code in C++, where the main function might be obscured somewhere in the code, and it's hard to find.


I wanted to do the same thing with Eclipse. I wanted it to automatically start the JVM before stopping at the first line of Java code, just like what I explained for Visual Studio above.


Is this possible to do? Are there any methods of invoking such actions?

#5099517 Quaternions: Can you multiply it with vertices, so that the vertices can be a...

Posted by tom_mai78101 on 08 October 2013 - 05:19 AM

Thanks, everyone. And yeah, guess I can step it up.

#4923355 Do you suppose this is an efficient way of writing assembly only in Java?

Posted by tom_mai78101 on 19 March 2012 - 11:32 AM

Posted Image

EDIT: Added a mirror in case Imgur is down.

This is an image posted by the one and only famous "notch" of the Minecraft game.

It's interesting that he's implementing a new variant of 6502 CPU in Java. Suppose you are writing a game that requires a complex CPU as a core gameplay, when you write something like this, do you consider it to be efficient, given that it has to be implemented in a high level programming language?

To me, I haven't seen a method to create a programmable CPU assembly instructions in pure Java sense, until now. This brings up a whole new, and most direct, approach to this.

And other than being efficient or not, what is your point of view in regards to implementing a small complex CPU (like redstone circuitry in Minecraft) in a game?

Thanks in advance.

#4903681 Can we do multithreading without relying on Win32 programming?

Posted by tom_mai78101 on 17 January 2012 - 11:12 AM

I swear, once Microsoft updates their compiler to be compatible with C++1x completely, it will be in year 2020...

Java comes with it because of JVM. .NET is the same story. If there is a VM to C++ like JVM to Java, you would probably get the consistency you get in Java.

EXACTLY how you described my thought! But yeah... If there's a VM for all platforms to C++, then maybe I don't have to worry a thing about this at all. If only Microsoft would create .NET for all platforms available, then I'm in heavens!

#4856236 Java: Does making a variable within a while loop continuously make new instan...

Posted by tom_mai78101 on 01 September 2011 - 05:40 AM

For example:

int firstVariable = 0;
 while (true)
  int secondVariable = 1;
  if (firstVariable > 0xFFFFFFF0)

There are two variables, firstVariable and secondVariable. firstVariable is initialized to 0, and secondVariable is initialized to 1. After a long execution of this small code, what happens to secondVariable? Does Java create new instances of secondVariable every time it runs into that line of code, or it overrides the instance of secondVariable the moment it started existing in the memory?

Side question: Can it also happen in C and/or C++ in Visual Studios?

Thanks in advance.

#4822433 Where do you fill up the void deep within when you're demotivated by exte...

Posted by tom_mai78101 on 12 June 2011 - 10:49 AM

I always thought of myself as a tiny speck of dust in the middle of a clean room, no matter where you look, you can't seem to find a place suitable for you to grow in.

I had never thought of how other people were to look at this, if they were to experience the same thing again and again in different ways.

Man, I feel deeply sorrowful that I actually complained about my situation, and yet, everyone had or will be experiencing this sooner or later, and they aren't even complaining about it; they accepted it and moved on.

Whenever I hit a bottleneck, I feel like I do not have the power to fight over it, I do not have the knowledge to fix it, nor do I have the ability to predict myself when I will be finishing it. There's this urge inside of my body, wanting to do something about it, wanting to know why it does it, how it does it, what's the reason behind all of this, and many many uncertainties I could not answer by myself. I am wrong.

Is this what people call it "depression"?

And I thank the authors of their posts above this for giving me some different perspectives on my current "down" situation. I will be able to find my way out of this.