[QUOTE=TheBoff;19709014]I would say you're doing it wrong.
If I were you, I would have a projectile entity.
Have a force on it. Each frame, calculate an acceleration, based on the force, a new velocity based on the acceleration and a new position based on the velocity and the acceleration.
Launch it with a certain force. Have a force acting downwards based on 9.8 * the weight, and another for wind.[/QUOTE]
That's good enough for games, but it's not 100% accurate.
Is anyone good with Java here? I'm trying to make a text box that shows date and time. My book says that I should use this method: Calendar.getInstance().getTime().toString(); but I have no idea where to put it exactly. I want it to show the date and time and above that show a text saying "Date and Time" aswell.
Here is what I got so far:
[code]import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Dateandtime {
public static void main (String[] arg) {
JOptionPane.showMessageDialog(null, "Date and Time: ");
Calendar.getInstance().getTime().toString();
Toolkit.getDefaultToolkit().beep();
System.exit(0);
}
}
[/code]
[QUOTE=CommanderPT;19709522]Is anyone good with Java here? I'm trying to make a text box that shows date and time. My book says that I should use this method: Calendar.getInstance().getTime().toString(); but I have no idea where to put it exactly. I want it to show the date and time and above that show a text saying "Date and Time" aswell.[/QUOTE]
The last method called in Calendar.getInstance().getTime().toString() is toString(), which means that whatever value is returned by Calendar.getInstance().getTime(), will be converted into a string. This means that you can simply set the text of your message box to;
Calendar.getInstance().getTime().toString()
In the same way that you showed "Hej" before.
[QUOTE=Shanethe13;19709617]The last method called in Calendar.getInstance().getTime().toString() is toString(), which means that whatever value is returned by Calendar.getInstance().getTime(), will be converted into a string. This means that you can simply set the text of your message box to;
Calendar.getInstance().getTime().toString()
In the same way that you showed "Hej" before.[/QUOTE]
Like this?
[code]import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Dateandtime {
public static void main (String[] arg) {
JOptionPane.showMessageDialog(null, "Calendar.getInstance().getTime().toString()");
Toolkit.getDefaultToolkit().beep();
System.exit(0);
}
}
[/code]
Because that didn't seem to work. I just get a text box saying Calendar.getInstance().getTime().toString() rather than showing date and time. I think I'm missing something here.
[QUOTE=CommanderPT;19709914]Like this?
Because that didn't seem to work. I just get a text box saying Calendar.getInstance().getTime().toString() rather than showing date and time. I think I'm missing something here.[/QUOTE]
So close: since you have it in quotation marks, it displays that exact text. Remove the quotation marks, and it should work :D
[QUOTE=Shanethe13;19709937]So close: since you have it in quotation marks, it displays that exact text. Remove the quotation marks, and it should work :D[/QUOTE]
Yay, thanks! It works now.
[code]import javax.swing.*;
import java.awt.*;
import java.util.*;
public class Dateandtime {
public static void main (String[] arg) {
JOptionPane.showMessageDialog(null, "Date and Time: " + "\n" + Calendar.getInstance().getTime().toString());
Toolkit.getDefaultToolkit().beep();
System.exit(0);
}
}
[/code]
And there you have it! The task I got (from my book), was to make a box with two lines, the first on saying Date and Time, the second one saying.. well the obvious, the actual date and time. Wasn't sure how I was going to tell it to put it on the second line without adding " marks but I did it! I like this book so much, gives me instructions but not exactly what to do so I can experiment a little.
[QUOTE=TheBoff;19709014]I would say you're doing it wrong.
If I were you, I would have a projectile entity.
Have a force on it. Each frame, calculate an acceleration, based on the force, a new velocity based on the acceleration and a new position based on the velocity and the acceleration.
Launch it with a certain force. Have a force acting downwards based on 9.8 * the weight, and another for wind.[/QUOTE]
That seems like a better idea
[QUOTE=Robber;19709070]That's good enough for games, but it's not 100% accurate.[/QUOTE]
Of course it's not 100% accurate, it's based on classical mechanics!
Seriously, what are you trying to say? I can't really find anything particularly inaccurate with that way to do it. Except the obvious confusion with weight and mass.
[QUOTE=ThePuska;19710379]Of course it's not 100% accurate, it's based on classical mechanics!
Seriously, what are you trying to say? I can't really find anything particularly inaccurate with that way to do it. Except the obvious confusion with weight and mass.[/QUOTE]
It's dependent on the steps between the frames. That means it could get different results under the same conditions. 0.1 second per step vs. 0.01 seconds per step shouldn't get different results. As I said it's ok for realtime animations, but if he's generating a curve or something similar he should use the proper formula to calculate the position per pixel, not per time.
[B]Edit:[/B]
Projectiles... maybe he [I]is [/I]working on a game, in that case I retract my statements.
Working on a system to translate supplier info to amazon market info automatically.
Yay internship, boo amazon's shitty system.
[QUOTE=Robber;19710599]Projectiles... maybe he [I]is [/I]working on a game, in that case I retract my statements.[/QUOTE]
I'm making a [url=http://www.facepunch.com/showpost.php?p=19211610&postcount=673]Worms Clone[/url]
[editline]0[/editline]
Actually that screenshot is ancient.
[QUOTE=Robber;19710599]It's dependent on the steps between the frames. That means it could get different results under the same conditions. 0.1 second per step vs. 0.01 seconds per step shouldn't get different results. As I said it's ok for realtime animations, but if he's generating a curve or something similar he should use the proper formula to calculate the position per pixel, not per time.
[B]Edit:[/B]
Projectiles... maybe he [I]is [/I]working on a game, in that case I retract my statements.[/QUOTE]
The formula x = v*t + 0.5*a*t^2 will result in the same distance regardless of tick frequency if the acceleration remains a constant. If it doesn't, you're going to have a hard time coming up with a function that predicts its changes anyway.
Though admittedly you're bound to get more rounding errors the more often you calculate the tick.
[QUOTE=ThePuska;19711241]If it doesn't, you're going to have a hard time coming up with a function that predicts its changes anyway.[/QUOTE]
That's why different integrators exist other than Euler, such as Verlet, Runge-Kutta, etc.
-nvm-
[QUOTE=nullsquared;19711862]That's why different integrators exist other than Euler, such as Verlet, Runge-Kutta, etc.[/QUOTE]
I am unfamiliar with these dishes
[img]http://www.tezzanator.net/stuff/EntityEvents.png[/img]
Got Inter-Entity Events working :D. The above example is a "TimedTrigger" Entity Raising the event "egg" every 1001ms which "DebugEntity" can respond to. works (in a way) a bit like the older unreal engines. (Event->Tag).
[code]
> scene.listall
ID Type Inherits Tag Event
-----------------------------------------------------
0 DebugEntity BaseEntity egg
1 TimedTrigger BaseEntity egg
[/code]
I'm not tackling graphics yet, (I'm Learning OpenGL and brushing up on my 3D mathematics While I code this stuff) - I may end up making this thing a 2D Engine.
I'm still working on a Firefox extension, but this shit is confusing! I've programmed a webcam driver goddammit, but I can't even manage a seemingly simple task with this shit :eng99:
[QUOTE=iPope;19708050][URL="http://filesmelt.com/"][IMG]http://filesmelt.com/dl/cave5.png[/IMG][/URL]
[URL="http://filesmelt.com/"][IMG]http://filesmelt.com/dl/screenie12.png[/IMG][/URL]
Working on a game about Percy Pig for my mums birthday, turning out to be quite fun. Above is the little map editor I made and map loading in the game.[/QUOTE]
which api do you use for rendering?
[QUOTE=likesoursugar;19712494]which api do you use for rendering?[/QUOTE]
It starts with py and rhymes with tame
[img_thumb]http://facepalm.se/img/Texturerereer.png[/img_thumb]
I really start to love exploring my planets now. I'm almost done with the more detailed texturing and after that I only need to do some tweaking to make the landscape even more interesting to explore.
As seen in the picture there's maybe at bit too much sand but I'm making everything very easy to customize so it shouldn't be a problem for me to change that later :D
My deadline is 25th March so depending on the amount of tweaking I should have enough time to add some more stuff, like clouds and starfields.
[QUOTE=dezek;19712826][img_thumb]http://facepalm.se/img/Texturerereer.png[/img_thumb]
I really start to love exploring my planets now. I'm almost done with the more detailed texturing and after that I only need to do some tweaking to make the landscape even more interesting to explore.
As seen in the picture there's maybe at bit too much sand but I'm making everything very easy to customize so it shouldn't be a problem for me to change that later :D
My deadline is 25th Mars so depending on the amount of tweaking I should have enough time to add some more stuff, like clouds and starfields.[/QUOTE]
That looks really cool. Does it render in 3-dimensional space, or is it just shaded to look 3D? How difficult of a project you say that's been? My programming course is starting in a week and a half, and I'd like to make something along those lines, smaller in scale though.
[QUOTE=dezek;19712826][img_thumb]http://facepalm.se/img/Texturerereer.png[/img_thumb]
I really start to love exploring my planets now. I'm almost done with the more detailed texturing and after that I only need to do some tweaking to make the landscape even more interesting to explore.
As seen in the picture there's maybe at bit too much sand but I'm making everything very easy to customize so it shouldn't be a problem for me to change that later :D
My deadline is 25th Mars so depending on the amount of tweaking I should have enough time to add some more stuff, like clouds and starfields.[/QUOTE]
This looks nice, but it looks generated. Some sort of erosion algorithm might fix that up.
The only thing that bugs me is the fact that the lines that makeup the circle of the planet are so visible.
[QUOTE=dezek;19712826][img_thumb]http://facepalm.se/img/Texturerereer.png[/img_thumb]
I really start to love exploring my planets now. I'm almost done with the more detailed texturing and after that I only need to do some tweaking to make the landscape even more interesting to explore.
As seen in the picture there's maybe at bit too much sand but I'm making everything very easy to customize so it shouldn't be a problem for me to change that later :D
My deadline is 25th Mars so depending on the amount of tweaking I should have enough time to add some more stuff, like clouds and starfields.[/QUOTE]
Nice, can we get an exe? Oh and by the way, in English we say March (I'm guessing french is your native language ;).
[QUOTE=Shanethe13;19713278]That looks really cool. Does it render in 3-dimensional space, or is it just shaded to look 3D? How difficult of a project you say that's been? My programming course is starting in a week and a half, and I'd like to make something along those lines, smaller in scale though.[/QUOTE]
It's in 3d, from the position in the image you can fly seamlesly down to ground level and see mountains, ridges, etc.
I can't say I tought it was near impossible but I can't say it was easy either. I had my moments when I got stuck but I managed to find ways around it, often by improvising but I did also do a lot of reading (Thank god for internet). The good thing was that I knew programming and a lot of math when I started the project so I didn't have any problem trying to understand and implement stuff from papers and articles.
Now I don't know how much programming experience you have but if you have some experience in 3d graphics it shouldn't be that hard to get something like a normalmapped sphere with some kind of atmosphere.
[QUOTE=Ortzinator;19713554]This looks nice, but it looks generated. Some sort of erosion algorithm might fix that up.[/QUOTE]
I guess your talking about the "sandy" areas. That's supposed to be flat but I'm using to many octaves when generating. Still needs some tweaking...
[QUOTE=high;19713965]The only thing that bugs me is the fact that the lines that makeup the circle of the planet are so visible.[/QUOTE]
That's not the planet, it's actually the atmosphere. I was trying to get it run nicely on my crappy laptop and after changing the atmosphere I forgot to change it back. :v:
[QUOTE=Xeon06;19714058]Nice, can we get an exe? Oh and by the way, in English we say March (I'm guessing french is your native language ;).[/QUOTE]
I was actually thinking about releasing a demo to try the performance but I got stuck in other stuff. Right now I'm adding some simple GUI with some tools so maybe when I'm done with that.
Ahh, that explains the bad spelling. I can't remember the last time I actually wrote the name of any month in English (I'm from Sweden) :p
Now I'm off to bed...
[QUOTE=CommanderPT;19704536]I have been hard at work developing a software for the everyday pc user. A program that checks your OS! That's right! No longer will you have to struggle in the depths of your pc's rihgt click menues and confusing folders. With a simple click the OsChecker 3000 will check your OS and tell you. With a simple and easy to understand interface, you are one click away from finding out!
OsChecker 3000 is currently in the bugfixing stages and will be released soon for 9.99$!
[/QUOTE]
I love the idea of you creating a commercial application like 1 day after starting on a programming book.
[QUOTE=dezek;19714454]
Now I don't know how much programming experience you have but if you have some experience in 3d graphics it shouldn't be that hard to get something like a normalmapped sphere with some kind of atmosphere.
[/QUOTE]
In that case, maybe I'll give it a try. I wouldn't say I'm the greatest programmer, but I have some experience with OpenGL, and unlike most people nowadays, I know how to use Google! I'm not expecting something as advanced as yours, so I should be able to get at least something working.
With boost::bind, is there a nicer way to have the following?
boost::bind(&FollowDumpPatch::MsgHandler, this, _1, _2, _3, _4, _5, _6, _7, _8))
The _1-_8 gets repetitive when you have a lot of these.
Sorry, you need to Log In to post a reply to this thread.