Drew Hedgecoke

Greenhorn
+ Follow
since Feb 05, 2018
Drew likes ...
Eclipse IDE Java Windows
Merit badge: grant badges
Biography
I am an 18 learning as much coding as I can for preparation into college, where I am hoping to get a job in some form of coding.
For More
United States, TX
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
13
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Drew Hedgecoke

Thank you very much for the help. I quickly began to realize how messy creating separate threads can be and that Threads should be used very sparingly. That being said, I'll take a look at the executor service you mentioned and work it into my code for more physics based math as that's fairly separate from window and input and shouldn't cause too much consistency issues. This was very helpful!
10 months ago
Never realized that spacing was something that bothered people, I'll translate when sharing code for the next time. I intentionally space things out that way for my own comprehension of the code I write, java is one of those languages where whitespace doesn't really affect things so I decided to use it to help group/organize sections of my code. I hope I understood that statement you made correctly.

I use currentTimeMillis as opposed to nanoTime since, although less precise, is more consistent and less machine-dependent on functionality.

The outside loop is the main game loop. Everything runs inside here, and if not that means the programs either just starting or shutting down. That inside while loop is "pause" button, if you will. It's meant to pace the machine use system time in order to keep game updates consistent. As you know, the speed of code execution is based on the specs of the machine being ran, and you can imagine how insane physics would be if it were updated a million times a second because of a high end computer.

I have heard of the Timer utility, and in fact I'm using it in one of my classes. I never thought of using that... Might work. I'll look into it.

Here's the guide I was referencing, not sure why I didn't link this before: https://lwjglgamedev.gitbooks.io/3d-game-development-with-lwjgl/content/chapter02/chapter2.html
11 months ago
I'm trying to learn how to develop a game engine. I've made my Input and Window classes. Now, I'm trying to figure out how to properly use Threads and make my first game loop. Obviously I could take from the countless examples they have and just go along with it, but I need it done in a specific way so that everything on the screen will be rendered at an fps equal to the monitor's refresh rate while making sure physics and other calculations are running at their own separate pace so they don't go insane from high framerates. But saying this and doing this are two different things, and I actually need to understand how it works instead of just using the one that the LWJGL uses.

I've made a small piece of code to help me measure how fast my updates are so that I check to see if it hits the magic number 60 that I want.



My hope is that I can use my game loop to first update the game state, then the while loop I have to constantly render until about 16ms have passed (once per 60 seconds). I've noticed that the LWJGL guide does the exact opposite way, constantly updating the game state while pausing the rendering, which confuses me.

Lastly, I want to access my Input class from anywhere in my code without creating concurrency issues or other exceptions. I've noticed that right now I have to be on the exact same thread to use it. It also utilizes static methods from a class of mine I made for memory allocation.

That's about it, please let me know if I need to clarify some things.
11 months ago
I feel so stupid for that. You were right, I did not close the scans, therefore whenever the next time an event happened, its still scanning my file, therefore it cannot delete it. I apologize for the messy code, and thank you for the suggestion, I'll make sure to do that. Appreciate the help everyone.
5 years ago
As requested, I'm posting the code. I'm not experienced, so some things may be a bit unnecessary. And, to clear things up, I'm creating a bot for discord. I'm using the JDA (Java Discord API) and a couple of their objects and methods. "channel" discovers in what channel this user sent the message, "sendMessage()" is, to the point, sends a message to that discord server using the bot, "message" contains the raw content of the message sent by any user, and "queue()" sets the messages sent to the bot in an order by which came first. Hope that helps.

To summarize, first, I create a new text document, add the tag "(copy)" to it, and reference the original. During this process, I check if the current line starts with "Wallet:", and if it does, I add the user's amount to the amount listed in the original text document, and then I print the result in that current line of the duplicate.


Then, I re-write over the original by referencing the duplicate. After this, I attempt to delete the duplicate.


Hopefully that clears it up.
5 years ago
Nothing, other than Windows Explorer in that directory. The file is not open in anything else, unless their is something hidden going on, thought I cannot imagine that.

