Following up to my first post in this thread, I've just found out why multiple dynamic lights weren't working. I forgot to copy the client and server dll files. Rate me dumb as much as you like, I deserve it.
[QUOTE=Abbers100;33079193]Following up to my first post in this thread, I've just found out why multiple dynamic lights weren't working. I forgot to copy the client and server dll files. Rate me dumb as much as you like, I deserve it.[/QUOTE]
Some of the best programmers I know have done way dumber things than that.
You deserve hearts for following up on your own question.
From the integration side of it (integrating into a C++ app) what scripting language would be best?
ATM my main choices are Lua(LuaJIT) (for its speed and docummentstion although from what I have read it takes quite a bit to integrate it) or Squirrel (for its similarity with C/C++ and apparently its easier to integrate although there is hardly any documentation and its not as fast as Lua) I should alsomention one of the main things that I like about LuaJIT is that you can precompile the lua and integrate it into the app.
I know that beats the point of a scripting language but I like that feature.
I also have experience with Python, but I dont know how that would work as a scripting language in a game
[QUOTE=Richy19;33080440]From the integration side of it (integrating into a C++ app) what scripting language would be best?
ATM my main choices are Lua(LuaJIT) (for its speed and docummentstion although from what I have read it takes quite a bit to integrate it) or Squirrel (for its similarity with C/C++ and apparently its easier to integrate although there is hardly any documentation and its not as fast as Lua) I should alsomention one of the main things that I like about LuaJIT is that you can precompile the lua and integrate it into the app.
[B]I know that beats the point of a scripting language but I like that feature.[/B]
I also have experience with Python, but I dont know how that would work as a scripting language in a game[/QUOTE]
It doesn't beat the point at all.
During the development stage you use non-compiled code where you would be changing stuff a lot, but before release you would then compile it for the extra speed.
Figured it out.
For those Project Euler problems that require large numbers (example: [url]http://projecteuler.net/problem=13[/url]), how will I go about solving these problems? Are there different types of algorithms I have to learn? Still learning how to program.
[QUOTE=R1Z3;33083013]For those Project Euler problems that require large numbers (example: [url]http://projecteuler.net/problem=13[/url]), how will I go about solving these problems? Are there different types of algorithms I have to learn? Still learning how to program.[/QUOTE]
I'd probably just work out the sum of the first 11 digits of each. Every time your number exceeds 11 digits, chop off the last one. The reason you use 11 digits and not 10 is so you account for rounding up. There's probably a logical error in this but I'd get to that later, if I was doing it.
[code] if (this.dist < 140 && this.dist > 100)
{
this.Attack = true;
this.busy = true;
}
else
{
this.Attack = false;
this.busy = false;
}[/code]
That code is all about the NPC following the player, but when it's outside that distance it doesn't stop. Any ideas why?
[QUOTE=R1Z3;33083013]For those Project Euler problems that require large numbers (example: [url]http://projecteuler.net/problem=13[/url]), how will I go about solving these problems? Are there different types of algorithms I have to learn? Still learning how to program.[/QUOTE]
You can work on your own Big Number library, eg implement numbers as arrays of digits and then implement addition, substraction... It's gonna be slow, but it's very easy to write.
[QUOTE=Parakon;33083889][code] if (this.dist < 140 && this.dist > 100)
{
this.Attack = true;
this.busy = true;
}
else
{
this.Attack = false;
this.busy = false;
}[/code]
That code is all about the NPC following the player, but when it's outside that distance it doesn't stop. Any ideas why?[/QUOTE]
The actual error is probably somewhere else. Can you post the whole file or at least any code that causes it to move?
[QUOTE=R1Z3;33083013]For those Project Euler problems that require large numbers (example: [url]http://projecteuler.net/problem=13[/url]), how will I go about solving these problems? Are there different types of algorithms I have to learn? Still learning how to program.[/QUOTE]
What programming language are you using? There are probably some bignum libraries for that language to do such calculations.
[QUOTE=Richy19;33080440]From the integration side of it (integrating into a C++ app) what scripting language would be best?
ATM my main choices are Lua(LuaJIT) (for its speed and docummentstion although from what I have read it takes quite a bit to integrate it) or Squirrel (for its similarity with C/C++ and apparently its easier to integrate although there is hardly any documentation and its not as fast as Lua) I should alsomention one of the main things that I like about LuaJIT is that you can precompile the lua and integrate it into the app.
I know that beats the point of a scripting language but I like that feature.
I also have experience with Python, but I dont know how that would work as a scripting language in a game[/QUOTE]
Some game engines (Like the one powering Cellfactor: Revolutions and My Horse and Me (yes, the same game engine)) uses Python for controlling various aspects of the game, such as weather.
Regardless of using Python or Lua/JIT or Squirrel, I assume it would work the same way as a scripting language in a game. The only difference would be speed and your implementation of the languages.
The fastest of those clearly would be Lua/JIT (even without the JIT part), but it's all up to you and what you prefer.
I have to submit this by 11 but hopefully someone can help me out before then or I somehow figure it out... :/
[CODE]from math import *
def windchill(t, v):
windchill = (35.74 + (0.6215 * t) - (35.75 * v ** .16) +
(.4275 * t * v ** .16))
return windchill
def main():
for k in range (-20, 70, 10):
print ("%5d" %k, end="")
print()
for windspeed in range (5, 55, 5):
print ("%5d" %windspeed, end="")
for temp in range (-20, 70, 10):
chill = windchill(temp, windspeed)
print ("%5d" %round(chill), end="")
print()
main()
[/CODE]
[IMG]http://i42.tinypic.com/vert5i.png[/IMG]
I need to shift the top heading over one column like this chart [url]http://www.weatherimages.org/data/windchill.html[/url]
I can't get it to work because of the for loop that the print statement is in... I think my teacher mentioned something about newline character or something but I honestly have no idea how that would be used.
EDIT: I'm a derp all I had to do was add print(" ", end="") before the loop LOL.
How do I find the angle from one point to the other in 2D space?
-snip-, wasn't correct, measured the wrong angle-
(edit: ignore this one, sim642 has a much better formula)
Just add spaces before the shiftable line so it would line up.
Having a problem with java, I've got a scanner to read an input, which can either be Stick, Twist or unrecognised, however no matter what I type it counts it as unrecognised
[CODE]
System.out.print("Stick or Twist? : ");
inputString = in.nextLine();
if (inputString == "Stick") {
stickFlag = true;
contFlag = true;
} else if (inputString == "Twist") {
stickFlag = false;
contFlag = true;
} else {
contFlag = false;
System.out.println("Unrecognised input");
}
} else {
contFlag = false;
pBustFlag = true;
}
[/CODE]
ignore all the flags
[QUOTE=farmatyr;33085914]How do I find the angle from one point to the other in 2D space?[/QUOTE]
atan2(y1 - y0, x1 - x0) will be in radians.
[editline]2nd November 2011[/editline]
[QUOTE=fylth;33086012]Having a problem with java, I've got a scanner to read an input, which can either be Stick, Twist or unrecognised, however no matter what I type it counts it as unrecognised
[CODE]
System.out.print("Stick or Twist? : ");
inputString = in.nextLine();
if (inputString == "Stick") {
stickFlag = true;
contFlag = true;
} else if (inputString == "Twist") {
stickFlag = false;
contFlag = true;
} else {
contFlag = false;
System.out.println("Unrecognised input");
}
} else {
contFlag = false;
pBustFlag = true;
}
[/CODE]
ignore all the flags[/QUOTE]
Doesn't Java require something like inputString.equals("Stick") ?
Ah yeah, of course, always forgetting that
Thanks
I'm trying to load a series of images into processing, I have 4000+ images all named halo 0001 to halo 4710. Could somebody please advise me on how to do this (I know it's probably really simple but I'm new to this)
[QUOTE=T3hGamerDK;33085537]Some game engines (Like the one powering Cellfactor: Revolutions and My Horse and Me (yes, the same game engine)) uses Python for controlling various aspects of the game, such as weather.
Regardless of using Python or Lua/JIT or Squirrel, I assume it would work the same way as a scripting language in a game. The only difference would be speed and your implementation of the languages.
The fastest of those clearly would be Lua/JIT (even without the JIT part), but it's all up to you and what you prefer.[/QUOTE]
Only time I've heard of Python in a game-environment is a guy in my class who pretty much spends all day coding (He gets to the lunch room and his laptop's open) is working on a 3D Game in C++ with a Python wrapper for handling environmental elements, etc, while the heavy stuff (3D Processing, etc) is handled by C++.
Makes for a fast game with simplified code (Python is extremely simple.)
[QUOTE=T3hGamerDK;33085537]Some game engines (Like the one powering Cellfactor: Revolutions and My Horse and Me (yes, the same game engine)) uses Python for controlling various aspects of the game, such as weather.
Regardless of using Python or Lua/JIT or Squirrel, I assume it would work the same way as a scripting language in a game. The only difference would be speed and your implementation of the languages.
The fastest of those clearly would be Lua/JIT (even without the JIT part), but it's all up to you and what you prefer.[/QUOTE]
Yea. I think im going to go with Lua, I checked out how to implement both lua and squirrel in C++ and itts pretty much the same. So I rather sacrifice the (my preference) better syntax of squirrel for the speed of lua
I'm doing some exercises for a Java class and we're supposed to use a hashmap to count the instances of a day of the week in a data file and print how many times each appears.
Basic stuff probably, but I can't begin to get my head around hashmaps, we are supposed to work them out ourselves without help from staff.
This is what I have
[code]
static void doStuff(HashMap<String,Event> events){
int AddTemp;
AddTemp = 0;
HashMap<String,Integer> dow =
new HashMap<String,Integer>();
dow.put("Monday",0);
dow.put("Tuesday",0);
dow.put("Wednesday",0);
dow.put("Thursday",0);
dow.put("Friday",0);
for(Event e:events.values()){
if (e.day.equals("Monday"))
AddTemp = dow.get("Monday");
AddTemp++;
dow.put("Monday", AddTemp);
}
System.out.println(dow.toString());
}
[/code]
This just gives me "{Thursday=0, Monday=700, Tuesday=0, Wednesday=0, Friday=0}" and there are nowhere near 700 instances of Monday in the data file so I'd imagine that's Eclipse stopping an infinite load of crap from my unbelivable shittiness at working out what the hell I need to do here.
The only hint we've been given is to use the hashmap I used and then to "loop over dow.keySet()" which I don't understand at all.
-snip-, I can not maths
note that the angle sim642's function returns is relative to the x axis, not the y - an angle of 0 is facing right from your first vector, not up.
Probably obvious to most but it was tripping me up.
Could do with a little more help. I'm writing a game of Blackjack in Java, here is the code for the players turn:
[CODE]
while (stickFlag == false) {
// Pick a random card and suit
// The list of cards the player has is added too with the cards value and suit
// Add to the players score dependant on the type of card and its value
while (contFlag == false){
//Decide if the player is bust
if (playerScore <= 21){
// Display players cards
System.out.println("Your hand contains: " + playerCards);
System.out.println("You currently have a score of: " + playerScore);
Scanner in = new Scanner(System.in);
// If it's after the first turn the ask the player to choose stick or twist
System.out.print("Stick or Twist? : ");
inputString = in.nextLine();
if (inputString.equals("Stick")) {
stickFlag = true;
contFlag = true;
} else if (inputString.equals("Twist")) {
stickFlag = false;
contFlag = false;
} else {
contFlag = false;
System.out.println("Unrecognised input");
}
} else {
contFlag = false;
pBustFlag = true;
}
}
cardRand = 0;
suitRand = 0;
suitName = "";
}
[/CODE]
I've removed the chunks of code that I know work and shouldn't be causing problems, ask and I'll put bits back though. The problem is that I can choose to "Stick" just fine, however choosing "Twist" causes the game to get stuck in an infinite loop and I have to Ctrl-C out. Any idea where the infinite loop is happening?
So I have built a .lib from tinyxml++ source. Where do I put it and how do I use it in my project?
So to start with android, what all do I need to download in the SDK manger?
I think:
Android SDK Tools
Android SDK Platform-tools
Android 2.1
(2.1 because that's the oldest that's still common)
Is this right?
[QUOTE=fylth;33087979]Could do with a little more help. I'm writing a game of Blackjack in Java, here is the code for the players turn:
...code...
I've removed the chunks of code that I know work and shouldn't be causing problems, ask and I'll put bits back though. The problem is that I can choose to "Stick" just fine, however choosing "Twist" causes the game to get stuck in an infinite loop and I have to Ctrl-C out. Any idea where the infinite loop is happening?[/QUOTE]
if contFlag is controlling the gamestate in the way I think it is, (the game should continue when it's true, the game is over when it's false) then your error is setting it false when input == "Twist"
If it's supposed to be the decider for a player's turn though, judging by your comments you don't actually add a new card in on a "Twist" - there's not enough code here to really find the problem.
Why would SFML 2 not play sounds:
[code]
std::map<std::string, sf::Sound> snds;
...
snds["popper_pop"] = snd_Create(asp + "popper_pop.wav");
...
sf::Sound Sounds::snd_Create(const std::string &p)
{
sf::SoundBuffer b;
if(!b.LoadFromFile(p))
throw std::string("Can't load sound file " + p);
sf::Sound snd;
snd.SetBuffer(b);
return snd;
}
[/code]
it plays sf::Music objects fine. GetDuration gives the correct length of each loaded sf::Sound. But when I play(), nothing happens
[QUOTE=NovembrDobby;33089113]Why would SFML 2 not play sounds:
[code]
std::map<std::string, sf::Sound> snds;
...
snds["popper_pop"] = snd_Create(asp + "popper_pop.wav");
...
sf::Sound Sounds::snd_Create(const std::string &p)
{
sf::SoundBuffer b;
if(!b.LoadFromFile(p))
throw std::string("Can't load sound file " + p);
sf::Sound snd;
snd.SetBuffer(b);
return snd;
}
[/code]
it plays sf::Music objects fine. GetDuration gives the correct length of each loaded sf::Sound. But when I play(), nothing happens[/QUOTE]
You need to store the sf::SoundBuffer, just like you need to store sf::Texture.
Sorry, you need to Log In to post a reply to this thread.