Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411284 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 04:00:47 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
  Show Posts
Pages: [1] 2 3 ... 8
1  Developer / Technical / Re: A* pathfinding in C++? on: July 19, 2013, 07:35:34 AM
Here: http://ideone.com/gITAuf

This one was optimized for finite maps.
You have to call setMaxIndex with maximum index of node, and provide node to index mapping.
2  Developer / Technical / Re: 4 billion bullets. on: April 28, 2013, 04:45:29 AM
If every object in the game gets it's ID from the same counter, you might want to divide this counter into two (or probably more) ranges.
For example range 1..100000 is for more or less persistent objects, or at least objects that live long enough. And 100001..(2^32-1) is for bullets.
When the counter for bullets overlaps (2^32-1) set it to 100001.
When the counter for long living objects reaches 100000... the game should crash with appropriate error message, so you can change this 100000 to 200000 or even 1000000 Smiley
3  Developer / Technical / Re: tiles that are rotated slightly on: January 29, 2013, 05:50:34 AM
Unless you are drawing it with software OpenGL driver,
there should not be any difference if it is 100 or 1000 triangles
even on onboard video chip.
Check glGetString(GL_VENDOR); and glGetString(GL_RENDERER);

And... actually opengl clips everything that doesn't fit in frame buffer.
It's probably not as fast as when you do not draw these
triangles at all, but still faster then drawing them.

One note from my experiments with opengl on windows (nvidia).
When I turn on vsync (in windowed mode), cpu usage rises significantly
even for very simple 2d scenes. And what is really
surprising, it somehow depends on complexity of the scene!
Drawing 10 and 100 triangles have different cpu consumption with vsync on.
With vsync off both cases are 0-1% cpu.
4  Developer / Technical / Re: tiles that are rotated slightly on: January 28, 2013, 06:35:01 AM
When image from texture atlas isn't drown pixel perfect, pixels from
neighbour images can mix into the resulting image.
You need frame of transparent pixels around each image(letter).
5  Developer / Technical / Re: GML with() and other() on: December 23, 2012, 03:51:17 AM
C++ have different paradigm.
Instead of scattering game logic in multiple with statements, you describe
logic related to object in methods of corresponding class.
Like this:
Code:
class SomeObject{
public:
  void moveToward(SomeObject& other)
  {
    x+=(other.x-x)*0.01f;
    y+=(other.y-y)*0.01f;
    if(distanceTo(other)<10)
    {
      other.incSize(0.1f);
      destroy();
    }
  }
  void incSize(float inc)
  {
    size+=inc;
  }
  void destroy()
  {
    destroyed=true;
  }
protected:
  float x,y,size;
  bool destroyed=false;
};

std::vector<SomeObject> objList;

void someFunc(SomeObject& other)
{
  for(SomeObject& obj:objList)
  {
    obj.moveToward(other);
  }
  auto it=std::remove_if(t.begin(),t.end(),[](const Test& t){return t.destroyed;});
  t.erase(it,t.end());
}

6  Developer / Technical / Re: Parsing and EBNF notation on: November 05, 2012, 05:52:55 AM
It works like this. For example we have rules:
Code:
  ADDRULE(1,("val int","expr: tInt",0),handleVal);
  ADDRULE(3,("add","expr: expr tPlus tEol? expr",50),handleBinOp);
  ADDRULE(3,("mul","expr: expr tMul tEol? expr",100),handleBinOp);

and input: 2+2*2
analyzer can figures that expr rule can start with term tInt.
So '2' calls 'val int'.
analyzer also marks expr as recursive.
after 'val int' is complete next term look ahead is performed.
'+' symbol uniquely present in 'add' rule.
priority of add is 50, priority of 'val int' is 0.
add have higher priority and is called.
right hand side of add rule also expr and is called.
when it comes to *, it checks that mul rule have higher priority,
and calls it.
There is also 'rule compatible at position' concept.
If there are two rules:
A B C X
and
A B D Y
they are maked as compatible at position 3.
if first rule is being matched and fails at C,
parser will switch to second rule and will try to match D.

Parser works approximately twice slower then hand written recursive
descent lua parser written in pure C.
7  Developer / Technical / Re: Parsing and EBNF notation on: November 02, 2012, 05:59:50 AM
Nope it's priority in expression.
There are (obviously) a lot of rules with name/lhs 'expr'.
It's hacked recursive descent.
Plain LL(1) do not allow left recursion, but I have special cases for recursive rules.
8  Developer / Technical / Re: Parsing and EBNF notation on: October 29, 2012, 07:39:50 AM
I'm using similar approach.
However, I decided to go with symbolic resolution.
Any decent programming language has significant amount of rules.
If rule=object, you end up with insane amount of variables for rules.
I define rules like this:
Code:
  ADDRULE(2,("expr func","expr: tFunc- tORBr-^ tEol? paramList tEol? tCRBr- stmtList tEnd-",500,true),handleFuncExpr);
ADDRULE is some hairy macro.
2 is number of arguments of semantic action.
"expr func" is name of rule
tFunc- is 'func' keyword and - sign means that this identifier is not needed as semantic action argument.
^ sign is priority reset.
500 is priority
true signifies for right associativity.
handleFuncExpr is method.
Like this:
Code:
Expr* ZParser::handleFuncExpr(FuncParamList* lst,StmtList* stmt)
{
  Expr* rv=new Expr(etFunc);
  rv->pos=callStack.last->callLoc;
  rv->args=lst;
  rv->body=stmt;
  return rv;
}

