princec
|
 |
«
Posted
2011-04-20 22:03:44 » |
|
|
|
|
|
krasse
|
 |
«
Reply #1 - Posted
2011-04-20 22:10:40 » |
|
A very good and generous decision. I will enjoy decrypting it and probably learning a lot! 
|
|
|
|
Riven
|
 |
«
Reply #2 - Posted
2011-04-20 22:31:20 » |
|
Not even report bugs? I see two in IntGrid 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #3 - Posted
2011-04-20 22:40:17 » |
|
Arggh! Where? Cas 
|
|
|
|
Riven
|
 |
«
Reply #4 - Posted
2011-04-20 22:42:53 » |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| private int getIndex(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) { return -1; } return x + y * width; }
public int getValue(int x, int y) { if (x < 0) { x = 0; } else if (x >= width) { x = width; } if (y < 0) { y = 0; } else if (y >= height) { y = height; } int idx = getIndex(x, y); if (idx == -1) { return fill; } return value[idx]; } |
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
princec
|
 |
«
Reply #5 - Posted
2011-04-20 22:44:31 » |
|
I just spotted that  It never seems to have had any effect on the game, probably because in this game width/height are never actually exceeded. Cas 
|
|
|
|
Riven
|
 |
«
Reply #6 - Posted
2011-04-20 23:06:04 » |
|
GeomUtil.rectangleContainsCircle( ) is bugged too  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public static boolean rectangleContainsCircle(float x, float y, float radius, float rx, float ry, float width, float height) { float halfSize = radius / 2f;
float boundsXMax = rx + width; float boundsYMax = ry + height;
if (y - halfSize < boundsYMax) { return false; }
if (y + halfSize > ry) { return false; }
return true; } |
FWIW, I actually rendered it for no apparent reason. 
|
Hi, appreciate more people! Σ ♥ = ¾ Learn how to award medals... and work your way up the social rankings!
|
|
|
princec
|
 |
«
Reply #7 - Posted
2011-04-20 23:41:04 » |
|
I can blame Orangytang for that one  Cas 
|
|
|
|
badlogicgames
|
 |
«
Reply #8 - Posted
2011-04-20 23:41:58 » |
|
Neat, thanks a bunch for that. edit: you really like XML. And your DefaultSpriteRenderer is pretty much the same as our SpriteBatch. We'd probably even out in the big sprite shootout. Glad to know we are not that far away from people publishing on Steam 
|
|
|
|
Sinuath
|
 |
«
Reply #9 - Posted
2011-04-21 00:13:09 » |
|
Very cool, thanks for sharing
|
|
|
|
Games published by our own members! Check 'em out!
|
|
princec
|
 |
«
Reply #10 - Posted
2011-04-21 09:02:58 » |
|
Neat, thanks a bunch for that. edit: you really like XML. And your DefaultSpriteRenderer is pretty much the same as our SpriteBatch. We'd probably even out in the big sprite shootout. Glad to know we are not that far away from people publishing on Steam  Haha no I hate XML  Fortunately I don't have to do an awful lot of it - Chaz gets most of the miserable drudgery. I was wondering about switching to some derivative of JSON (with less double quotes) instead as it's much more compact. Cas 
|
|
|
|
gouessej
|
 |
«
Reply #11 - Posted
2011-04-21 13:06:04 » |
|
Lol I like your comments: // For f**k's sake, why doesn't it take the byteorder from the original buffer???
|
|
|
|
princec
|
 |
«
Reply #12 - Posted
2011-04-21 13:17:27 » |
|
That'll be one of the rare, useful, accurate comments  Cas 
|
|
|
|
appel
|
 |
«
Reply #13 - Posted
2011-04-21 13:28:57 » |
|
Nice.
That's a lot of code... probably not how I would organize things. :\ but still useful.
|
|
|
|
Gornova
|
 |
«
Reply #14 - Posted
2011-10-04 13:59:40 » |
|
Someone have a look on this source code? Any good ideas to learn from it? I'm ready to share my thoughts too!
|
|
|
|
gimbal
|
 |