NDH Bot is the program folder that I have for the code I'm creating. It's stored in a hard drive that does not contain the OS, and I manually named it Program Files. I like to keep my OS very light.
5 years ago
Whenever the code reaches:



I get this exception:

java.nio.file.FileSystemException: D:\Program Files\Utility\NDH Bot\resource\profiles\test(copy).txt: The process cannot access the file because it is being used by another process.

Extra information, content is the raw message received by a user through discord. I have the command arguments like so:

This is to change things in a text file, such as a user's wallet amount.
5 years ago
I'm trying to duplicate a text document, re-write a portion of this text document, then re-write over the orginal using the duplicate. After the process is done, I'd like to delete the duplicate file, but I cannot do so. I keep seeing online that you cannot delete a file in a directory that contains other files, but I can't believe that to be true. Maybe I'm misunderstanding, I'm not sure.

If code is needed, I'll provide it, though it's a bit lengthy. But my question is, how do I delete a file within a directory with other files?
5 years ago
Sresh Rangi, the messages you see weren't the one's I was referring to. Those messages were from automated bots. The real messages I was referring to were taken down, due to my account being deleted and/or them going against their policy.

To summarize, there was a person who answered my question correctly, and after that one there was a comment to my post by someone, and his first response was he was giving me a downvote because I didn't use proper terminolgy. I used the phrase "didn't work" instead of "didn't compile." I mean, how petty can you get? Funny part was, right after that, his answer to my question was a literally copy of the first answer, save for a couple comments.

My question wasn't "elegant," but it was to-the-point and I spent a good amount of time trying to make it as simple as possible. I never go to a forum page and just throw out a question without thinking about making it as clear as I can.
5 years ago
Andy Crowther, I'm not going to pretend that I didn't over-react. That much is true. It's been a while since that had occurred, and I learned a lot since then - still just new to the whole thing though. Now that I take a step back and look at it objectively, I can still say that it was ridiculous. The reason the first one upset me was that he was intentionally being condescending. It was pretty clear to see. It affected me so much because I was putting a lot of effort into learning, and when the person you seek assistance from just makes a message like that, depending on the person you are, it can really put you down. The second one, I knew it was an automated message. I was upset that I got the automated message, and they didn't. I knew they didn't, because they went right back to posting later. I was looking through their history at the time I was sent that bot message. And for the third point, I don't exactly know what you were referring to. I know I wasn't the only one this happens to because I looked over the internet right after to see situations like mine.

But this place has been very kind to me. Everyone's extremely helpful here. From now on I've learned to search online at least for about ten minutes before I post a question, and I'm starting to learn more and more. I really love the Coderanch
5 years ago
Your advice worked. I checked up on the documentation and used the magic of ctrl+f. Exactly like you said. I just used "\\" before the dollar sign, and it split correctly. I appreciate the help.
5 years ago
A little off topic, but as I'm a beginner at java with basic knowledge, people continuously point me to these documentation websites. However, every time I attempt to learn from there, they use language that is hard to understand except for user's who are more advanced into the subject. I find myself reading the same sentences four or five times over and can't wrap my brain around them. The only reason I've gotten this far was simply by playing around with the program and codecademy.

Anywho, I'll try out your advice and see if it gets anywhere.
5 years ago
I believe I was typing the main command itself into it.
The entered command:

What I tried to do:
5 years ago
So I'm at a loss here. What I have is a string that picks up if a user types a certain command. If they don't add an argument at the end, the code block doesn't run. What I need to do is remove the basic command from the string, and storing the user's argument in a separate string. I have attempted using split's but every result I get doesn't have two separate indexes. If I use [1] instead of [0] on the split string, i get an ArrayOutOfBoundsException: 1


Example:
The result of grabbing the user's input
What I want:
5 years ago
After a lot of time and research, I've finally solved it myself. For those in the future:
• I created the batch file by creating a new text document and changing the extension from .txt to .bat
• I made sure to place this file in the same directory as the .jar file
• I right-clicked the bat file and selected edit, then inserted the command line inside of it.
• Double click the .bat file and it should run your program in window's CMD!
5 years ago