Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!

We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Member Since 04 Jul 2012
Offline Last Active Today, 08:36 PM

#5192412 cryptopp, issues. every first time i try to build it i get errors, but then i...

Posted by BaneTrapper on 12 November 2014 - 07:37 AM


I am running win7 IDE:CodeLite Compiler:TDM-GCC-64

Selfbuild cryptopp, also tried pre compiled one.
My teammate is using cryptopp library, and he added it intro project. Now i am having issues. I built it many times, also tried using teammates ones since we run same OS and compiler, and i am getting same issue.

The issue is when i have change in a file that in any way includes cryptopp i will get this error log


When i press build again i get this log



My issue is that anytime i change a file i have to (Compile 2 times in order to actually get executable) press compile, wait, press compile and only then i am ready which takes on average 2+ minutes and its getting on my nerves...


Any ideas what may be causing it, i am ready to do anything!

#5173107 Getting direct acces to vector<unique_ptr<My_Class>> but ther...

Posted by BaneTrapper on 12 August 2014 - 09:55 AM


I feel that map will be slow.
premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.

- Donald Knuth


I agree, but if i am making something i will make it right from start, instead of spending time redoing it when i find out its slow, when i know it will be slow, chances that compiler would optimize are close to none, but there may be something out of my knowledge so profiling would be the choice, i just don't have time and i am certain that doing vector thingy i said would provide me with great performance and probably 10-15% more work, which ends up in 10 minute of coding when i know exactly what i am doing or what i want want.

#5162804 Help with implementing smooth mario movement

Posted by BaneTrapper on 25 June 2014 - 11:27 AM

Here is a quote from the documentation:

Sometimes, people try to react to KeyPressed events directly to implement smooth movement. Doing so will not produce the expected effect, because when you hold a key you only get a few events (remember, the repeat delay). To achieve smooth movement with events, you must use a boolean that you set on KeyPressed and clear on KeyReleased; you can then move (independently of events) as long as the boolean is set.
The other (easier) solution to produce smooth movement is to use real-time keyboard input with sf::Keyboard (see the dedicated tutorial).

I suggest reading the tutorial first.



Edit:: Anyway, in the quote the "Dedicated tutorial is not the one you want, this is what you want to read"


#5155859 I need ideas for a game...

Posted by BaneTrapper on 25 May 2014 - 07:19 AM

I was kidding obviously that suggestion is horrible...



