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.


Topics - BaneTrapper

Pages: 1 [2] 3
16
General / Showing animated picture, how would i achieve that in sfml2.1
« on: September 25, 2013, 09:32:41 pm »
Hello.
What i am trying is to show animated scene in .gif format.
What is a way to achieve animation in sfml?

In simpler saying: What is a way to display animated picture, gif or similar.

17
Graphics / How to make VertexArray with RenderState semi transparent.
« on: September 23, 2013, 10:25:43 pm »
Hello.
I was experimenting with minimap and i am drawing it as vertexArray with RenderState witch only has texture.
My question is how would i set its alpha color to (200) of 255, or 80% or something big so its just transparent?
Using BlendMode gave me weird results... and i think that is not what i am looking for, so any help is apprechiated.

18
Graphics / If object position is out of vissible screen, is it drawn?
« on: September 02, 2013, 06:16:49 pm »
Hello.
If an rectangle with (X=0 Y=0 W=10 H=10) is drawn to a window that its position and size is
(X=100, Y=100, W=600, H=400)
Will the object be drawn and use cpu? or is it gonna check if it is in visible screen and not draw it.

19
Hello.
I have a vertexArray that has sf::Quads made in squares to represent 32x32 pixels.
The issue is when i am moving around the vertexArray using sf::transform, and it always happens when i pass in a float value of(x.5) x being any value.

Image as expected
http://postimg.org/image/ymzl93ead/
When moving at one frame this is dispalyed
http://postimg.org/image/j2s7ik45x/

Ever had this happen to someone?
What is the fix for the solution? it is really eye catching when moving map around and it cant be tolerated.
One solution is to check if i am passing (x.5) intro the translate and add or remove (x.1) but i find that not being global solution to issue.
Is behavior like this intent or did i make a mistake?

