Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411792 Posts in 69413 Topics- by 58459 Members - Latest Member: DANDAN1

May 28, 2024, 01:04:49 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Level-Editor Needed(eventually)
Pages: 1 2 [3]
Print
Author Topic: Level-Editor Needed(eventually)  (Read 6061 times)
muku
Level 10
*****


View Profile
« Reply #40 on: April 08, 2010, 04:05:45 PM »

(Makes me wonder if any of the established text serialization formats already have a standard binary serialization format; probably not, since you'd have to write all the tags out in text format anyway.)
XML-to-binary. The idea is you make a schema for your xml, and it uses that to avoid encoding actually mentioning the tag names, the schema just maps to a compact binary file layout. But I bet I could get reasonable peformance/compression just using string pools to avoid vast amounts of text.

Yeah, or just use some standard compression algorithm (most of which use something akin to dynamically built string pools internally anyway). Typical XML documents should compress reasonably well. And voilĂ , there is your binary distribution format! Tongue

(Except that I dislike the over-engineered, over-verbose mess that is XML and prefer lighter-weight alternatives like JSON or YAML, but whatever.)
Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #41 on: April 08, 2010, 09:33:40 PM »

So I formatted my lappy about a week ago and never re-installed SFML. When I run I get the following error now:



I don't get this problem making a simple console application-- So I don't think I'm really missing anything in GCC/MinGW?

Help please!

I've decided to write my own extremely simple GUI system within SFML, since Qt and WinForms take too much time to learn for the simple things I need, and I can integrate the GUI engine with my Game engine so they work together and streamline things like drawing and playing audio.

As for file format, I'm going to go XML for now. It's fast, easy, and readable. If size becomes an issue, I'll consider a custom format or this daunting binary serialization.
« Last Edit: April 08, 2010, 09:38:33 PM by Jakman4242 » Logged

TobiasW
Level 8
***


This can only end brilliantly!


View Profile WWW
« Reply #42 on: April 09, 2010, 01:54:28 AM »

Already tried
a) googling it and
b) downloading it?
Logged

BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #43 on: April 09, 2010, 09:44:28 AM »

The problem was that the DLL was on my computer--yes--But it was in System32 and not being recognized by the application. I also had this problem with all my SFML DLLs, I can't just have them in my System32 folder now, apparently.

Is this a 64-bit windows thing?

[EDIT]
A much more important question-- How can I hold arbitrary data in a class? I'm trying to create an event system, and I want the events to hold a piece of data to go along with the flag. I'm not particularly sure how to just have a piece of data that could be an int, float, char, string, rectangle class, whatever.(and I'm also not sure how I'd handle it.)
So: How can I include an arbitrary piece of data in a class?
« Last Edit: April 09, 2010, 12:11:38 PM by Jakman4242 » Logged

Mikademus
Level 10
*****


The Magical Owl


View Profile
« Reply #44 on: April 09, 2010, 12:20:56 PM »

Code:
enum data_type { DT_int, DT_float, DT_target, DT_pie };

struct DataBase
{
    data_type what;
    DataBase( data_type what ) : what(what) {}
};

struct IntData : DataBase
{
    int value;
    IntData( int value ) : DataBase(DT_int), value(value) {}
};

//... more classes here

class ClassWithData
{
    typedef shared_ptr<DataBase> DATA;
    DATA pData;

    void setData( DATA pData ) { this->pData = pData; }
    DataBase& getData() { return *pData; }
};

void CallingFunction( ClassWithData &rDataCarrier )
{
    DataBase &rData = rDataCarrier.getData();

    if (DT_pie == rData.what)
        EatPie( static_cast<PieData &>(rData).pie );
}
« Last Edit: April 09, 2010, 12:23:59 PM by Mikademus » Logged

\\\"There\\\'s a tendency among the press to attribute the creation of a game to a single person,\\\" says Warren Spector, creator of Thief and Deus Ex. --IGN<br />My compilation of game engines for indies
TobiasW
Level 8
***


This can only end brilliantly!


View Profile WWW
« Reply #45 on: April 09, 2010, 02:30:27 PM »

I would suggest looking at the SFML Event class. Its approach has a higher ease of use and type safety by using structs in combination with an union...
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #46 on: April 10, 2010, 03:07:52 AM »

So: How can I include an arbitrary piece of data in a class?
Boost::any
Boost::variant

Interestingly, Mikademus's approach would be the following in haXe:

Code:
enum data_type
{
  DT_int(i:Int);
  DT_float(i:Float);
  DT_target(t:Target);
  DT_pie(p:Pie);
}

function CallingFunction( rDataCarrier )
{
    switch(rDataCarrier.getData())
    {
        case DT_Pie(p):
        EatPie(p);
        default:
    }
}

That language is really growing on me.
Logged
Pages: 1 2 [3]
Print
Jump to:  

Theme orange-lt created by panic