«
Reply #15 - Posted
2011-10-04 16:11:57 » |
|
Just want to note that as an alternative to XML you also have YAML. One of the benefits of XML is that it is pretty human readable, but the major downside is that it is so effing verbose and inefficient. YAML is human readable and adds minimal clutter. For a usage example, see how it is implemented in Play framework for example: http://www.playframework.org/documentation/1.2.3/guide2(search for data.yml)
|
|
|
|
sproingie
|
 |
«
Reply #16 - Posted
2011-10-04 16:20:56 » |
|
Every extant YAML parser I've seen is a bug-ridden ad hoc mess that's slower and eats more memory than any XML parser. Stuff like syck that does aim for performance uses direct memory tricks in high level languages that just screams "exploitable". And when it gets at all complex, it's not even particularly "human readable", or at least all the little quirky bits of syntax you have to dangle off elemen ts aren't obvious in what they do. YAML needs a stake driven through it.
While I'm ranting: whither JSON? It was conceived as a clever hack to allow javascript clients to generate it with toString() and parse it with eval(). Except that's not how any JSON parser works anymore, for very good reason. So why not use real sexps instead? Inertia of course.
|
|
|
|
princec
|
 |
«
Reply #17 - Posted
2011-10-04 18:46:32 » |
|
YAML looks like the Devil's own format. Quite why anyone would condone it is a mystery. XML is another of the Devil's creations though. Something similar to JSON would probably be quite nice. Cas 
|
|
|
|
|
xsvenson
|
 |
«
Reply #19 - Posted
2011-10-05 09:44:05 » |
|
YAML looks like the Devil's own format. Quite why anyone would condone it is a mystery. XML is another of the Devil's creations though. Something similar to JSON would probably be quite nice. Cas  This statement is a bit ironic, considering json is a subset of yaml, which is the Devil's own format  Just saying ...
|
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
princec
|
 |
«
Reply #20 - Posted
2011-10-05 12:29:20 » |
|
YAML looks like the Devil's own format. Quite why anyone would condone it is a mystery. XML is another of the Devil's creations though. Something similar to JSON would probably be quite nice. Cas  This statement is a bit ironic, considering json is a subset of yaml, which is the Devil's own format  Just saying ... JSON without the unnecessary quotes would probably work quite nicely. Cas 
|
|
|
|
ReBirth
|
 |
«
Reply #21 - Posted
2011-10-05 15:48:09 » |
|
Just say thanks! 
|
|
|
|
Eli Delventhal
|
 |
«
Reply #22 - Posted
2011-10-05 22:10:24 » |
|
JSON is like. YAML is pretty good. XML blows hard. I like JSON because it's closest to the data structures I expect to see in memory. There are a lot of parsers that will just turn {} into HashMap and [] into Array. Then it's ultra easy to go through the data in code. I also find it very readable. I agree the quotes that can be annoying, especially because in straight javascript you don't even need them ( {key: "value"} is totally valid). I personally wouldn't make my own version of it though because then you can't use convenient sites like jsonlint.com and the sort.
The code looks nifty enough. I personally have never found much benefit from taking code from other people, but who knows. Maybe if I decide to use a VBO I'll look into your approach.
|
|
|
|
jezek2
|
 |
«
Reply #23 - Posted
2011-10-06 06:47:11 » |
|
I don't find alternatives to XML readable. Previously I didn't like XML, but realized it was mostly because of bad schema that isn't human friendly. If someone take care to make it nice (eg. more usage of attributes, no DTD/CDATA and other mess, etc) then it's quite nice actually. The verbosity and syntax also make more obvious what is data and what is the rest.
|
|
|
|
princec
|
 |
