Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - BaneTrapper

Pages: 1 ... 11 12 [13] 14 15
181
Hello. (c++ sfml)
Why em i making this post?
Well the reason is, i wanna talk to my fellow "everyone" about and how to do the following thing:

2D tile based map that needs a few things:
Need to generate it at random
It needs to hold a info what type each tile is (because of gathering, mining, digging)
Should be able to stream it (during runtime save peaces of map that are far from user and open the ones hes gonna cross up to (if nothing to load, generate)
A height (aiming about to 0(bottom) to 3-10(top) height of land from bottom to far top)
Able to manipulate the terrain ( Because of digging, mining...)

If you are willing, think about it and gimme a helping hand if you had experience in doing this.
I am gonna probably make a tutorial with what i end up.

What i am gonna do first.
Think off what the base for a map needs to be in code
How i am gonna save it (format)

Then
Get to display/draw it in code
Get to generate most simple of map

Then
Manipulating the terrain
Streaming during runtime

Then
Improve!

182
SFML projects / Re: The best SFML games
« on: July 14, 2013, 09:41:48 am »
Hi all, just wondering if anyone can point me to a few of the best of the best SFML games out there. It'd be cool to see what is possible with the library. Unfortunately, it's hard to know what games are made with what tools. So what do you think are a few of the best games made with SFML?
I know this one, http://eigen.pri.ee/pioneers/ Pioneers :) enjoy.
Also Colonies is pretty good looking imo http://en.sfml-dev.org/forums/index.php?topic=11878.0.

183
SFML projects / Re: My (bad) level editor
« on: July 07, 2013, 10:15:40 pm »
Here are some screenies of my editor

This editor is created by me.
It is free to use if it fits your purpose so cheers!

Pros:
Free to use
Supports huge map size(5000x5000) with ease (no minimap, gl scrolling ;p )
Two layers support
Each layer/coolision can be turned on and off for better visibility
Completely customable enemies in mapEditor
Cons:
It has bean made in few hours.
The list is too big...

The file format is saved in .txt files
Its writen like this (mapSizeX(integer value) mapSizeY(integer value) \nLayer1(integer value):Layer2(integer value):Collision(integer value);
A example map would be
[3 3
1:0:3 1:0:2 1:0:2
2:3:0 1:2:0 1:0:2
1:2:3 1:1:1 1:23333:91102]

Just random image of loaded map
http://s24.postimg.org/kd9yie869/image.jpg?noCache=1373227286
http://s8.postimg.org/upo4kcg8h/image.png?noCache=1373227325
http://s8.postimg.org/sz53iuypd/image.png?noCache=1373227325

This is tile layer1 selection
http://s8.postimg.org/yxiwt3ho1/image.png?noCache=1373227325

This is tile layer2 selection
http://s8.postimg.org/i8hgx6l2p/image.png?noCache=1373227325

This is enemy editor
http://s8.postimg.org/m9yk2uddd/image.png?noCache=1373227325

Keep up the good work!

184
If you will just move around, use sf::View for a camera.

If you actually want to transform the whole vertex array without changing the vertices, use sf::Transform.

If you want to draw only a part of the array, then draw it manually and use glDrawArrays(Primitive, StartVertex, NumVertices); (can only draw contiguous vertices)

That's it, there is always a solution. For maps, better to divide it in multiple regions, and draw them whole only if they are within the screen, moving around with a sf::View only. Try
I am making a 2d "shooter"? but with swords&magic era. Projectiles, and real time actions.
What i am afraid off is how will i handle projectiles positioning, and pathing.
Also doing AI... that is gonna be a new.

As you suggested, i will use sf::View for position drawing.
For the map, i will cut it in regions... that will be pretty simple, and fast enough.

Quote
If you want to draw only a part of the array, then draw it manually and use glDrawArrays(Primitive, StartVertex, NumVertices); (can only draw contiguous vertices)
You can draw a part of a vertex array with SFML (window.draw(verticesPtr, count, primitiveType)), no need to use OpenGL.
I am wondering, if i pass verticesPtr, a pointer to a vertex that is in middle of vertexArray, count to fill that row until end of screen. primitiveType = Quads. That should work...

UPDATE::
Its possible to pass a vertex that is in middle of vertex array, and draw only limited amount! so cool.
Got it textures and all.
But, it isen't safe. In case of memory  corruption or something i will cause huge error that will require handling.

EDIT::
If someone needs / requires a example, here is code:

Make a "map.txt" file and copy this intro it.
Don't copy -> "" <- quotation marks
"1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 "

also make sure you have image "img.png" for texture...

const int TILE_SIZE = 32;
int main()
{
        //Main window
        sf::RenderWindow renWin;
        renWin.create(sf::VideoMode(1024, 768, 32), "hy");
        //Texture
        sf::Texture tex;
        tex.loadFromFile("img.png");
        int imageWidth = tex.getSize().x / TILE_SIZE;

        //Map
        sf::VertexArray verArr(sf::PrimitiveType::Quads, 10 * 10 * 4);

        std::ifstream ifstream;
        ifstream.open("map.txt");

        if(ifstream.is_open() == true)
        {
                //Loading map 10x10 size
                for(int y = 0; y < 10; y++)
                {
                        for(int x = 0; x < 10; x++)
                        {
                                int readTile;
                                ifstream >> readTile;

                                int ID = (x + y * 10) * 4;

                                verArr[ID].position = sf::Vector2f(x * TILE_SIZE, y * TILE_SIZE);
                                verArr[ID+1].position = sf::Vector2f(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE);
                                verArr[ID+2].position = sf::Vector2f(x * TILE_SIZE + TILE_SIZE, y * TILE_SIZE + TILE_SIZE);
                                verArr[ID+3].position = sf::Vector2f(x * TILE_SIZE, y * TILE_SIZE + TILE_SIZE);

                                readTile -=1;//Quick fix for getting correct tile in math
                                verArr[ID].texCoords = sf::Vector2f((readTile % imageWidth) * TILE_SIZE, (readTile / imageWidth) * TILE_SIZE);
                                verArr[ID+1].texCoords = sf::Vector2f((readTile % imageWidth) * TILE_SIZE +TILE_SIZE, (readTile / imageWidth) * TILE_SIZE);
                                verArr[ID+2].texCoords = sf::Vector2f((readTile % imageWidth) * TILE_SIZE + TILE_SIZE, (readTile / imageWidth) * TILE_SIZE + TILE_SIZE);
                                verArr[ID+3].texCoords = sf::Vector2f((readTile % imageWidth) * TILE_SIZE, (readTile / imageWidth) * TILE_SIZE + TILE_SIZE);
                        }
                }
        }
        //Vertex to be drawn
        //sf::Vertex *ver = &verArr[12];

        //Render state that hold texture
        sf::RenderStates state;
        state.texture = &tex;

        while(renWin.isOpen())
        {
                //Event handling
                sf::Event event;
                while(renWin.pollEvent(event))
                {
                        switch(event.type)
                        {
                        case sf::Event::Closed: renWin.close(); break;
                        default: break;
                        }
                }
                //Clear
                renWin.clear();
                //Drawing vertex/vertices
                sf::Vertex *ver;
                for(int i = 0; i < 5; i++)
                {
                        ver = &verArr[i * 10 * 4 + 12];
                        renWin.draw(ver, 12, sf::PrimitiveType::Quads, state);
                }
                //feed buffer
                renWin.display();
        }

        return 0;
}

185
Is it because it's too slow, or because you think that eventually it might be slow?
And the answer is no, you can't, unless you subdivide your map into multiple vertex arrays.
Yes it is slow, 500x500 at 50-60% cpu usage, and VSync on provides only ~35 fps.
For a 2d game that should run on weak machines, its unacceptable.

I am gonna invest some time intro this for sure.
I will post my "invention" when am done if someone will be experiencing same issue.

186
Hello.
Currently i am loading a map intro a vertex array(sf::...::Quads, 100x100x4).

They are representation of 32x32 tile.
What is my issue? well i don't want to draw the whole 100x100 vertexes, instead i would like to draw only those on the screen.
Also the tiles can have offset ranging from 0 - 31 pixels.

The issues:
As stated above i have 100x100map size of 1 tile is 32x32 pixels the size in pixels is 3200:3200,
but the size of my window is 1028x768, how can i move the map around? without repositioning each vertex that is gonna be drawn?

187
General discussions / Re: Thank You
« on: May 01, 2013, 06:26:43 pm »
SFML 2.0 just got pimped Laurent Gomila style!
I like it so much.

188
SFML projects / Re: The Wanderer
« on: March 31, 2013, 07:19:05 pm »
What I meant was to include the .dll in the same way that you included the SFML .dll
Another way it would be to include the installer (http://www.microsoft.com/en-au/download/details.aspx?id=30679) and say if you are missing X dll run this.

As I don't use visual studio, I don't have them. Think of the normal user, he probably won't have visual studio either.
Currently the way to resolve the issue with playing is to download from this link the 32 bit one
http://www.microsoft.com/en-au/download/details.aspx?id=30679

I am looking intro making a installation, and install needed components as the Visual C++ Redistributable for Visual Studio 2012

Thank you on the feedback!

189
SFML projects / Re: The Wanderer
« on: March 31, 2013, 09:33:43 am »
I donwloaded it but..I need MSVCR110.dll (and maybe some more dll?) I mean I can download it from some website, but the common user won't. It happened to me when I didn't know which dll include, to solve it do this: go to another computer (or ask a friend to do it) and try to play the game, do you need *.dll? copy it, and retry until all the necessary dll are there.

Also..is the game similar to Fire Emblem/Advance wars? if so, please add the option to see the grid. Maybe it's just me, but I always enable it if I can! (Heroes of might and magic did that too)

There's nothing wrong with 60 FPS! In fact, I'd prefer to have stable 60 fps than variable FPS

As for the antivirus, AVAST did the same to me. I just excluded the folder where I save my programs.
MSVCR110.dll stands for
microsoft visual studio redistributable version.
I will add dll files to .exe file so you don't have to download all that stuff. Working on it!

A grid on the map you meant? if so i will add check box in the options for that in next build.

I will probably add a option to make VSync or FPS cap option. Currently the game runs at your desktop monitor refresh rate.

Really nice game, i love the graphics. Did you create them by your own?

*Maybe you should insert a information screen that you have to set the skillpoints. Because at the first time I didnt noticed that I should set them.

*I found a bug, when you loose a fight you will return to the map but when you move then, the game is flickering (I think the Battlescreen gets drawn?)

*I think different skills for different types of heros are a future feature?

AlexAUT
Thanks means allot!, and all graphics are mine, except the opened book, and character sprites those where free resources.

I will add warning that you should set some skillpoints before continuing intro game for next build.

Well its not a bug, but something that wasn't bean implemented yet. I was looking to add lives? or just str8 on instant lose after battle was lost. Still making my mind...

I am looking intro this. But what i will probably do is make allot skills that all class can use. Then some specific to class that are hard to get and are powerful! (Skills are droppable items in the game)

same as santiaboy, missing that .dll file :(
Working on the issue thanks on the error report!

This is looking pretty good, I'd like to see a video of it action too please. :D

To those having .dll problems, the dll you cite is part of the visual C++ runtime 1012(if I remember the version numbers correctly). It can be correctly installed using this installer http://www.microsoft.com/en-au/download/details.aspx?id=30679
I don't believe i can make a video with my current machine and i got no experience with making a video i never did it. Ever ^^, if i get lazy that is what i will do!

Regarding the .dll files. That is correct if you don't have microsoft visual c++ redistributable 2012 package then you get error. I will add those dll files intro executable so they download bigger file but wont have to mess around.

Also would you guys want a Installer and bigger download file or to manually download the redistributable package?

190
SFML projects / The Wanderer
« on: March 31, 2013, 12:15:03 am »
This project is not dev in since 6/3/2013.

Hello.
I came to a point where i scraped a playable alpha version of a game i am making.
Its a 2d turn based rpg, and here are some screen shots!


http://s21.postimg.org/f5hk9olw5/Battle.png
http://s21.postimg.org/aywpucmaf/Map.png
http://s21.postimg.org/x9kkubjkn/Character_creation.png

Id be nice to hear opinions on what is good and bad.
It also comes with map editor just for spice.

Controls:
~Game
-Map
W = move up
S = move down
A = move left
D = move right
-Battle
Mouse Left button(Press) = action invoke
Mouse Right button(Hold) = information window

~Map editor
W = move camera up
S = move camera down
A = move camera left
D = move camera right
Mouse button left(Hold) = place current LC(Left click) tile
Mouse button right(Hold) = place current RC(Right click) tile

Also in Game->Battle there is a chat log, but its current turned off because it drops my machine from 800-1000 fps to 30-60. I am working on improvement atm.

Note: Some buttons, and stuff may not work but its minimal and i hidden most of incomplete stuff.
Enjoy!
Edit:: Update 4 Direct download link : http://www.mediafire.com/?xi9o5rgz30ba6x8

NOTE:: Download the 32-86 bit version, even if you have 64 bit OS. Else it wont work... its just how it is...
If you don't have "Microsoft visual c redistributable package 2012" this application wont run!
You can download at: http://www.microsoft.com/en-us/download/details.aspx?id=30679
This will come with most new games made in c language, but if you didn't get any of new games, you can install it manually.

BIG NOTE:
My AVG antivirus sometimes warns me that my just compiled .exe file is virus and asks me if i wanna block it or allow. Any experience on how to stop that? or what may cause that kind of behaviour?

Also would you guys want a Installer and bigger download file or to manually download the redistributable package?

Contact information:
BaneTrapperDev@hotmail.com
Information:
Looking for experience and knowledge

191
SFML projects / Re: Pioneers
« on: March 05, 2013, 05:57:02 pm »
I didn't understand how to disembark with unloading the cargo -- the backpack was empty, although I loaded everything in the harbor.

How does the fog of war work? Old parts of the island I have already discovered disappear. And everything disappears when switching characters. Furthermore, I were not able to scroll again to the west of the island, where I arrived.

Can we navigate somehow on the sea? It's difficult to steer towards a destination, the sailing mechanism is rather annoying ;)
( Shop <-> Town stash ) ( Town stash <-> Ship ) ( Ship <-> Crew )

Each unit has its own (Oh, i explored this), also press (M) for map while on island.
There is no way to share ( Island information / Explored parts ) around the members or anything like that, what unit explored, that he know.
Also unit forgets old parts of the terrain during course of turns.

That is the skill part. W towards ( Head wind ) or ( Tail wind ) then release ( W ) to not lose speed rapidly and steer towards destination and pray for good wind direction.
I personally like this, it adds more depth to sailing instead of just sitting there for 5-15 min holding ( W ) and waiting a island to pop out, instead fight the wind direction all the time!!!

192
The sf::Event::KeyPressed doesn't have a break after its switch.  After its cout statement executes it breaks out of the eventList.key.code switch but not the eventList.type switch, so it's falling through to the sf::Event::KeyReleased case.  Try adding a break statement after the switch in case sf::Event::KeyPressed.  I'd also recommend doing the same for case sf::Event::KeyReleased.  In fact, I'd also consider restructuring the code a little more in this area; switch statements in case statements can get somewhat confusing.
Considering the missing "break;" i cant find it :(
Also putting "break;" after switch statement would not run the code after it but break out. Making the code after that (In this case sf::Event::KeyReleased) to not be checked.

Also in switch statement if case is not found "default is run" witch in each case is "break;" and thus will not run the code after it causing unexpected behavior.

About reconstructing code. I am surely considering that in my next project, but as it currently stands i started this way and am gonna finish it this way, just for the sake i don't edit thousand of lines to update the code cause am just training/learning.

EDIT:: I understand what your saying now. Took me some rethinking of what i did
int q = 1;
int i = 1;
switch(q)
{
case 0:
    break;
   
case 1:
    switch(i)
    {
    case 0:
        break;
       
    default:
        break; // Breaking switch(i) but not the switch(q) and thus i get error
    }
   
default:
    break;
}
 

Thank you clever man!

193
Windows 7 32bit and SFML 2.0 (DD:9 MM:Jan YYYY:2013 downloaded)

This is the minimal code that reproduces error

Above code is my full code witch has same error
int main()
{
    sf::RenderWindow renWin;
    renWin.create(sf::VideoMode(1024, 768, 32), "Title", sf::Style::Default);

    while(renWin.isOpen() == true)
    {
       sf::Event eventList;
        while(renWin.pollEvent(eventList))//While there are event to be handled
        {
            //Event handle
            switch(eventList.type)
            {
            case sf::Event::Closed:
                renWin.close();
                break;

            case sf::Event::KeyPressed:
                switch(eventList.key.code)
                {
                case sf::Keyboard::W:
                    std::cout << "Pressed W" << std::endl;
                    break;
                default:
                    break;
                }

            case sf::Event::KeyReleased:
                switch(eventList.key.code)
                {
                case sf::Keyboard::W:
                        std::cout << "relased w" << std::endl;
                        break;

                default:
                    break;
                }

            default:
                break;
            }
        }
        renWin.clear(sf::Color::Magenta);
        renWin.display();
    }
    return 0;
}
 

The console window is displaying "Pressed W\nreleased W per look" and also additional "released w" when the key is actually released

194
Hello.
As the subject states.
In game i hold button "W" and i get sf::Event::KeyReleased triggered with key "W"

Code
case sf::Event::KeyReleased:
                        switch(eventList.key.code)
                        {
                        case sf::Keyboard::W:
                                        objBoo.isKWR = true;
                                        std::cout << "relased w" << std::endl;
                                break;

                        default:
                                break;
                        }

I get "released w" printed each loop... but i am holding the button didn't release


The whole function
void EventHandle::HandleEvents(sf::RenderWindow& renWin, Bools& objBoo, MemberInfo& objMem)
{
        sf::Event eventList;
        while(renWin.pollEvent(eventList))//While there are event to be handled
        {
                //Name input
                if(Bools::isGame_MemberInfo_TypingName == true)
                {
                        switch(eventList.type)
                        {
                                case sf::Event::TextEntered:
                                switch(eventList.text.unicode)
                                {
                                        case 13:
                                                //Return key
                                                Bools::isGame_MemberInfo_TypingName = false;
                                        break;

                                        case 8:
                                                //Backspace key
                                                if(objMem.objHeroUnit.name.size() > 0)
                                                {
                                                        objMem.objHeroUnit.name.erase(objMem.objHeroUnit.name.size() - 1);
                                                }
                                        break;

                                        default:
                                                if(eventList.text.unicode < 128 && objMem.objHeroUnit.name.size() < 14)
                                                {
                                                        objMem.objHeroUnit.name.push_back(static_cast<char>(eventList.text.unicode));
                                                }
                                        break;
                                }
                                default:
                                        break;
                        }
                        objMem.Update();
                }

                //Event handle
                switch(eventList.type)
                {
                case sf::Event::Closed:
                        objBoo.isAppOn = false;
                        break;

                case sf::Event::MouseButtonPressed:
                        switch(eventList.mouseButton.button)
                        {
                        case sf::Mouse::Left:
                                if(Bools::isMBLR == true)
                                {
                                        Bools::isMBLP = true;
                                        Bools::isMBLR = false;
                                        Bools::isGame_MemberInfo_TypingName = false;
                                }
                                break;

                        default:
                                break;
                        }

                case sf::Event::MouseButtonReleased:
                        switch(eventList.mouseButton.button)
                        {
                        case sf::Mouse::Left:
                                Bools::isMBLR = true;
                                break;

                        default:
                                break;
                        }

                case sf::Event::KeyPressed:
                        switch(eventList.key.code)
                        {
                        case sf::Keyboard::Escape:
                                objBoo.isGame_Map = false;
                                objBoo.isMainMenu = true;
                                break;

                        case sf::Keyboard::W:
                                if(objBoo.isKWR == true)
                                {
                                        objBoo.isKWP = true;
                                        objBoo.isKWR = false;
                                }
                                break;

                        case sf::Keyboard::S:
                                if(objBoo.isKSR == true)
                                {
                                        objBoo.isKSP = true;
                                        objBoo.isKSR = false;
                                }
                                break;

                        case sf::Keyboard::A:
                                if(objBoo.isKAR == true)
                                {
                                        objBoo.isKAP = true;
                                        objBoo.isKAR = false;
                                }
                                break;

                        case sf::Keyboard::D:
                                if(objBoo.isKDR == true)
                                {
                                        objBoo.isKDP = true;
                                        objBoo.isKDR = false;
                                }
                                break;

                        default:
                                break;
                        }

                case sf::Event::KeyReleased:
                        switch(eventList.key.code)
                        {
                        case sf::Keyboard::W:
                                        objBoo.isKWR = true;
                                        std::cout << "relased w" << std::endl;
                                break;

                        case sf::Keyboard::S:
                                        objBoo.isKSR = true;
                                break;

                        case sf::Keyboard::A:
                                        objBoo.isKAR = true;
                                break;

                        case sf::Keyboard::D:
                                        objBoo.isKDR = true;
                                break;

                        default:
                                break;
                        }

                default:
                        break;
                }
        }
}
 

195
General / Re: Looking tips, for draving tiled background
« on: January 10, 2013, 03:22:56 pm »
By any chance got minimal code of doing sf::Vertex or sf::VertexArray to draw sf::Texture or part of sf::Texture to sf::RenderWindow?


EDIT 1:
When using
sf::Vertex vertices[] =
    {
        sf::Vertex(sf::Vector2f(  0,   0), sf::Color::Red, sf::Vector2f( 0,  0)),
        sf::Vertex(sf::Vector2f(  0, 100), sf::Color::Red, sf::Vector2f( 0, 10)),
        sf::Vertex(sf::Vector2f(100, 100), sf::Color::Blue, sf::Vector2f(0, 10)),
        sf::Vertex(sf::Vector2f(100,   0), sf::Color::Red, sf::Vector2f(10,  0))
    };

What is third argument for? in documentation it says it texture coordinates and changing the number does not provide visible result. What is 3rd argument for? and what does it modify.

Pages: 1 ... 11 12 [13] 14 15