I am looking to make a game that includes multiplayer feature, rankings, clans (player crews or teams) also with ranking... and possibly upgrades (doesn't matter where but it should contain them)


It should be something like a user owns a city.

The hell is one supposed to make out of this?

From my experience you are horribly mistaking the thinking of game content process...

You should augment what you have instead of trying to add more stuff just cause...

For example, i have a map where units move, sleep, do town stuff... Now i wont add a godzilla cause i think it will be fun. It would break the town in seconds and all the work i put intro making the town, workers etc just got wasted cause godzilla...

So instead of godzilla i will think about something like: merchants, yes that would provide me with few things for example, Fresh bunch of resources from other lands i have not yet visited, crops, weapons... To get resources i think merchant would require payment, so how do you acquire it? Harvesting system(And pay with what you harvet). Ok you can go around map collecting stuff, that on its own is not really fun but when you think that if you harvest you can buy something cool it really "augments" the harvesting part.

Now you have that which is cool but "augment" it again! Crafting system? YES, harvesting got more purpose, from resources you harvested you can Craft stuff, plus you can sell the crafted stuff.


You see how one think gives other reason and appeal? Do that and you get good game imo.

#5155849 I need ideas for a game...

Posted by BaneTrapper on 25 May 2014 - 06:28 AM

First of all, hello everyone, just created my account.. and sorry if this is the wrong category.. I don't know where to post this kind of topic..


So I have been trying to think of a game to make but I really got no ideas... I have started about 3 projects but none of them are original and they are very boring and repetitive.. I never finished them..


I am looking to make a game that includes multiplayer feature, rankings, clans (player crews or teams) also with ranking... and possibly upgrades (doesn't matter where but it should contain them)


EDIT: Forgot to tell you I want to do it a browser game, text based (PHP/HTML/Java etc)


What are your suggestions? 


Ok so i got this crazy idea, you should make a sprite like mario that can jump and that stuff, then you can have multyplayer where you can jump with other people, ranking and clans will come because you will count how many jumps they made, i want to compete in jumping that sounds so fun.

For upgrades since it doesn't matter you can change the mario sprite eye colors, that's right, make tons of eye colors, players will love eye color, you can pick from all the RGB spectrum that's allot of eye colors, but lock them for starters, only pros should have all the eye colors unlocked!



#5153960 Required to replenish resources/nature in 2d.

Posted by BaneTrapper on 16 May 2014 - 03:59 AM


For example take in mind a small map of 100x100 tiles, checking each tile would take 4*radius + for(int i = 1; i <= radius; i++){i*4} so for radius of 3 the tiles check would be
4*3 + 4+8+12 = 36 tile checks, also check if out of bounds... so 100x100 = 10,000 * 36 = 360,000. Off course it could be optimized in many ways but i do not like the end result.

360,000 is really not much at all. Further, you aren't making those checks every turn - only when a plant needs to grow. Let's imagine you update the growth of plants once a second (really, once every 10 seconds would give perfectly fine results). Once a second, at 30 frames a second, means you are only updating once every 30 frames. So instead, break your 360,000 checks so they are spread out over the entire 30 frames - that's only 12,000 checks a frame.

Oh i got schooled cool.png. Yes it could be done easily because i already got Regions that are big chunks of tiles and Areas that consist of few regions.

Will a more complicated regrowth system make the game more fun?

There is a deep answer, but the quick answer is that it depends on a person playing it.


I got sufficient answers thank!

#5153840 Required to replenish resources/nature in 2d.

Posted by BaneTrapper on 15 May 2014 - 03:41 PM



This system could be done but the process consumption would be high.


unless your map contains like 1 million trees i dont really think it can be that much consuming...


For example take in mind a small map of 100x100 tiles, checking each tile would take 4*radius + for(int i = 1; i <= radius; i++){i*4} so for radius of 3 the tiles check would be

4*3 + 4+8+12 = 36 tile checks, also check if out of bounds... so 100x100 = 10,000 * 36 = 360,000. Off course it could be optimized in many ways but i do not like the end result.

#5153816 Required to replenish resources/nature in 2d.

Posted by BaneTrapper on 15 May 2014 - 01:10 PM


In my progress to make 2d top down game i got stuck on a topic about resource refreshment / regrowth(The time period is bronze age,iron age)

I have a RTS kind of structure, you have units that can gather resources from map, but the map/resources will run out eventualy, and i want a way for them to replenish so i thought about nature growing back, it will add a nice spice.


My issue is that, i am kinda rusty on technical terms, and have found absolutely nothing while googling.


How i currently achieve resource regrowth is that i just place resource at random time, on map which provides quite unsatisfying results.


I thought about making areas for each specified stuff can spawn, so berry bush cannot just appear anywhere else but it regrows at specified place,(in radius of x). In the end the formula is will be quite fast and will provide with regrowth system but that is not very innovating, i think i could do more.

So i thought about making the nature expand logic for each biome separately. The nature would expand as such:

If there is a patch of dirt in forest area, and i do growth on it i would check whats nearby?(i found: grass, apple tree, flowers, berry bush). I would tier this stuff so i could have multiple stuff on one tile for, but no matching of type.

auto grass = 1;
auto flowers = 2;
auto berryBush = 3;
auto tree = 3;

From the example we can see that "berryBush" and "tree" could not occupy one tile at same time, but a tree, grass and flowers could.

This system could be done but the process consumption would be high.


Thus i am looking for alternatives, so if you have suggestions or if you know what a generic term it is so i could google it would help allot.

#5151655 What is your opinion and how would you do a structure that has multyple funct...

Posted by BaneTrapper on 05 May 2014 - 12:08 PM

Sorry, I didn't explain fully.
Use the | to bitwise 'OR' two flags together.
Use the & to bitwise 'AND' two flags together.

This is similar to how || and && work on bools, except it works on a bit level. (bitwise operators)


These aren't specifically designed for holding flags - they are used for manipulating bits in bytes and can be used for whatever purpose.

We can manipulate the bits to use the bits as separate flags, which is what we are doing here (and why it's slightly more confusing at first than what should be a simple task - it's a general-purpose tool).

objFarm = SFStorage | SFRest; //Add two flags together.

if(objFarm & SFStorage)
   //...The farm has 'SFStorage' on it.

objFarm |= SFProduction; //Add another flag into it.

objFarm &= ~(SFProduction); //Remove a flag.
objFarm &= ~(SFProduction|SFStorage); //Remove multiple flags.

objFarm = SFRest; //Remove every flag, and add 'SFRest'.

Note: For this to work, the flags must each have their own bit, and can't overlap with other flags' bits. This means they must have the values 1, 2, 4, 8, 16, 32, etc... (which is why the hexadecimal values you are using go 0x01, 0x02, 0x04, etc...).


1 = 00001

2 = 00010

4 = 00100


For some reason following line was not allowed by the compiler i had error. I hope it was a mistake on my part.

objFarm = SFStorage | SFRest; //Add two flags together.

That is why you see in the following i used ampersand i couldn't get it to compile. I will try to write it again and see what i got.

int main()
    holder objFarm;
    objFarm = SFStorage & SFRest;

But all in all, bit fields are great!, i did not know they even existed until this post!
And id really like to control them with enum types.




I personally would avoid the bit flags.  Unless you're going to be hurting for space because you have 100,000, or a million objects, then I'd suggest just using something simple, like a set, and I'd suggest you load all these attributes via a data file.


For example, you could have a json data file like this:


{"Structures" :
  "Farm" :
   ["Produces", "Operationable", "OnLand", "Storage"],
  "FishingDocks" :
   ["Produces", "Operationable", "OnLand", "OnWater", "Storage"]


Then in your code, you can just do this:


// load the objects into a simple structure like this
class Structure
    std::string Name;
    std::set<std::string> Attributes;
std::vector<Structure> Structures;
// use a json library, jsoncpp or jansson, to load the structures and attributes
// Now just look for each attribute in your list of Structures
for (uint32_t i = 0; i < Structures.size(); ++i) {
  if (structures[i].Attributes.find("Produces") {
    // do producing thing


Of course, all of this looks a lot like a component based entity system.  So, it might be easier to use a library already created to handle this kind of thing for you.  While I have a partially completed library, I think entitiyx looks good.


Either way, good luck, and have fun.

Those libraries are great, worth bookmarking, thanks.

But the reason i don't load from external file the structures is because they are dynamic, i don' know a farm is farm.

To know if X posses a farm i check if he has Land(Grow crops, trees...) or livestock and a building(with tools inside for cultivating land, livestock inside...).

There fore i decide what a building is depending on what is inside on fly.

#5141309 Want to make light/day cycle, searching for light engine or sugestions / idea...

Posted by BaneTrapper on 22 March 2014 - 04:39 PM


I am working on a hobby project a "2d, rpg, top down, tile based, real time, hack and slash".

I came to a point where i am supposed to add day and night cycle, but i am oblivious how to achieve that, adding light engine would allow to make torches/fire at night to glow which would be good so any suggestions?


What i want:

Dynamic lights.
To pass time from day to night and repeat.

To have glow effect like torches.


Most have:

Be usable with c++ and OpenGL.


#5131687 Designing a "quest" system for top down 2d rpg

Posted by BaneTrapper on 16 February 2014 - 05:52 AM


Currently i was kinda stuck on designing how i will handle quests in game.

I started designing quests to make my world feel rewarding and to give it some meaning but i never actually done a indept queset system that could handle infinite amount of types of quests, i alwais hardcoded it.


So what i though of would be good:

I started with 3 tipes : "Kill", "Gather", "Explor"

Kill quest example:

class Quest
void Loop();
void Finish()
class QuestKillUnit : public Quest
int killType;
int killAmount;;
Reward reward;

killType = en::UnitType::Boar;
killAmount = 7;
reward = Reward(Item(en::ItemType::WoodenSword);

But i have issues, how do i have a class that will handle all types of quests i give to it?


I will flesh out a delivery quest type

class QuestDeliverItem : public Quest
Unit* unitDeliver;
int radius;
Reward reward;

unitDeliver = &UnitHolder.unitList[FindJackSomehow  ];
radius = 32/2 + 32/2 + 20;//20 pixels away from the target to trigger the quest
reward = Reward(Gold(1));

And how eventualy i sould fit it togeder

void QuestHolder
void Loop();
void AddQuest(QuestKillUnit & quest);
void AddQuest(QuestDeliverItem & quest);
std::vector<std::unique_ptr<Quest>> QuestList;//This part i am not sure it will stay like this, it depends on issues without having avalibility to get data from it

void QuestHolder::AddQuest(QuestKillUnit & quest)
UnitHolder.AddUnitDeathEvent(quest.killType);//I will need this to report somehow back to the quest to increment +1 to kill count if killer is the "unit holding the quest"
QuestList.push_back(std::unique_ptr<QuestKillUnit>( new quest));//Not sure if it is correct  

My issues are:
I do not know how i will handle incrementing kill count for for "QuestUnitKill" when a unit is killed.

How will i pull out data from "QuestHolder::QuestList" vector so i can display "Kill Wolves 5 / 7"

And allot more that i cannot thing of top of my head right now.


Is there any indept tutorial on "Quest system" out there for c++? googling and searching this forum gave me none.

Also your ideas and sugestions are welcome!happy.png

#5116183 Saving files with std::ofstream checking if filename alredy exists to prompt...

Posted by BaneTrapper on 11 December 2013 - 06:45 AM

Sorry for post i sould google after first page, found it imedietelly.



Currently i am making mapeditor.

At point where a user presses "Save map" he is prompted to enter a name for the map.

After he is done entering the map name i want to check if the filename alredy exists, in case it alredy exists i want to prompt to user a overwrite command that there is a file with that name already, or allow him to retype the name.

The issue is i do not know how to check if file exists i only know how to open and write to it.

//FOLDER with maps
void Map::SaveMap(int mapID)
    const std::string fileName(glob::MAP_MAP_DIRECTORY + std::to_string(mapID) + ".txt");
    std::ofstream OFStream(fileName);
        glob::PrintError("Error at Map::Save error opening map file to save map, file issued to open: " + fileName);

For solution:

#5092988 c++ 2d tilebased collision theory craft allowing many units to wander on map

Posted by BaneTrapper on 10 September 2013 - 06:35 AM

So to describe more about my collision.

Units and tiles are size of 32 pixels in height and width.

Units each (500+rand()%500) get to pick action. If their last action is not finished they will continue doing current action.

When action is done a bool(isActionDone = true) marking for next unit loop that unit can take new action.

When unit acts it does following

moveDirY = rand()%4;//0 = noDir, 1 = up, 2 = down, 3 = noDir
moveDirX = rand()%4+2;//2 = noDir, 3 = left, 4 = right, 5 = noDir
if(moveDirY == up)
moveAmountY = -(rand()%96 + 32);
else if(moveDirY == down)
moveAmountY = (rand()%96 + 32);

Same occures for X movement and in case of noDir moveDir is set to 0 at begining of the loop.

Then units "move();" function is issues

allTypes toPositive(allTypes num)
if(num < 0)
    num *= -1;
return num;
bool Map::CheckTileWalkable(float posX, float posY);//returns true if tile is walkable
//I will explain about this later
moveAmount = unitMoveRate * deltaTime;
if(toPositive(moveAmountY) > 0)
if(objMap.CheckTileWalkable(unitPosX, unitPosY + moveAmount) == true)
    unitPosY += moveAmount;
//Same occurs for X except for X values

Now for the map collision detection witch i think is the problem in my case.

There are four cases i need to check before execute.


if(int(unitPosX)%TILE_SIZE/*32*/ == 0) //Checking if units X is directly only one tile if so check only 1 tile vertically, if false check 2 tiles vertically.

2: same as case 1 except checking for y

3:There is a bool(bool isWalkable = true) and from above code we can see witch tiles to check so the cases for tile check is

x=1 y=1, or x=2 y=1, or x=1 y=2, or x=2 y=2.
So i have 1D array of tiles that is stored in vector

for(int y = 0; y <= tilesToCheckY; y++)
    for(int x = 0; x < tilesToCheckX; x++)
        if(mapVec[(unitPosX%TILE_SIZE)+x + (((unitPosY%TILE_SIZE)+y)*mapSizeX).isWalkable == false)
            isWalkable = false;
return isWalkable;

IMO i am looking for a better way to provide illusion of units just wandering around map from time to time, and from the posts i read there was one great idea.

Check collision only once and store a path, then move unit along that path. This will be my next step i will attempt.


NOTE:: Not actual code, i do not have my project on this harddrive atm, i will update if i get huge desire to do so.




Somehow i don't like the performance i am getting and i am looking for some kind of nourishment because i am procrastinating this and it is really holding me back.


how many units, and whats your fps?


Do note i am not ignoring, but my hard drive is out of my reach at the moment i will post as soon as i have it.



EDIT:: Posting the code in case someone will need it

The following code is for unit getting random movement direction on X and Y and moving according to data stored in class.]

Pixel perfect collision included, if you are struggling.. ^^ feel free to use it.

class AI
    AI(int & dt, Map & objMap);
    void LoopAI(BaseUnitForMap & objUnit);
    void MoveDecidePosition();
    void MoveExecute();
    void MovePixelPerfectX();
    void MovePixelPerfectY();

    int & dt;
    BaseUnitForMap * objUnitptr;
    Map * objMap;
    int toPositive(int num);

    int moveAmountX, moveAmountY;
    bool isSprinting;
    bool movePixelPerfectX, movePixelPerfectY;
    int tempI;
void AI::MoveDecidePosition()
    int directionY = rand()%4;//Decide 0 nowhere, 1 up, 2 down, 3 nowhere
    //int directionY = 2;//Decide 0 nowhere, 1 up, 2 down, 3 nowhere
    int directionX = rand()%4+2;//Decide 2 = nowhere, 3 left, 4 right, 5 nowhere
    //int directionX = 0;//Decide 2 = nowhere, 3 left, 4 right, 5 nowhere
    if(directionY == en::Dirrection::up)
        objUnitptr->moveAmountAIY = rand()%64+16;
        objUnitptr->moveDirY = en::Dirrection::up;
    else if(directionY == en::Dirrection::down)
        objUnitptr->moveAmountAIY = rand()%64+16;
        objUnitptr->moveDirY = en::Dirrection::down;
    if(directionX == en::Dirrection::left)
        objUnitptr->moveAmountAIX = rand()%64+16;
        objUnitptr->moveDirX = en::Dirrection::left;
    else if(directionX == en::Dirrection::right)
        objUnitptr->moveAmountAIX = rand()%64+16;
        objUnitptr->moveDirX = en::Dirrection::right;
    //if(directionX > 0 && directionY > 2)
    objUnitptr->acting = true;

void AI::MoveExecute()
        if(objUnitptr->moveDirX == en::Dirrection::left)
            moveAmountX = -objUnitptr->movementRate * dt;
        else if(objUnitptr->moveDirX == en::Dirrection::right)
            moveAmountX = objUnitptr->movementRate * dt;
            moveAmountX = 0;
        if(objUnitptr->moveDirY == en::Dirrection::up)
            moveAmountY = -objUnitptr->movementRate * dt;
        else if(objUnitptr->moveDirY == en::Dirrection::down)
            moveAmountY = objUnitptr->movementRate * dt;
            moveAmountY = 0;
//Move X
    if(moveAmountX != 0)
        if(objMap->CHECKOutOfBounds(objUnitptr->posX + moveAmountX, objUnitptr->posY) == false)
            if(objMap->CHECKWalkable(objUnitptr->posX + moveAmountX, objUnitptr->posY) == true)
                objUnitptr->posX += moveAmountX;
                movePixelPerfectX = true;
            else if(movePixelPerfectX == true)
        else if(movePixelPerfectX == true)

//Move Y
    if(moveAmountY != 0)
        if(objMap->CHECKOutOfBounds(objUnitptr->posX, objUnitptr->posY + moveAmountY) == false)
            if(objMap->CHECKWalkable(objUnitptr->posX, objUnitptr->posY + moveAmountY) == true)
                objUnitptr->posY += moveAmountY;
                movePixelPerfectY = true;
            else if(movePixelPerfectY == true)
        else if(movePixelPerfectY == true)

    //std::cout<<"MAX:"<<moveAmountX<<" MAY:"<<moveAmountY<<std::endl;
    if(objUnitptr->moveAmountAIX - toPositive(moveAmountX) < 1 &&
        objUnitptr->moveAmountAIY - toPositive(moveAmountY) < 1)
        objUnitptr->acting = false;
        objUnitptr->moveAmountAIX -= toPositive(moveAmountX);
        objUnitptr->moveAmountAIY -= toPositive(moveAmountY);

void AI::MovePixelPerfectX()
//Moving PP X
    //std::cout<<"PP1 posX"<<objUnitptr->posX<<std::endl;
    movePixelPerfectX = false;
    if(objUnitptr->moveDirX == en::Dirrection::left)
        objUnitptr->posX -= (objUnitptr->posX % TILE_SIZE);
        //else do nothing
    else if(objUnitptr->moveDirX == en::Dirrection::right)
        tempI = objUnitptr->posX % TILE_SIZE;
        if(tempI != 0)
            objUnitptr->posX += TILE_SIZE - (objUnitptr->posX % TILE_SIZE);
    //std::cout<<"PP1 end posX"<<objUnitptr->posX<<std::endl;

void AI::MovePixelPerfectY()
//Moving PP Y
    //std::cout<<"PP1 posY"<<objUnitptr->posY<<std::endl;
    movePixelPerfectY = false;
    if(objUnitptr->moveDirY == en::Dirrection::up)
        objUnitptr->posY -= (objUnitptr->posY % TILE_SIZE);
    else if(objUnitptr->moveDirY == en::Dirrection::down)
        tempI = objUnitptr->posY % TILE_SIZE;
        if(tempI != 0)
            objUnitptr->posY += TILE_SIZE - (objUnitptr->posY % TILE_SIZE);
    //std::cout<<"PP1 end posY"<<objUnitptr->posY<<std::endl;

int AI::toPositive(int num)
    if(num < 0)
        return num *= -1;
    return num;

#5092783 c++ 2d tilebased collision theory craft allowing many units to wander on map

Posted by BaneTrapper on 09 September 2013 - 01:16 PM


Currently and ~third week of me doing collision, and it isn't turning out as i hoped for.

The basic idea is simple:
1: Check if player somehow issues for unit to move

2: If unit is issued to move calculate movement rate using delta time and units movement speed

3: Check if the position unit wants to move is walkable and store position

4: If the position is not walkable do pixel perfect collision and store position

5:  Move unit to position

Done!, right that was simple.

Doing this in code is all fun and games but it hurts getting unexpected results time after time...


i am storing unit position in float, unit movement is in floats so i can increase and decrease its movement speed by those little amount and still make it visible.

I am trying to achieve so i can have many units on map just minding their business.


I have units and i can make them wonder linear direction once (500+rand()%500) milliseconds, and its hauling massive amount of units at low cpu usage (2000+ units to get 2-3% cpu usage) the issues starts when i add collision detection for each movement.
Performance drops drastically and i am pretty sure i am doing collision wrong, collision i am checking for is just getting unit position it is gonna move to and then checking is tile/tiles walkable (its just a boolean that tile class holds and is of course true if walkable false if solid)(1-4 tile checked) if the tiles checked 1-4 any are walkable==false i don't allow movement.


Somehow i don't like the performance i am getting and i am looking for some kind of nourishment because i am procrastinating this and it is really holding me back.

I am feeling i need to progress to higher difficulty but the "beast" is overcoming me ATM.

Anyway i am doing 2d, tile based, top down view, survival game its gonna be nothing special but in order to learn i need to do new stuff and doing real time movement with collision detection is one of those so any suggestions are greatly appreciated!


What i am asking for is, how did you deal with a issue that you couldn't figure out?

I am probably right now just writing so i don't go back to pen and paper and think how else i could handle movement to get better performance, after all i want to add little more AI logic in there and for it to still work on low end computer, but its out of my reach for the moment.

#5089120 Making AI, Decisions for logic on 2d tiled map

Posted by BaneTrapper on 26 August 2013 - 02:51 AM

That is a good technique to split up AI logic intro separate loops like that.


I am also not satisfied with my logic for "Look for food when hungry", "Look for water when thirsty".

Its not efficient and if all units on map would run this function the game would be running mare 30fps.


What i do is loop all tiles around the unit and check its type if it fits the food type that unit eats.

I was thinking about making a representation of area.

For example:
This 10x10 blocks have "Berry bushes, grass, dirtm sand, water" While the unit is in this square it regenerates if(Omnivore or Herbivore) food from berry bush and grass, water.


But i am feeling i am stretching stuff out to long, the point of a game is 2d exploration with crafting and leveling and raiding dungeons(Sounds allot) but i will take the time.