im really liking this
[video]https://youtu.be/pXRCB-6Woeg[/video]
[QUOTE=Map in a box;49864603]a thing[/QUOTE]
I hate it when those happen
[QUOTE=war_man333;49866472]Did some information retrieval today. This baby searches through RSS feeds.
[code]
public List<String> search(List<String> inTitle, List<String> notInTitle, List<String> inDescription, List<String> notInDescription, String startDate, String endDate) throws IOException, ParseException
{
printQuery(inTitle, notInTitle, inDescription, notInDescription, startDate, endDate);
List<String> results = new LinkedList<String>();
DirectoryReader ireader = DirectoryReader.open(directory);
IndexSearcher isearcher = new IndexSearcher(ireader);
BooleanQuery.Builder bqb = new BooleanQuery.Builder();
if(inTitle != null)
for(String t : inTitle)
bqb.add(new TermQuery(new Term("title", t)), Occur.MUST);
if(notInTitle != null)
for(String t : notInTitle)
bqb.add(new TermQuery(new Term("title", t)), Occur.MUST_NOT);
if(inDescription != null)
for(String t : inDescription)
bqb.add(new TermQuery(new Term("description", t)), Occur.MUST);
if(notInDescription != null)
for(String t : notInDescription)
bqb.add(new TermQuery(new Term("description", t)), Occur.MUST_NOT);
if(startDate != null && endDate != null)
bqb.add(new TermRangeQuery("date", new BytesRef(startDate), new BytesRef(endDate), true, true), Occur.SHOULD);
else if(startDate != null)
bqb.add(new TermRangeQuery("date", new BytesRef(startDate), null, true, false), Occur.SHOULD);
else if(endDate != null)
bqb.add(new TermRangeQuery("date", null, new BytesRef(endDate), false, true), Occur.SHOULD);
BooleanQuery expected = bqb.build();
//System.out.println(expected.toString());
ScoreDoc[] hits = isearcher.search(expected, 1000).scoreDocs;
for (ScoreDoc scoreDoc : hits)
{
String title = isearcher.doc(scoreDoc.doc).getField("title").stringValue();
results.add(title);
}
ireader.close();
return results;
}
[/code]
It's using something called Lucene.[/QUOTE]
Isn't Lucene search engine?
[QUOTE=Arxae;49864984]I'm in conflict. Help me out here :P
If you are playing a ascii roguelike, and here and there there are "real" images used. Would it be a bother? On one side, it allows for a lot more details. But on the other hand, it's a bit of a style break.
For my player creation, i tried to make it look like an id card. so i added a signature using a image. Tried to make it look a bit pixelated so it "blends in" a bit more.
[img]http://i.imgur.com/AM0w0Kr.png[/img]
So, agree for something if it doesn't bother you. Disagree if it's something that would bother you.[/QUOTE]
Use heavy dithering for photographs.
[QUOTE=Niteshifter;49863495]What he means with the memory "moving about" is that different compilers will do different things with the stack when generating code (different optimizations or compiler flags will move things around), so we don't actually know exactly which address we will be located at (this is why we have the nop sled and the padding of the return addresses). We are able to do a few things though given some assumptions based on how the stack segment works.
A cool thing with the return address and its position on the stack is it's aligned by DWords (4-bytes), so as long as we start writing the return address padding at the start of the alignment, we just need to worry about actually hitting the return address when we write it (which is why we write it several times so we know it's going to hit).
If you're interested in this kind of thing, I'd recommend this book. It goes over this kind of thing as well as some more technical reasons on why it works. It also shows methods on how you can get the exact address instead of padding things out and hoping for the best. [url]http://www.amazon.ca/Hacking-The-Art-Exploitation-Edition/dp/1593271441[/url][/QUOTE]
Thanks for the explanation and the recommendation.
I understand the nop sled, I think that's pretty neat. I'm still struggling to understand the return address, however. You mentioned it was aligned to 4 bytes - how does this work?
Presumably, when a function is called and the parameters and the return address are pushed on to the stack, it could be at any point in memory, right?
So we could have a case like this:
[10 -> 510 (buffer)] [511 -> 514 (return address)] [515 (parameter)]
In this case, the return address starts at 511. If we happen to have written our 500 bytes to fill the buffer and we end up at address 510, and then we come to write the return address, we'll match up perfectly.
However, if the stack is shifted by 1 byte, say, and the buffer now goes from 9 -> 509, when we come to write our address we'll be writing from 510-513, and we wont properly overwrite the return address. How do we make sure we line up correctly?
[QUOTE=Trumple;49868581]Thanks for the explanation and the recommendation.
I understand the nop sled, I think that's pretty neat. I'm still struggling to understand the return address, however. You mentioned it was aligned to 4 bytes - how does this work?
Presumably, when a function is called and the parameters and the return address are pushed on to the stack, it could be at any point in memory, right?
So we could have a case like this:
[10 -> 510 (buffer)] [511 -> 514 (return address)] [515 (parameter)]
In this case, the return address starts at 511. If we happen to have written our 500 bytes to fill the buffer and we end up at address 510, and then we come to write the return address, we'll match up perfectly.
However, if the stack is shifted by 1 byte, say, and the buffer now goes from 9 -> 509, when we come to write our address we'll be writing from 510-513, and we wont properly overwrite the return address. How do we make sure we line up correctly?[/QUOTE]
If i understand correctly [I might have this wrong], the return address *can't* start on address 511 as its not divisible by 4
So it'd look more like
10 -> 510 buffer, 511 -> 511 padding, 512 -> 515 return address, 516+ etc
Because of this you can just smack down the return address on 4-byte aligned addresses, and you're guaranteed to hit
Hey, currently working on some 3D Graphics coursework.
Would love some feedback on this scene.
[t]http://richardbamford.io/dmp/Labs.vshost_2016-03-04_23-48-21.png[/t]
[vid]http://richardbamford.io/dmp/2016-03-04_23-48-54.webm[/vid]
Eventually there will be balls which spawn at the top, fall, collide with the objects shown and then teleport through the portals back to the top.
So the networking for my swordfighting up until now has been fairly straightforward clientside hit detection. Blocking networks the current blocking state, and the attacker checks if the player hit is in the blocking state (within certain angle bounds, taking into account sword delta position, and defending player angle, for directional blocking).
This works fine with low ping. In fact, it works adequately well
Some testing from eu -> na reveals that this is obviously not as great as I really want. The primary problem is that you have to block early to avoid getting hit on the attacker's game
There are two solutions to this:
1. The most traditional would be to simulate all clients forward in the future by their ping. This means that the defending player is seeing the same thing as what the attacking player is seeing
2. Implement clientside parrying. This means that the defender's game is taken as being correct for the purpose of parrying
After spending a while thinking about it, I've realised that no 1 doesn't actually fix the problem. With a real time melee combat system (sword swing drags), it is actually impossible to predict where the player is going to be x ms from now, because they can drag their sword around, jump, etc. I'd have to impose draconian requirements on the combat system for it to work. This means there'd be lots of little inconsistencies in how the combat played out as the attacker manipulates their sword, and the ping difference is too high for the defender to respond in time. In a game where accurate parrying is exactly the skill game, having shit parries is the opposite of what i want
So now I've implemented clientside parrying. So, now when the attacker thinks they've hit the defending player, the application of the damage (on the defending player's client) is delayed by x ms. If after the delay, the defending player has successfully performed a parry during the delay window, the damage is cancelled.
Additionally, after a clientside parry is performed, that player is immune to damage from the defended-against player for 500ms (a smaller window than the recoil time), to prevent late hits from registering
This should drastically reduce how finickity blocking is in high ping situations, and allow for skill based gameplay even if the internet connection is terrible. I'm still going to perform the simulation fast foward which should also drastically reduce the discrepancy between what each client is seeing, with the benefit that it no longer matters if its exactly correct, just that it is *more* correct. Once both are in place, the game should be really super playable even over relatively high ping
[QUOTE=Fourier;49867486]Isn't Lucene search engine?[/QUOTE]
Yeah it's like a halfway fleshed out API so you have to do some work yourself. Once you read the documentation, it's pretty easy.
Trying to do Gaussian blur with OpenCL for my project but like always Visual Studio fights me every time when it comes to including new shit into my project. All guides show how easy it is but when I do it the same way, nope. Not that I can find good OpenCL tutorials anyway. Does anyone know any?
[QUOTE=adnzzzzZ;49871342]-video-[/QUOTE]
The four examples in that video were garbage and the people writing them clearly didn't know what they were doing. There are very good reasons to use OOP.
[QUOTE=adnzzzzZ;49871342][video=youtube;IRTfhkiAqPw]http://www.youtube.com/watch?v=IRTfhkiAqPw[/video][/QUOTE]
Only watched the first three examples, but for the first two he's just picked bad examples of OOP that I agree should have been static, and the third one only makes sense to replace with a switch because each class only has one method with different behavior for each subclass. If it had multiple methods with different behavior, you would need to switch again in each one. That would mean pointless duplication of case names, adding new cases would be a chore, and your implementation couldn't be extended with new cases when your code is used as a library.
The best argument for why this approach isn't a good idea is to look at the source code for Terraria's entity class.
[editline]5th March 2016[/editline]
OOP is a great fit for game programming when the purpose of your program is to model objects interacting with each other. It's not a good fit when you are forcing something that isn't obviously an object to be an object.
[QUOTE=Lumaio;49871411]The four examples in that video were garbage and the people writing them clearly didn't know what they were doing. There are very good reasons to use OOP.[/QUOTE]
I'd say they knew what they were doing, but they were examples so it's better to keep them short.
There's almost no reason to make a player class that only holds a name, but when you also need position, score and health fields it makes a lot more sense
[editline]5th March 2016[/editline]
[QUOTE=Ziks;49871419]
The best argument for why this approach isn't a good idea is to look at the source code for Terraria's entity class.[/QUOTE]
For those not familiar, shield your virgin eyes and have a look at [url=https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs]this[/url]
[QUOTE=Goz3rr;49871444]
For those not familiar, shield your virgin eyes and have a look at [url=https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs]this[/url][/QUOTE]
Is that C++ or C#
or Java
Because I'm looking for a new widely used language that is easy to learn
[QUOTE=hakimhakim;49871476]Is that C++ or C#
or Java
Because I'm looking for a new widely used language that is easy to learn[/QUOTE]
C#
[QUOTE=Goz3rr;49871444]For those not familiar, shield your virgin eyes and have a look at [url=https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs]this[/url][/QUOTE]
And if that didn't make you go insane, try this: [url]https://raw.githubusercontent.com/TheVamp/Terraria-Source-Code/master/Terraria/NPC.cs[/url]
- snip, missed the point -
[QUOTE=cartman300;49871492]- snip, missed the point -[/QUOTE]
Does the obfuscator merge classes together?
[QUOTE=cartman300;49871492]Also do note this is decompiled obfuscated code, and honestly, it's a crap example.[/QUOTE]
Decompiling .NET code pretty much produces a 1:1 copy of the original though, in this case obfuscating only changes variable names. It certainly doesn't produce code like this, unless they have some sort of T4 Template generating this code, which arguably is even worse
[QUOTE=Ziks;49871499]Does the obfuscator merge classes together?[/QUOTE]
[QUOTE=Goz3rr;49871500]Decompiling .NET code pretty much produces a 1:1 copy of the original though, in this case obfuscating only changes variable names. It certainly doesn't produce code like this, unless they have some sort of T4 Template generating this code, which arguably is even worse[/QUOTE]
Depends on the obfuscator. Some of them generate pointless branches besides renaming variables.
It's worth looking at features list of a few of them.
[url]http://www.gapotchenko.com/eazfuscator.net/features[/url]
[editline]5th March 2016[/editline]
I'm ~not quite sure about this~ but i'm not even sure you can run ildasm on terraria's executable.
[QUOTE=cartman300;49871536]
I'm ~not quite sure about this~ but i'm not even sure you can run ildasm on terraria's executable.[/QUOTE]
I very much doubt any sort of obfuscation was done, because ILSpy can open it without issues and the variable names aren't even changed:
[t]http://i.imgur.com/Pksx8b5.png[/t]
Set up that FTP server to my projects folder, browse away @ 93.138.51.117 port 21
[QUOTE=Ziks;49871489]And if that didn't make you go insane, try this: [url]https://raw.githubusercontent.com/TheVamp/Terraria-Source-Code/master/Terraria/NPC.cs[/url][/QUOTE]
To be fair, it's [I]possible[/I] part of those are the results of a class-folding obfuscation scheme (though that wouldn't necessarily the best of ideas in terms of performance and/or memory use, I suspect).
Undertale on the other hand [URL="https://twitter.com/tobyfox/status/686941566586499072"]has been confirmed for having a gigantic switch statement by the dev himself[/URL].
Which I guess goes to show that you really don't [I]need[/I] any kind of OOP to create something outright amazing (but it certainly helps [I]a lot[/I] if you can concisely group an entity's behaviour together in a file and get compiler errors if you forget something).
Then again it's (iirc) Game Maker, so for all I know he actually made a pretty clean project with everything configured via the GUI and that's just the localisation/dialogue file. ([editline]edit[/editline] [URL="https://www.reddit.com/r/Undertale/comments/40n1l9/you_cannot_grasp_the_true_form_of_undertales_code/cyw2u0e"]It has about 500 cases in total and is indeed dialogue code.[/URL])
[editline]5th March 2016[/editline]
[QUOTE=helifreak;49871609][code]if ((float)(num639 * 16) < vector75.X + (float)this.width && (float)(num639 * 16 + 16) > vector75.X && ((Main.tile[num639, num640].nactive() && Main.tile[num639, num640].slope() == 0 && Main.tile[num639, num640 - 1].slope() == 0 && ((Main.tileSolid[(int)Main.tile[num639, num640].type] && !Main.tileSolidTop[(int)Main.tile[num639, num640].type]) || (flag45 && Main.tileSolidTop[(int)Main.tile[num639, num640].type] && (!Main.tileSolid[(int)Main.tile[num639, num640 - 1].type] || !Main.tile[num639, num640 - 1].nactive()) && Main.tile[num639, num640].type != 16 && Main.tile[num639, num640].type != 18 && Main.tile[num639, num640].type != 134))) || (Main.tile[num639, num640 - 1].halfBrick() && Main.tile[num639, num640 - 1].nactive())) && (!Main.tile[num639, num640 - 1].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 1].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 1].type] || (Main.tile[num639, num640 - 1].halfBrick() && (!Main.tile[num639, num640 - 4].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 4].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 4].type]))) && (!Main.tile[num639, num640 - 2].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 2].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 2].type]) && (!Main.tile[num639, num640 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num639, num640 - 3].type] || Main.tileSolidTop[(int)Main.tile[num639, num640 - 3].type]) && (!Main.tile[num639 - num638, num640 - 3].nactive() || !Main.tileSolid[(int)Main.tile[num639 - num638, num640 - 3].type] || Main.tileSolidTop[(int)Main.tile[num639 - num638, num640 - 3].type]))[/code]
What the fuck :vomit:[/QUOTE]
I'm fairly certain that at least in that case various local variables were folded into that statement.
Remember that it's decompiled from a release mode assembly, so all locals used only once are likely to disappear if the stack isn't reordered (and in some cases even then).
[QUOTE=Goz3rr;49871444]For those not familiar, shield your virgin eyes and have a look at [url=https://github.com/TheVamp/Terraria-Source-Code/blob/master/Terraria/Item.cs]this[/url][/QUOTE]
[QUOTE=Ziks;49871489]And if that didn't make you go insane, try this: [url]https://raw.githubusercontent.com/TheVamp/Terraria-Source-Code/master/Terraria/NPC.cs[/url][/QUOTE]
This legitimately made me feel great about my C# programming.
I mean, that item class they've got going on..
It makes mine look god-like.
[QUOTE=cartman300;49871621]Set up that FTP server to my projects folder, browse away @ 93.138.51.117 port 21[/QUOTE]
Thank you a lot for doing this, I like reading other people's code because it usually gives me a lot of ideas and lets me learn patterns I don't know about yet. As long as I don't have to work with it directly that is :v:
[QUOTE=cartman300;49871621]Set up that FTP server to my projects folder, browse away @ 93.138.51.117 port 21[/QUOTE]
Can anyone else not connect? FileZilla just gives me 'cannot connect to server'
[QUOTE=sarge997;49872016]This legitimately made me feel great about my C# programming.
I mean, that item class they've got going on..
It makes mine look god-like.[/QUOTE]
I could swear I saw video of Binding of Isaac developers coding flash version using basically same approach with huge ifs, nondescript ID numbers, one-file-to-rule-them-all style, but I can't find the video for the life of me.
What worries me more is that both of these projects basically 'made it' to successive indie titles.
It implies that there may be a correlation between bad coding practices and success, via speed of development.
I.e. it's rather obvious that bad but hastily written code generally gets you farther in real world than beatiful code you spent several years polishing, but god damn, this code emanates extreme levels of "I want to be done and over with this shit, screw code architecture, screw guidelines, screw OOP, SCREW EVERYONE".
Terraria is an ideal candidate for data oriented programming. Program AI/Weapon/Item types, and then everything else can just be data, rather then inheriting a class for every npc, object or enemy.
Sorry, you need to Log In to post a reply to this thread.