Working on a simple messaging library. The idea is to allow objects to communicate in a decoupled manner. Still in testing.
Currently some test code looks like this:
[cpp]
#include "Message.h"
#include "MessageServer.h"
#include "ValueMessage.h"
#include <string>
#include <iostream>
class TestMessage : public AML::Message
{
public:
TestMessage(int mnumber) : number(mnumber) {}
int number;
};
class TestClient : public AML::Messageable
{
public:
TestClient();
void handleMessage(AML::ValueMessage<std::string>& message);
void handleMessage(TestMessage& message);
};
TestClient::TestClient()
{
bindFunction<TestClient, AML::ValueMessage<std::string> >();
bindFunction<TestClient, TestMessage>();
}
void TestClient::handleMessage(AML::ValueMessage<std::string>& message)
{
queueMessage(message);
}
void TestClient::handleMessage(TestMessage& message)
{
queueMessage(message);
}
class TestReciever : public AML::Messageable
{
public:
TestReciever();
void handleMessage(AML::ValueMessage<std::string>& message);
void handleMessage(TestMessage& message);
}
TestReciever::TestReciever()
{
bindFunction<TestReciever, TestMessage>();
bindFunction<TestReciever, AML::ValueMessage<std::string> >();
}
void TestReciever::handleMessage(AML::ValueMessage<std::string>& message)
{
std::cout << message.getValue() << std::endl;
}
void TestReciever::handleMessage(TestMessage& message)
{
std::cout << message.number << std::endl;
}
int main()
{
TestClient client;
AML::ValueMessage<std::string> stringMessage("This is a rebounded message");
TestMessage testMessage(5);
client.dispatchMessage(stringMessage);
client.dispatchMessage(testMessage);
client.dispatchMessage(stringMessage);
TestReciever reciever;
while(client.pollable())
{
AML::Message& message = client.pollNextMessage();
reciever.dispatchMessage(message);
}
}
TestReciever();
void handleMessage(AML::ValueMessage<std::string>& message);
void handleMessage(TestMessage& message);
};
TestReciever::TestReciever()
{
bindFunction<TestReciever, AML::ValueMessage<std::string> >();
bindFunction<TestReciever, TestMessage>();
}
void TestReciever::handleMessage(AML::ValueMessage<std::string>& message)
{
std::cout << message.getValue() << std::endl;
}
void TestReciever::handleMessage(TestMessage& message)
{
std::cout << message.number << std::endl;
}
int main()
{
TestClient client;
AML::ValueMessage<std::string> stringMessage("This is a rebounded message");
TestMessage testMessage(5);
client.dispatchMessage(stringMessage);
client.dispatchMessage(testMessage);
client.dispatchMessage(stringMessage);
TestReciever reciever;
while(client.pollable())
{
AML::Message& message = client.pollNextMessage();
reciever.dispatchMessage(message);
}
}
[/cpp]
This prints
This is a rebounded message
5
This is a rebounded message
Obviously the rebounding is superfluous at the moment but I'm testing that system :v:
If anyone's interested, git: [url]http://github.com/Vodurden/AML/[/url]
The core idea is that you define what sort of messages you want to handle and how you want to handle them and then don't worry about where they're coming from.
There's also a lot of empty space to the right that you could put to use, a panel for details would fit nicely.
[b]Edit:[/b] My auto-merge :argh:
[QUOTE=Diaklu;18727308][img]http://img.loldepot.com/c83ced0cba27ca219d5e3.png[/img]
Decent user interface? Or did I add a bit too much on one item?[/QUOTE]
Perfect except for the white on green SVN icon.
[editline]11:22AM[/editline]
[QUOTE=voodooattack;18727399]There's also a lot of empty space to the right that you could put to use, a panel for details would fit nicely.
[b]Edit:[/b] My auto-merge :argh:[/QUOTE]
The information about the addon isn't going to stay that short with real addons. White space on the right means more room for addon information text.
[QUOTE=garry;18727054]I'm using this, haven't profiled it but I always trust their code to be faster than anything I could write :x
[/QUOTE]
Same here, just be careful with MSVC's iterator implementation and use the following defines if you haven't already:
[cpp]
// disable iterator checks on every vector access
#define _SECURE_SCL 0
#define _HAS_ITERATOR_DEBUGGING 0
[/cpp]
Just looked it up, are you sure it isn't _SECURE_SCL ? A lot of people on google seem to be making that mistake.
[QUOTE=garry;18727649]Just looked it up, are you sure it isn't _SECURE_SCL ? A lot of people on google seem to be making that mistake.[/QUOTE]
You're right, and the other one was _HAS_ITERATOR_DEBUGGING
Never knew about them before - are there any benchmarks or anything that shows their impact?
[editline]12:20PM[/editline]
Coded a kewl little class to make threading through a [del]list[/del] vector easier
[cpp]
class StripeEntityTick : public Threads::WorkStriper
{
public:
StripeEntityTick( IEntity::List& lst ) : m_List( lst )
{
SetName( "StripeEntityTick" );
SetWorkCount( lst.size() );
}
virtual void RunStripe( unsigned int i )
{
m_List[i]->Tick();
}
IEntity::List& m_List;
};
// To run
StripeEntityTick striper( m_EntityList );
striper.Run( true );
[/cpp]
Could probably macro it up to be one line - but fuck macros eh?
[QUOTE=Diaklu;18727308][img]http://img.loldepot.com/c83ced0cba27ca219d5e3.png[/img]
Decent user interface? Or did I add a bit too much on one item?[/QUOTE]
I'm sorry to be such a Quick Brown Fox nazi, but it's "Jumps" over the lazy dog, otherwise the string lacks the 'S' :v:
I should start working on something, so I'm not just the correcting asshole that pops in every now and then and puts people down.
[B]Edit:[/B]
And I think that amount of information is alright, but don't add anymore
[QUOTE=Jallen;18727446]The information about the addon isn't going to stay that short with real addons. White space on the right means more room for addon information text.[/QUOTE]
Oh, I instantly assumed that the display was for "short descriptions", since most mod managers I used with other games (Oblivion/X3/etc) had both short and long description fields.
In most cases, the long ones had support for rich-text files, the short ones did not; and with a typical design, you'd use the short description field to fill out the list above, and use the long description field in the panel I suggested.
Doesn't really matter I guess, I only made my judgment based on what I saw in the screenshot.
Just spent the last 25 minutes trying to fix my observer class, it was sending two messages instead of one for some reason.
Turns out it was because I was sending a message directly to the observer, aka intended behavior. Good way to waste time, hunting bugs that aren't bugs :v:
[QUOTE=voodooattack;18727869]Oh, I instantly assumed that the display was for "short descriptions", since most mod managers I used with other games (Oblivion/X3/etc) had both short and long description fields.
In most cases, the long ones had support for rich-text files, the short ones did not; and with a typical design, you'd use the short description field to fill out the list above, and use the long description field in the panel I suggested.
Doesn't really matter I guess, I only made my judgment based on what I saw in the screenshot.[/QUOTE]
Actually yeah, the short and long description would work well I think. I think the side panel with a long description could work well.
Programmed a useless little thing that turns code into an image.
[img]http://filesmelt.com/downloader/test40.png[/img]
Cool, can I give it a try?
[QUOTE=Xerios3;18730471]Cool, can I give it a try?[/QUOTE]
Sure, let me get an exe up.
Sorry its so damn huge, its importing the whole pygame libary because im lazy. Put code into a text file first, then enter the filename (minus the .txt) into the program.
[url]http://filesmelt.com/downloader/release2.rar[/url]
Also no, this is not where I got my avatar, but I took inspiration from my avatar to make this.
Reminds me of rock scroll: [url]http://www.hanselman.com/blog/IntroducingRockScroll.aspx[/url]
RockScroll is awesome.
[QUOTE=iPope;18730576]Sure, let me get an exe up.
Sorry its so damn huge, its importing the whole pygame libary because im lazy. Put code into a text file first, then enter the filename (minus the .txt) into the program.
[url]http://filesmelt.com/downloader/release2.rar[/url]
Also no, this is not where I got my avatar, but I took inspiration from my avatar to make this.[/QUOTE]
filesmelt is a shit, want to know why? Ok. If file with same name as yours was already uploaded before then your file IS NOT uploaded and you get link to download not your file
[QUOTE=iPope;18730576]Sure, let me get an exe up.
Sorry its so damn huge, its importing the whole pygame libary because im lazy. Put code into a text file first, then enter the filename (minus the .txt) into the program.
[url]http://filesmelt.com/downloader/release2.rar[/url]
Also no, this is not where I got my avatar, but I took inspiration from my avatar to make this.[/QUOTE]
OK.. Runescape client. Time to host elsewhere?
RockScroll would be better if you could change the zoom and if it would have a tooltip or something when you mouse over comments.
[IMG]http://i45.tinypic.com/vpxk03.png[/IMG]
How long you been waiting to use that Carl
[QUOTE=r4nk_;18731278]How long you been waiting to use that Carl[/QUOTE]
About 3 minutes. I've just made it.
[QUOTE=windwakr;18731131]Uh no. It automatically renames your file with a number on the end and gives you that link. Don't be posting shit like that if you haven't done any research. The only thing it won't upload right is shit named "untitled.blah".
[media]http://filesmelt.com/downloader/abc1.PNG[/media]
[media]http://filesmelt.com/downloader/abc2.PNG[/media]
Both were uploaded as "abc.png". As you can see, it renamed them and gave me the correct links.
iPope probably just uploaded the wrong file.[/QUOTE]
No way did I upload the wrong file, I don't even play runescape or whatever it was. I'll upload it somewhere else.
[url]http://jump.fm/ELKGM[/url]
should work.
Why the jump.fm link? Is 2shared banned here?
[QUOTE=iPope;18731416]No way did I upload the wrong file, I don't even play runescape or whatever it was. I'll upload it somewhere else.
[url]http://jump.fm/ELKGM[/url]
should work.[/QUOTE]
Took me a whole minute to find that download button
[editline]08:36PM[/editline]
Awesome =D
[IMG]http://i49.tinypic.com/2md5m2w.png[/IMG]
That's the core code of my game
"lets make the download link font size smaller than everything else on the page :downs:"
this is neat pope! :D Kind of wish we didn't need the entire tcl/tk distribution but whatevs!
[QUOTE=garry;18727683]Never knew about them before - are there any benchmarks or anything that shows their impact?[/QUOTE]
Not that I know of, but there's major discussion about it on gamedev.
[QUOTE=iPope;18730378]Programmed a useless little thing that turns code into an image.
[img]http://filesmelt.com/downloader/test40.png[/img][/QUOTE]
That's awesome, I love it.
By the way guys, more progress on OpenGTA2 - still working on utility part of the engine. Today I rewrote convars (but gonna rewrite them again - they are almost the way I want, just few things are not easy to do yet. which I'm gnona change), console itself (it's a bit better, supports pressing UP for previous commands, switching fonts, etc), added some console commands and convars, and added better error handling of a sort.
Now some pictures, here's console with two fonts:
[media]http://filesmelt.com/downloader/opengta2_consoletest.JPG[/media]
The font to the left is GTA2-converted one, it doesn't have many special symbols like [ _ ]. I added them to font to the right, as I mentoined before (fixed jittery pixels on some letters too).
Here's just illustration - the program reports error, and automatically causes breakpoint, so you can see where error came from:
[img]http://filesmelt.com/downloader/opengta2_breakpointtest.JPG[/img]
Currently it just calls interrupt 3, which triggers breakpoint, which should work perfectly fine under linux and under windows (under windows it brings up a screen where you can shut down, send report, or start debugging), under linux uhh... no idea what it does. A debugger should be able to pick it up...
Oh yeah, if you look closely, you'll see that it allocates 4 kb, but really increments by 8 - that's just a kind of debug-mode array overflow checking, and also it makes me more happy to see that release version uses twice less RAM.
And I fixed the brown fox:
[media]http://filesmelt.com/downloader/opengta2_brownfox.JPG[/media]
[QUOTE=BlackPhoenix;18732475]And I fixed the brown fox[/QUOTE]
That has all letters but the correct sentence is:
The quick brown fox jumps over the lazy dog.
Sorry, you need to Log In to post a reply to this thread.