Working pretty well Smiley
Yes, errors in rules can only be found in runtime.
But they are rare and should be fixed only once Smiley
With this approach I can go totally dynamic... and break my mind probably Smiley
9  Developer / Technical / Re: SDL + OpenGL - hardware acceleration on: October 15, 2012, 06:13:53 AM
Looks fine to me. I don't use SDL_HWSURFACE and SDL_DOUBLEBUF.
Btw what is output for these:
Code:
Debug("OpenGL Vendor     : %s\n", glGetString( GL_VENDOR ) );
Debug("OpenGL Renderer   : %s\n", glGetString( GL_RENDERER ) );
10  Community / Townhall / Re: Timber and Stone: create a city, and defend it. on: October 11, 2012, 06:57:16 AM
Awesome!
There is great potential in this.
Eagerly waiting for release Smiley
11  Developer / Technical / Re: What do you listen while you Code? on: October 08, 2012, 06:02:25 AM
Mostly Dark Electro/EBM/Electro Industrial. Sometimes NDH.
My latest finding: Terrifying - The Next Level.
12  Developer / Technical / Re: SDL + OpenGL - hardware acceleration on: October 08, 2012, 05:57:46 AM
Code:
  SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,true);
13  Community / Townhall / Re: New game: Neoteria (shmup) on: August 08, 2012, 07:22:36 AM
Nice game. Good job. I won it once Smiley
But my finger hurts after tapping so much.
Make autofire options please Smiley
And make something with enemies that fly from behind at high speed.
The only way to avoid crashing into them is to memorize where they will appear.
Which is bad. IMHO.
Take a look at classics.
Either draw blinking arrows at places where they will appear,
or show them and with little delay make them fly.
14  Developer / Technical / SDL+OpenGL on: August 02, 2012, 05:03:32 AM
I've encountered rather strange problem using OpenGL in SDL application.
I already solved it and decided to share the solution.

I reinstalled Windows 7. After I configured everything and installed latest NVidia drivers I tried to run my app. It was working, but really slow. Soon I noticed that it is working in software mode. Vendor='Microsoft corporation' Renderer='GDI generic'.
Long story short:
Code:
  SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL,true);
Without this you SDL+OpenGL app might run with software OpenGL.
Good luck.
15  Developer / Technical / Re: The best feeling in the world on: July 22, 2012, 06:26:14 AM
About a week ago my primary hard drive decided to die.
I'm using cvs repository on usb flash drive, so all my projects are fine.
But still, there are a lot of files on hard drive that I would like to have.
I tried to plug died drive after I installed system on new one, but without much luck.
System just was not loading while old drive was plugged in.
Then ... just in case ... I turned on IDE compatibility mode in bios (all my drives are SATA, so drives were working in AHCI mode).
And ... little miracle - drive suddenly started to work.
I started copying from old drive to new.
Old drive died again (and finally) when progress was on 99% mark.
Little technical miracle happened.
Thank you very much my old good friend Smiley

p.s. backup often, backup into different locations!
16  Developer / Technical / Re: Another HTML5 issues... OPEN SOURCE on: July 19, 2012, 04:53:03 AM
Post replays to server, where it is simulated and correct score is calculated Smiley
17  Developer / Playtesting / Re: Dungeon Colony - prototype/alpha on: July 17, 2012, 06:09:58 AM
Interesting concept.
But current version is way too slow IMO.
Looking how they gather wood feels like a waste of time.
It would be nice to have time control - 1x,2x,3x.

I created 2x2 field of traps. First bandit died,
but others went thru it unharmed. Is it intended?
Creating 2x6 is somewhat cumbersome.
Combat looks strange.
Is there a way to make minions stronger?
Weapon, armor?

I didn't understand how to collect loot from dead bandit.
18  Developer / Technical / Re: Using Sleep in Games to return CPU time to Windows on: July 15, 2012, 05:05:14 AM
I'm using something like this:

Code:
  timer_t delay=1000000/frameRate; //delay between frames in microseconds
  timer_t overDelay=0;
  for(;;)
  {
    timer_t startTime=getTimer(); //getTimer returns timer time in microseconds
    drawFrame();
    timer_t endTime=getTimer();
    timer_t opTime=endTime-startTime;
    if(delay>opTime+overDelay)
    {
      int64_t toSleep=delay-opTime-overDelay;
      startTime=getTimer();
      delay(toSleep/1000);/sleep in milliseconds
      endTime=getTimer();
      overDelay=endTime-startTime-toSleep;
    }else
    {
      overDelay-=delay-opTime;
      if(overDelay < -delay)
      {
        overDelay=-delay;
      }
    }
  }
19  Developer / Design / Re: Does anyone else hate that games are becoming F2P+micro-transaction based? on: June 27, 2012, 06:49:20 AM
What I HATE in F2P games is trying to cover artificially created inconvenience or annoyance with in game purchases.
It would be somewhat ok if price is around $1 for each item with investment of $10-$20 turning game into 'full fledged'.
But when they are asking $5-$10 per feature and $100-$200 to cover everything... It's just beyond good and evil.
20  Developer / Technical / Re: Memory leak on: June 18, 2012, 05:51:21 AM
lua uses scanning gc.
It will free memory only periodically.
In long term run the memory usage wont't cross some upper limit.
Pages: [1] 2 3 ... 8
Theme orange-lt created by panic