[QUOTE=Darwin226;24157988]
As for the ground, I just made some algorithm that uses a random number and added on a lot of multiplier and what not. Then just fiddle with it until you get it right XD
I used pillars 1 pixel wide and color them gradually. The top layer would start green and it would get more red and brown as it went down.
But that was flash, so using textures wasn't really an issue (or even an idea)[/QUOTE]
Hm, for terrain, I've had an idea. I generate a map of 1s and 0s (visually this would be a white-on-black map) where 1 is terrain and 0 is air. Each 1 and 0 is of course, a pixel. Then when I want to texture it, I just overlay the texture on the white areas, and there I have it - instant map. Black would be replaced by sky. This also makes it easy to do deformation, as the explosion mask would just zap away some pixels from the black/white bitmap and thus texture would no longer be rendered in that hole.
And then you make a hole that leaves ground above it to fall down. What then? The color of the pixel has to stay the same and texturing every pixel individually doesn't sound like such a good idea.
[QUOTE=Darwin226;24160173]And then you make a hole that leaves ground above it to fall down. What then? The color of the pixel has to stay the same and texturing every pixel individually doesn't sound like such a good idea.[/QUOTE]
Nah, I won't have falling terrain. It's kind of like a cross between Worms and Scorched Earth. So you can dig tunnels under the ground and stuff.
What is the scripting language(in your opinions)?
It would generally be used for all purpose things
As i understand Lua is faster but Python has more built in
Any other languages you recommend?
[QUOTE=robowurmz;24164884]Nah, I won't have falling terrain. It's kind of like a cross between Worms and Scorched Earth. So you can dig tunnels under the ground and stuff.[/QUOTE]
Oh, then it's a good idea.
[QUOTE=Richy19;24166014]What is the scripting language(in your opinions)?
It would generally be used for all purpose things
As i understand Lua is faster but Python has more built in
Any other languages you recommend?[/QUOTE]
Lua has enough for general purpose things and if you need more, like sockets, you can use an extension like [url=http://luaforge.net/projects/luasocket/][b]LuaSocket[/b][/url].
Python is more suitable for writing an entire program in.
I'll try putting it this way. You would write the program in python, giving you flexibility. To get more speed you would rewrite parts of it in C++. This results in a somewhat heavyweight "compiled result", as you need to include the python interpreter, and probably a sizable chunk of the standard library with your distribution. Look up py2exe for an example of how to do this.
The alternative is to write the program in C++ (for example, could be C, D, C#, anything), giving you speed, and embed Lua for flexibility. I think this would lead to slightly longer development times, as I think it's a tad more difficult to embed with lua than it is to extend python with C++: don't quote me on that though, but a smaller executable, as lua is designed to be small.
This is somewhat simplified, but I hope it's helpful!
[QUOTE=TheBoff;24167511]Python is more suitable for writing an entire program in.
I'll try putting it this way. You would write the program in python, giving you flexibility. To get more speed you would rewrite parts of it in C++. This results in a somewhat heavyweight "compiled result", as you need to include the python interpreter, and probably a sizable chunk of the standard library with your distribution. Look up py2exe for an example of how to do this.
The alternative is to write the program in C++ (for example, could be C, D, C#, anything), giving you speed, and embed Lua for flexibility. I think this would lead to slightly longer development times, as I think it's a tad more difficult to embed with lua than it is to extend python with C++: don't quote me on that though, but a smaller executable, as lua is designed to be small.
This is somewhat simplified, but I hope it's helpful![/QUOTE]
I believe that Lua is meant for plugin-like stuff (see Garry's Mod for example) while Python is better suited for full-fledged stand-alone scripts. Of course there are exceptions to both rules.
Yea i think il go with LUA if i can learn as much C++ as i would like to i wouldnt need what python offers
[QUOTE=arienh4;24167718]I believe that Lua is meant for plugin-like stuff (see Garry's Mod for example) while Python is better suited for full-fledged stand-alone scripts. Of course there are exceptions to both rules.[/QUOTE]
Isn't that just what I said, but concise :P.
[editline]11:47PM[/editline]
Also, Richy, don't knock python until you know: for most things you don't need speed, and it is a lot quicker to develop in than C++. Whilst C++ is fast in the right hands, it's still perfectly easy to write slow code in it, and on top of it C++ gives you so much control that it actually gets in the way of just writing code sometimes: most of the time it's a better idea to use a higher level language like C++ or python.
[QUOTE=TheBoff;24167511]This results in a somewhat heavyweight "compiled result", as you need to include the python interpreter, and probably a sizable chunk of the standard library with your distribution. Look up py2exe for an example of how to do this.[/QUOTE]
This is mostly true for Windows, but it's not really true at all for Linux/UNIX. In Linux, a script is as good as an executable as long as you include a hash-bang, or a line at the beginning which specifies the interpreter (such as "#!/usr/bin/env python" for a Python application). Bundling Python and libraries is not an issue because the package manager will handle whatever dependencies your application requires. Python is included in almost all modern Linux distributions. For these reasons, applications written in Python, Perl, and other interpreted languages are very common in Linux.
-Snip- Nevermind figured it out!
Hey im a newcomer to programming and have been using python.
I was wondering if there was a different way to do this for example:
[code]>>> this_is_a_story = "All about how!"
>>> this_is_a_story
'All about how!'
>>> my_life_got = "Flip turned upside down!"
>>> this_is_a_story
'All about how!'
>>> my_life_got
'Flip turned upside down!'
>>>[/code]
Is there a way to instead of using the underscores to actually override that factor to just use spaces instead of kind of simulating a space with underscore? I basically want to not use a _ everytime i make a program that makes the user input something.
[QUOTE=ROBO_DONUT;24169486]This is mostly true for Windows, but it's not really true at all for Linux/UNIX. In Linux, a script is as good as an executable as long as you include a hash-bang[/QUOTE]
Windows doesn't have the general-purpose hash-bang script support that Unix/Linux do, but the Windows distribution of Python creates file associations for the extensions ".py" (for console applications) and ".pyw" (for GUI apps that don't need a console window), so you can run a Python program just by double-clicking on the file. You don't need to make an EXE just so the user has something to click on, as long as the user has Python installed already.
[QUOTE=Wyzard;24171751]Windows doesn't have the general-purpose hash-bang script support that Unix/Linux do, but the Windows distribution of Python creates file associations for the extensions ".py" (for console applications) and ".pyw" (for GUI apps that don't need a console window), so you can run a Python program just by double-clicking on the file. You don't need to make an EXE just so the user has something to click on, as long as the user has Python installed already.[/QUOTE]
Right, but it's still treated like a non-executable file by the OS, which can be a real pain in some situations.
[QUOTE=LieutenantLeo;24171618]Is there a way to instead of using the underscores to actually override that factor to just use spaces instead of kind of simulating a space with underscore? I basically want to not use a _ everytime i make a program that makes the user input something.[/QUOTE]
You're not reading input from the user there, you're just writing Python statements in the interpreter. Variable names can't contain spaces, but they're not something that users would see or need to type while using your program.
To get input from the user, you can use the [url=http://docs.python.org/library/functions.html#raw_input]raw_input()[/url] function, which asks the user to type something and then returns what they typed. For example, if you type this in your interpreter:
[code]>>> name = raw_input("Type your name: ")[/code]
then on the next line, you'll see the "Type your name: " prompt and a cursor waiting for you to type something. Type a name -- even one with spaces, like Clark Kent -- and press enter, and you'll get the interpreter prompt (">>>") back, and the name you typed will be in the "name" variable.
What's wrong with this?
[code]void cmap::read(){
std::ifstream map("map1.txt");
if (map.is_open()){
poscharx = mainch.you.GetPosition().x /40;
poschary = mainch.you.GetPosition().y /40;
int q;
int x = 0;
int y = 0;
map >> back;
map >> posx;
map >> posy;
for(int ycs = 0; ycs < mapHeight;ycs++){
for(int xcs = 0; xcs < mapWidth; xcs++){
tiles[ycs][xcs].drawable = false;
}
}
for(int yc = 0; yc < posy; yc++){
for(int xc = 0; xc < posx; xc++){
map >> q;
inc = true;
if (poscharx > xc){
q = 0;
inc = false;
}
else if(xc - poscharx > mapWidth){
q = 0;
inc = false;
}
if (poschary > yc){
q = 0;
inc = false;
}
else if(yc - poschary > mapHeight){
q = 0;
inc = false;
}
if(q > 0){
tiles[x][y].tileval(x, y, q);
}
if(inc){
x++;
if(x == mapWidth){
y++;
x = 0;
if(y == mapHeight){
yc = posy;
}
}
}
}
}
}
}[/code]
I have been stuck on this for weeks. It's supposed to map cull or whatever you call it. Basically, display where you can see. It displays but 1 off every row. Say this is the map:
[code]1 1 1 1 1
0 0 0 0 1
0 0 0 0 1
0 0 0 0 0[/code]
Your max view area is 4 by 4 (pretend), so you would see:
[code]1 1 1 1
0 0 0 0
0 0 0 0
0 0 0 0 [/code]
But what you really see is:
[code]1 1 1 1
1 0 0 0
0 1 0 0
0 0 1 0 [/code]
Aka one tile is being run off from the previous tile set. How do I fix it. Oh and for some reason moving on the Y axis changes the runoff by 1 every 40 pixels you move.
Another problem
[code]name = raw_input("What's your name? ")
print "Hi" [B]+ name[/B]
raw_input("Press <enter> to continue ")
print "How are you?"
mood = raw_input(" ")
print "Cool"
exit = raw_input("Press <enter> to exit ")[/code]
This works fine except that when i type my name there is no space between Hi and the name i entered.
print "Hi " + name
Tomorrow I set out on a wonderful day of learning, and failing.
I want to learn a language like Java to code this nice n' easy game like; The Word that Follows.
Could you give me suggestions for Names and easy Languages
[QUOTE=FreddiRox!;24175183]Tomorrow I set out on a wonderful day of learning, and failing.
I want to learn a language like Java to code this nice n' easy game like; The Word that Follows.
Could you give me suggestions for Names and easy Languages[/QUOTE]
Is this a haiku?
Joking aside, you can program a game in pretty much any language. Java is alright. It's not my favorite language in the world, but I've been programming games in it recently with some success. If you want "easy", [url=http://www.python.org/]Python[/url] + [url=http://www.pygame.org/news.html]PyGame[/url] might be a good place to start. There's also a new Lua game framework called [url=http://love2d.org/]LÖVE[/url] which looks pretty interesting, although I haven't used it myself.
[QUOTE=ROBO_DONUT;24175616][B]Is this a haiku?[/B]
Joking aside, you can program a game in pretty much any language. Java is alright. It's not my favorite language in the world, but I've been programming games in it recently with some success. If you want "easy", [URL="http://www.python.org/"]Python[/URL] + [URL="http://www.pygame.org/news.html"]PyGame[/URL] might be a good place to start. There's also a new Lua game framework called [URL="http://love2d.org/"]LÖVE[/URL] which looks pretty interesting, although I haven't used it myself.[/QUOTE]
Funnily enough that's what I thought on reading the first line. :v:
Anyone know why my Player starts sliding, shouldn't it stop when I release the key?
[code]#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;
int main()
{
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Shootar");
App.UseVerticalSync(true);
App.SetFramerateLimit(60);
const float PlayerSpeed = 1.f;
float PlayerX = 0.f;
float PlayerY = 0.f;
sf::Shape Player = sf::Shape::Circle(PlayerX, PlayerY, 10, sf::Color::Red);
while (App.IsOpened())
{
const float& FrameTime = App.GetFrameTime();
const sf::Input& Input = App.GetInput();
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
if (Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape)
App.Close();
}
if (Input.IsKeyDown(sf::Key::W))
PlayerY -= PlayerSpeed * FrameTime;
if (Input.IsKeyDown(sf::Key::A))
PlayerX -= PlayerSpeed * FrameTime;
if (Input.IsKeyDown(sf::Key::S))
PlayerY += PlayerSpeed * FrameTime;
if (Input.IsKeyDown(sf::Key::D))
PlayerX += PlayerSpeed * FrameTime;
Player.Move(PlayerX, PlayerY);
App.Clear(sf::Color::Black);
App.Draw(Player);
App.Display();
}
return 0;
}
[/code]
Just wondering does SFML let you use OpenGL? or would i need to add something like GLUT to use that?
[QUOTE=sim642;24182826]Anyone know why my Player starts sliding, shouldn't it stop when I release the key?[/quote]
[code]
if (Input.IsKeyDown(sf::Key::W))
Player.Move(0, -PlayerSpeed * FrameTime);
if (Input.IsKeyDown(sf::Key::A))
Player.Move(-PlayerSpeed * FrameTime, 0);
if (Input.IsKeyDown(sf::Key::S))
Player.Move(0, PlayerSpeed * FrameTime);
if (Input.IsKeyDown(sf::Key::D))
Player.Move(PlayerSpeed * FrameTime, 0);
[/code]
Remove "Player.Move(PlayerX, PlayerY);" from below the if statements and it should work like you want it to. You need to increase the PlayerSpeed as well, it's a bit slow at 1.f
What you were doing was incrementing the amount the player should move every frame when you were holding down the key. It simulates a sort of zero-gravity environment.
[QUOTE=Richy19;24214688]Just wondering does SFML let you use OpenGL? or would i need to add something like GLUT to use that?[/QUOTE]
Now really?
[url]http://www.google.com/search?hl=en&source=hp&q=sfml+opengl&aq=f&aqi=g4&aql=&oq=&gs_rfai=[/url]
First result answers your question.
Oh and in the extremely short summary in the features section.
[url]http://sfml-dev.org/features.php[/url]
[quote]You can use SFML as a minimal windowing system to interface with OpenGL[/quote]
There's even specifically a tutorial for it...
[url]http://sfml-dev.org/tutorials/1.6/window-opengl.php[/url]
One of the most important skills a programmer requires is the ability to find information. If you don't try, you won't know if you can do this, and more importantly, won't have any practice at it either.
[QUOTE=gilly_54;24214708][code]
if (Input.IsKeyDown(sf::Key::W))
Player.Move(0, -PlayerSpeed * FrameTime);
if (Input.IsKeyDown(sf::Key::A))
Player.Move(-PlayerSpeed * FrameTime, 0);
if (Input.IsKeyDown(sf::Key::S))
Player.Move(0, PlayerSpeed * FrameTime);
if (Input.IsKeyDown(sf::Key::D))
Player.Move(PlayerSpeed * FrameTime, 0);
[/code]
Remove "Player.Move(PlayerX, PlayerY);" from below the if statements and it should work like you want it to. You need to increase the PlayerSpeed as well, it's a bit slow at 1.f
What you were doing was incrementing the amount the player should move every frame when you were holding down the key. It simulates a sort of zero-gravity environment.[/QUOTE]
Thank you!
I really should read the docs more carefully - I thought move will set X and Y coordinates.
-snip-
Really? Come on man.
Ok so i did the window/openGL tutorial on the SFML site and got it pretty much working except for the antialiasing
This is what i get :/
[IMG]http://img825.imageshack.us/img825/9554/74431965.jpg[/IMG]
[CODE]#include <SFML/System.hpp>
#include <iostream>
#include <SFML/Window.hpp>
int main()
{
sf::Clock Clock;
// Create the main window
sf::WindowSettings Settings;
Settings.DepthBits = 24; // Request a 24 bits depth buffer
Settings.StencilBits = 8; // Request a 8 bits stencil buffer
Settings.AntialiasingLevel = 2; // Request 2 levels of antialiasing
sf::Window App(sf::VideoMode(640, 480, 32), "SFML OpenGL", sf::Style::Close, Settings);
///////////////OPENGL CRAP////////////
// Set color and depth clear value
glClearDepth(1.f);
glClearColor(0.f, 0.f, 0.f, 0.f);
// Enable Z-buffer read and write
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Setup a perspective projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 1.f, 500.f);
////////////////////////////////////
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
// Some code for stopping application on close or when escape is pressed...
if (Event.Type == sf::Event::Resized)
glViewport(0, 0, Event.Size.Width, Event.Size.Height);
// Window closed
if (Event.Type == sf::Event::Closed)
App.Close();
// Escape key pressed
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.f, 0.f, -200.f);
glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);
glBegin(GL_QUADS);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f( 50.f, 50.f, 50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(50.f, -50.f, -50.f);
glVertex3f(50.f, 50.f, -50.f);
glVertex3f(50.f, 50.f, 50.f);
glVertex3f(50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, 50.f);
glVertex3f(-50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, -50.f);
glVertex3f( 50.f, -50.f, 50.f);
glVertex3f(-50.f, 50.f, 50.f);
glVertex3f(-50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, -50.f);
glVertex3f( 50.f, 50.f, 50.f);
glEnd();
//////////////////////////
App.SetActive();
App.Display();
}
return EXIT_SUCCESS;
}
[/CODE]
Sorry, you need to Log In to post a reply to this thread.