June 18, 2018, 08:04:00 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
   Home   Blogs Help Search Tags Login Register  
Pages: 1 ... 8 9 [10]
 on: May 04, 2011, 05:27:31 AM 
Started by bedndarc - Last post by bedndarc
Initially format change has induced me to sampling fps, for alignment of speed of game))))
 Well and now certainly me interests fps, besides for alignment of speed, but connected with different in capacity of the PC. By slow machines all very slowly, on fast - very quickly. I hope that to a smog through sampling fps to make a ratio fps/speed of game.

 on: May 01, 2011, 07:35:24 AM 
Started by bedndarc - Last post by Mattias Gustavsson
yeah, using RLE bitmaps is much more efficient than straight PNGs. But have you tried RLE16? It gives just as good visual result as PNGs, but should be more efficient (though not as efficient as RLE8).

 on: May 01, 2011, 06:56:48 AM 
Started by bedndarc - Last post by Cycl0ne
Hey cool with -showfps.

i was astonished. my game ran with png -> 16fps worst case. with the walls in pix -> 20fps, with the whole gui in pix -> 60fps.

so 1280x800 in 16bit png seems to slow down everything Wink But it also tells me to split the screen update into different parts for updates. (at the moment 60% of the screen sits still).

 on: May 01, 2011, 01:47:53 AM 
Started by Cycl0ne - Last post by Mattias Gustavsson
I don't think I would put a script language into Pixie - I see that kind of thing as very much a game side system. Just exposing the basic engine systems is not very helpful, as you would then have to implement the entire game in LUA - and why would you do that when you can implement it in a proper language with full debugging capabilities and optimisations? If one were to use a script language, it would be for rapid iteration of certain game systems (like AI/behaviours) or to allow modding of the game without a need for a compiler. But to do that, it would still be necessary to write the main systems in C++, and then expose carefully selected game functions to the script language - or even better, write a custom script system which makes the most sense for your specific game and its needs.

LUA is a nice language, but there's lots of other choices too - so I think it is much better to keep it as a game side addition, rather than adding it into the engine itself.   Cool

 on: April 30, 2011, 02:30:39 PM 
Started by bedndarc - Last post by Mattias Gustavsson
If you just want to display it, you can just specify -showfps on the command line, which will display it on screen - it's built into Pixie.

If you want to have code for calculating fps yourself, here's what I use in the engine:
static float previousTime=Platform::GetPlatform_Time()->GetTime();
static float accumulatedTime=0;
static int currentFrameCount=0;
static int frames=0;
float newTime=Platform::GetPlatform_Time()->GetTime();
float deltaTime=newTime-previousTime;
if (accumulatedTime>=1)

Basically, I count frames until one second have elapsed, and use that number for fps - I find it to give a nice solid number, which doesn't jump all over the place all the time Tongue

 on: April 30, 2011, 02:25:10 PM 
Started by Cycl0ne - Last post by Mattias Gustavsson
Oh, the XML system is fairly straightforward to use. One example of how it is used is the Font class (Font.h/Font.cpp). First thing you do is inherit from XMLObject

class Font:XMLObject

then, you add two overloaded virtual methods to the class

       virtual XMLObject* XML_Element(StringId _name, const XMLAttributeList& _attributes);
       virtual void XML_Attribute(StringId _name, const XMLVariant& _value);

These methods will be called by the XML system as data is parsed.

The implementation of those methods might look like this
//*** XML_Element ***
 XMLObject* Font::XML_Element(StringId _name, const XMLAttributeList& _attributes)
       int ascii=xmlAttributeValue("ascii");
       if (ascii>=0 && ascii<=255)
          Character& character=characters_[ascii];
       char* filename=StrDup(xmlAttributeValue("filename"));
    return 0;
 //*** XML_Attribute ***
 void Font::XML_Attribute(StringId _name, const XMLVariant& _value)

To load a file, you just call LoadXML on your object, and it will load and parse the specified XML file, and call those methods as it parses the data.

The first method, XML_Element, is called every time an XML element is encountered in the data stream. You can use the xmlCase macro as a shortcut for doing an if... statement on each name. The macro makes sure that the comparison of the element names will be done using just a pointer comparison, rather than a full string compare, making it very efficient. There's also the xmlAttributeValue, which allows you to look up any attribute attached to that element, to store the value (alternatively, you can instead catch the attribute values in the second method, XML_Attribute, by using the xmlValue macro). Attribute values are given as the special type XMLVariant, which means you can assign it to any type of variable, and it will automatically convert it to the right type, making it very handy for reading data.

Btw, I've recently spent a bit of time integrating support for the YAML data definition format in Pixie, using a similar abstraction layer - I find YAML much easier to work with than XML, as it is more readable and easy to edit (and also, JSON is a subset of YAML, so it technically supports JSON as well). I'll personally be switching over to YAML for most things, but will leave XML support around, maybe as part of the main Pixie code base, but more likely as an optional extension - I'm a big believer in culling stuff out from the engine, to keep it mean and lean - not good to let it get too bloated Cheesy

 on: April 29, 2011, 03:01:12 PM 
Started by bedndarc - Last post by bedndarc
Thanks, I will try

 on: April 28, 2011, 11:41:57 AM 
Started by bedndarc - Last post by Cycl0ne
Somewhere in your main you have the FrameTime Class initialised correct?
You just have to do the following then:

FrameTime time;   // A FrameTime object is the easiest way to measure the frames time

float overallTime += time;



 on: April 28, 2011, 04:01:51 AM 
Started by Cycl0ne - Last post by Cycl0ne
Ohh and while we are at it : how does your XML System work?

 on: April 28, 2011, 03:33:44 AM 
Started by bedndarc - Last post by bedndarc
How it is possible to receive value fps? (The Amount of frames per second) whether Is such in an engine?

Pages: 1 ... 8 9 [10]
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!