«
Reply #24 - Posted
2011-10-06 09:12:46 » |
|
Hm it's subtle but I find this more readable and certainly a bit easier to type and probably parse too than the XML alternative: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <animation name="crab2.animation">
<label id="start"/>
<frame i="spriteimage.crab2_01" d="1"/> <frame i="spriteimage.crab2_02" d="1"/> <frame i="spriteimage.crab2_03" d="1"/> <frame i="spriteimage.crab2_04" d="1"/>
<random> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>start</dest> <dest>pinch</dest> </random>
<label id="pinch"/>
<frame i="spriteimage.crab2_05" d="1"/> <frame i="spriteimage.crab2_06" d="1"/> <frame i="spriteimage.crab2_07" d="1"/> <frame i="spriteimage.crab2_08" d="1"/>
<frame i="spriteimage.crab2_05" d="1"/> <frame i="spriteimage.crab2_06" d="1"/> <frame i="spriteimage.crab2_07" d="1"/> <frame i="spriteimage.crab2_08" d="1"/>
<frame i="spriteimage.crab2_05" d="1"/> <frame i="spriteimage.crab2_06" d="1"/> <frame i="spriteimage.crab2_07" d="1"/> <frame i="spriteimage.crab2_08" d="1"/>
<goto id="start"/>
</animation> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| animation { name: crab2.animation label { id: start} frame { i: spriteimage.crab2_01 d: 1 } frame { i: spriteimage.crab2_02 d: 1 } frame { i: spriteimage.crab2_03 d: 1 } frame { i: spriteimage.crab2_04 d: 1 } random { dest "start" dest "start" dest "start" dest "start" dest "start" dest "start" dest "start" dest "start" dest "pinch" } label { id: pinch } frame { i: spriteimage.crab2_05 d:1 } frame { i: spriteimage.crab2_06 d:1 } frame { i: spriteimage.crab2_07 d:1 } frame { i: spriteimage.crab2_08 d:1 }
frame { i: spriteimage.crab2_05 d:1 } frame { i: spriteimage.crab2_06 d:1 } frame { i: spriteimage.crab2_07 d:1 } frame { i: spriteimage.crab2_08 d:1 }
frame { i: spriteimage.crab2_05 d:1 } frame { i: spriteimage.crab2_06 d:1 } frame { i: spriteimage.crab2_07 d:1 } frame { i: spriteimage.crab2_08 d:1 }
goto { id: start } } |
Cas 
|
|
|
|
nsigma
|
 |
«
Reply #25 - Posted
2011-10-06 09:24:11 » |
|
JSON without the unnecessary quotes would probably work quite nicely. Cas  Quite agree! The patch script syntax I developed for Praxis is influenced partly by JSON, but more as if it had been called TON - (ie. TCL Object Notation). The structured string approach of a typical TCL parser means no colons, and no quotes unless the key or value has whitespace. I find this simple, quick and intuitive to work with by hand - unlike XML! Obviously, what I have is useless outside Praxis as is, but the general principle is pretty simple.
|
Praxis LIVE - hybrid visual IDE for (live) creative coding
|
|
|
Chromanoid
|
 |
«
Reply #26 - Posted
2011-10-06 10:00:32 » |
|
I always wonder if a LISP like notation would be nice for games. One could easily combine data with some light logic and one could even precompile data for faster loading. I never used Clojure, I wonder how big its jar is. (edit: the slim version is 840kb)
|
|
|
|
kilvati
Senior Newbie 
|
 |
«
Reply #27 - Posted
2011-10-06 10:09:37 » |
|
Json could also be simplefied to: 1 2 3 4 5 6 7 8 9 10 11
| animation { name: crab2.animation, parts: [ {name: "start", d:1, base: "spriteimage.crab2_", frames: ["01","02","03","04"]}, {name: "pinch", d:1, base: "spriteimage.crab2_", frames: ["05","06","07","08","05","06","07","08","05","06","07","08"]} ], loop: [ {item: "start", chance:"100%"}, {item: "pinch", chance:"15%"} ] } |
|
Give a man a fire and he is warm for a day, set a man on fire and he is warm for the rest of his live.
|
|
|
princec
|
 |
«
Reply #28 - Posted
2011-10-06 10:59:40 » |
|
That wouldn't map very well to my internal structures though  Cas 
|
|
|
|
sproingie
|
 |
«
Reply #29 - Posted
2011-10-06 16:08:17 » |
|
Here's why XML > sexps (sometimes): There's a syntax error in the code below. Tell me which construct got too many close parens: 1
| ((foo bar (blah (foo (abc def) blah (foo (xyzzy abcd))))))) |
Okay, it's contrived. But the fact is, no matter how meaningful the data, the parser has to get all the way to the end to report that there's a balancing error, and it still can't tell you where it is
|
|
|
|
|