Koki on 22/5/2012 at 08:58
You don't understand. They walk sideways.
Bakerman on 23/5/2012 at 08:27
Speaking of roguelikes, I just stumbled upon (
http://tapio.github.com/unicodetiles.js/) this. It's a JavaScript library to render unicode terminal graphics in a browser. Definitely giving that a go over the holidays. Time to finally make that Space Hulk-a-like!
zombe on 26/5/2012 at 01:31
Just had a facepalm-victory-dance moment i can not help but share. Might be of use to someone also, or fish out some good ideas/alternatives.
--------------------
Problem: Elevating privileges in javascript asks for user permission (thankfully) - and keeps asking it ... all ... the ... fucking ... time.
It would be nice if i could tell FF to just give the permissions for some specific script (local file) and never ask for anything. As a compromise, just asking once per page load is also fine.
Options:
* Check "Remember this decision" - my security sense is tingling. Could not find what _exactly_ it affects and what security considerations it entails - wtf? :/. Exception resolution seems to be very poor tho (just "file://", not full URI). Not that i found any indication it even HAS any exception resolution at all - wtf^2?. I remember reading a long-long time ago that checking it is a terrible idea ... no idea where nor why it was said.
* Enable user_pref "signed.applets.codebase_principal_support" in prefs.js - my security sense is tingling. (odd, while this is present in about:config too it does not seem to work as far as "file://" principal is concerned)
* Make a plugin (making plugins is made amazingly easy with the plugin builder [web based or downloadable sdk]) ... well, non standard stuff still needs that i actually find whatever it is i need to make a plugin for my specific/peculiar needs. Did not get anywhere with this in a reasonable timeframe, so - fuckit.
* Signed .js. Nice, however, for security reasons "mixed scripts on an HTML page operate as if they were all signed by the intersection of the principals that signed each script" - so, can not just sign one and happily alter the rest of the .js files. Which makes it completely unusable for me. Did not investigate it further.
* Local web-server+php / ajax: XAMPP is quite nice for that - and i have it already installed and configured. Have used it and it is way too inconvenient for me (also, not sure my current configuration even allows read/write outside web/include folders). Also, iirc ajax has/had issues with plain binary files.
* Something else even less documented my google-fu was unable to discover.
In-depth-problem:
Elevating privileges with "netscape.security.PrivilegeManager.enablePrivilege" remains in effect only in the scope it was called in (inc. functions called etc in that scope).
If the context is lost (function is done with whatever it was doing) then so are the privileges. This makes things like "autosave" impossible as every invocation would spawn the confirmation dialog.
Facepalm:
Wait a fucking minute ... "remains in effect only in the scope it was called in" ... what if i YIELD it !? (aka. poor mans multithreading in javascript as i mockingly call it). As long as i never exit the "thread" it sure as hell should stay in context indefinitely.
Code:
<script type="application/javascript;version=1.7"><![CDATA[
var save = 'Foobar!';
var dosomething = 0;
function test() { // invoked by "body onload"
var it = bananas();
document.body.$add(['input','type','button','value','test','onclick',function(){ it.next(); }]); // using my homebrew lib to make a html button for testing
}
function bananas() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
while(true) {
if(dosomething==0) {
var file = Components.classes["@mozilla.org/file/local;1].createInstance(Components.interfaces.nsILocalFile);
file.initWithPath('D:\\test.txt');
if(!file.exists()) file.create(0, 0664); // -rw-rw-r- ... meaningless for win
var out = Components.classes["@mozilla.org/network/file-output-stream;1].createInstance(Components.interfaces.nsIFileOutputStream);
out.init(file, 0x20|0x02, 0x04, null); // ioFlags: PR_TRUNCATE | PR_WRONLY, perm: PR_RDWR
out.write(save, save.length);
out.flush();
out.close();
}
yield;
}
}
]]></script>
Yay! It works as expected. Now, need update my file read/write wrapper.
Bakerman on 26/5/2012 at 09:55
So, after nearly six years of working with Torque, and a few before that pottering around with other game engines and programming, I have produced A Game. Not much of one, but A Game it is nonetheless. Mostly.
I wrote it for a competition on (
www.garagegames.com) GarageGames (who publish the Torque engine), the aim of which was to produce a small multiplayer title within a month. I decided a fast-paced Deathmatch-em-up shooter would be the easiest, and I wanted to explore ways to make that gameplay a bit more interesting. Of course, for me it ended up being a game in one week at the start of the month and two days at the end... but I'm reasonably proud of what I managed to submit.
(
http://www.ug.it.usyd.edu.au/~dbuc6168/gloves/) A little about GLOVES.
And, because everything's better with pictures:
(
http://www.ug.it.usyd.edu.au/~dbuc6168/gloves/images/fps2.png) Is there a way to resize embedded images?
So yeah, basically there's one level - a cityscape inspired by Jet Set Radio Future and TRON - character models which don't animate, some glove powers which are mostly functional, and the beginnings of an art style. (Actually, who am I kidding. :p)
I do want to keep working on it, obviously at a less frenetic pace (mostly dictated by uni, which I have been neglecting a bit...). Things to get to:
* Animate the player character. Would be nice.
* Make the gameplay non-violent. At the moment, there's a laser gun and a rocket launcher (and a melee attack) because they're easy fallbacks. But I really want to move away from standard shooter gameplay (i.e., shoot them with guns) and focus on Smash Brothers-style physical combat.
* Add more billboards! Like, seriously. I didn't have time to do this properly for the competition, but I want them to be do dense you can barely move.
* Possibly add some AI opponents. Since I doubt many people will be hosting servers :p.
zombe on 12/6/2012 at 12:55
* Uh, thread is gone from first page ... fixed :D *
-------------------------------
Anyway, decided it really is time to solve the captureless-lambda-function issue i brought up a while ago as my hope for a MS update/fix just has not yet materialized.
This is the result:
Code:
namespace detailUnwrapper {
// L = lambda, S = signature, R = return type, P* = parameter type
// base type predef
template<typename L, typename S> struct Type;
// specializations (0, 1 and 2 parameter cases)
template<typename L, typename S, typename R> struct Type<L, R (S::*)() const> {
static R call() { L f; return f(); } // use a dummy lambda function object to call the actual function with (capturing lambda functions do not have default constructor - shit hitting the fan case avoided :D)
typedef decltype(&call) Func;
operator Func() const { return &call; } // get the unwrapped function "call" automatically via casting
};
template<typename L, typename S, typename R, typename P1> struct Type<L, R (S::*)(P1) const> {
static R call(P1 p1) { L f; return f(std::forward<P1>(p1)); } // forward parameter
typedef decltype(&call) Func;
operator Func() const { return &call; }
};
template<typename L, typename S, typename R, typename P1, typename P2> struct Type<L, R (S::*)(P1, P2) const> {
static R call(P1 p1, P2 p2) { L f; return f(std::forward<P1>(p1), std::forward<P2>(p2)); }
typedef decltype(&call) Func;
operator Func() const { return &call; }
};
}
template<typename L> struct Unwrapper : detailUnwrapper::Type<L, decltype(&L::operator())> {};
template<typename L> Unwrapper<L> Unwrap(const L&) { return Unwrapper<L>(); }
// Examples:
//int32u var;
//bool (*bar0)() = Unwrap( []()->bool { return true; } ); // works :D - templated return type
//void (*foo0)() = Unwrap( []() {} ); // works :D - simplest possible case
//void (*foo1)(int32u) = Unwrap( [](int32u) {} ); // works :D - extra parameters
//auto = Unwrap( [](int32u,int32u) {} ); // works :D - no type ambiguity
//auto foo3 = Unwrap( [=]() { GLOGD(L"%d", var); } ); // fails :D - no default constructor compile time error
Gathered the idea from browsing around, but implemented myself step-by-step to ensure i actually understand it (c++11 is fairly new to me). Fairly easy to remove it all when VC starts to support implicit conversion for captureless lambda functions. As far as i can see - it is pretty bullet proof. Still, there might be something i missed - so, criticism welcome.
Currently up to 2 parameters for the lambda function - trivial to add more when the need arises (i just happen to need 2).
From ASM side - compiler optimizes all that away (pointer directly to the function body with no extra code anywhere).
Albert on 13/6/2012 at 20:46
icemann: Cool game, man. You've improved a clunky old NES game by a good 100% :thumb:
Eldron: Do you have a demo yet for your rogue-ish game (The first one you posted)? Looks cool.
Yakoob on 25/6/2012 at 21:04
Eldron, are you making your own art as well or is this a team-project?
demagogue on 25/6/2012 at 21:10
This is Eldron of Eldpack fame we're talking about. My bet is he does his own art.