20
Hello.
2d top down 4sidescroller(i don't know how to describe going up and down) game.
I will jump strait to the point because am having trouble getting this true.
What i am making is unit, that is linked with VertexArray.
My goal is not to use sf::Sprite and to get great performance, therefore i was thinking of code going like this.
class Unit : BehaviorInhertiance
{
public:
//Witch vertices is this unit in VertexArray
int StartingVertice;//Position in vertex array that the sprite starts
};
 

The issue starts when i look what is gonna happen in the game.
I am gonna have units die, units get spawned(created).
That means removing or adding elements or keeping track or elements that are free and when adding new unit populate the free elements instead of adding new ones, the issues with this aproach is that i am thinking about boss battles and at some times i will need to create about 50 units that are gonna be just dummy units. But they need position and textures.
Resizing the array will probably be ok if i dont use references, but using int and storing vertex position is kinda not the thing id like to do.
So any suggestions you would like to pass, what should i so considering the design i am wanting.

21
SFML game jam / Questions regarding game jam
« on: August 09, 2013, 02:15:36 pm »
Hello.
I have just few questions so am gonna trow them ASAP:
1. What is the rule set for "Game jam".
    Do you make a theme (Ghosts, 2d) and you are supposed to make game using these 3 things to apply?
2. How much time is given for the game to be done? or how long "Game jam" lasts
3. Is it required to apply before to enter game jam? (As in, i am gonna make a game that is about banishing ghosts from mortal plane in 2d view...)

22
General / Changable keys ingame?
« on: August 01, 2013, 09:12:33 pm »
Hello.
I believe this question has bean asked many times, but using search provides me with error asking me to contact admin...
Could someone point me to some post about changable keys ingame?
EX:
i will mose "W = north" "S = south" "A = West" "D = East"
how can i allow player to switch witch button calls witch effecet?

23
Hello.
Currently i am making 2d top down game.
I made a map using sf::VertexArray, each tile in layer 1 is a tile and it cant be blank so sf::VertexArray is perfect.
Now on layer2 its gonna be used to draw (Trees, bush, Rock)
And then i need enemies/npc movable units as Sprites, my reason posting is that i want to get speed = to VertexArray but also save space if possible, what is optimal solution?

Map syntax
sizeOfMapX sizeOfMapY
Layer1:Layer2

At layer 1: 0-Infinite = tile texture ID;
at layer 2: 0 = nothing, 1-infinite = something

example:
{5 5
1:0 1:0 1:1 1:0 1:1
1:0 1:1 1:0 1:1 1:1
1:1 1:1 1:1 1:0 1:1
1:0 1:0 1:1 1:1 1:0
1:0 1:1 1:0 1:1 1:1 }
So the layer 2 can have full screen of layer 2 or absolutely nothing.

To recap:
Layer 1 = sf::VertexArray because the map cant have empty spots so its perfect.
Layer 2 = Making sf::Sprite for each tile?(I am affraid this is gonna take allot off performace when in rocky place where the whole screen is gonna have layer 2 and drawing (32width x24height, 32width x32height tiles proves to drain much when using sf::Sprites)
Layer 3 = sf::Sprite for sure because it needs to be pixel perfect

Current layer 1 image^^

24
General / c++ How to handle massive case type
« on: July 20, 2013, 08:01:46 pm »
Hello.
What i am doing is a Class that is called "Interact", the point of class is to allow for type checking.
I am making 2d tile map, and i want to allow for player to "Interact" with map as in(case isBerryBush = harvest)(case Stone = mine(check if item(Pickaxe...)))
I hope i had provided you with what my idea is.

What i am having in mind
//Type of "Addon" on tile (BerryBush, Stone...)
int GetAddonType(TileClass &tile)//TileClass::Addon is defined as int
switch(tile.Addon)
{
type::BerryBush: return my_enum::Hand; break;
type::Stone: return my_enum::Hacking; break;//As in swing to use
}

//Has tool for
bool HasToolFor(my_enum type)
{
//Check player inventory if he has tool
}

//Is the tile ready for harvest
bool IsReadyForHarvest(int TileID)
{
//Returns if the tile has grown since last harvest/planting...
}

//Somewhere in main loop
if(Interact == pressed)//Ilustration
{
  if(GetAddonType(CurrentTileStandingOn) == Hand)
  {
    if(IsReadyForHarvest(CurrentTileStandingOn) == true)
    {
      //Add item to inventory, set tile to harvested...
    }
  }
  else if(GetAddonType(CurrentTileStandingOn) == HackingHand)
  {
    if(IsReadyForHarvest(CurrentTileStandingOn) == true)
    {
      if(HasToolFor(GetAddonType(CurrentTileStandingOn)) == true)
      {
        //Add item to inventory, set tile to harvested...
      }
    }
  }
}
 

The issues with this is that its syntax is horrible imo.
Wanna share a better way? pretty please!

25
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!

26
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?

27
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

28
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;
                }
        }
}
 

29
General / Looking tips, for draving tiled background
« on: January 09, 2013, 10:37:57 pm »
Hello.
What i have problem is, that i draw 32x32 tiles on 1024x768 screen and i get high CPU usage during this operation. The obvious cause is that i call sf::RenderWindow::draw() function too many times (768 times to be exact).
By commenting out the sf::RenderWindow::draw() calls decrease CPU usage from 60-70% down to 10%.

I currently conflict this problem by decreasing the amount of tiles i draw to screen.
Any suggestions, tips?

30
Audio / Just by declaring sf::Music application returns error
« on: November 30, 2012, 06:52:13 pm »
Hello.
Am doing this
int main()
{
    sf::Music audio;
    return 0;
}
Process returned -2147418113 <0x8000FFFF> execution time : 0.100s
Press any key to continue.

I had huge program and was commenting out peace by peace until i stumbled on this.
Why is declaring sf::Music giving me error ? i also tried downloading latest snapshot build and also build my own with cmake and MinGW for codeblocks and am still getting this error, why is that?
Also what can i do to fix this?

Am coming from a post on gamedev.net if you need more info
Quote
http://www.gamedev.net/topic/635055-sfml-application-on-exit-dosent-return-0/

EDIT::
I just tried reproducing error with VisualStudio2010 Express and i was unable.
The error occurs with CodeBlocks10.05 using GCC/MinGW.
Any tips how to fix it on codeblocks?

Pages: 1 [2] 3