Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » SpeedHack 2011 is coming soon

This thread is locked; no one can reply to it. rss feed Print
SpeedHack 2011 is coming soon
Michael Jensen
Member #2,870
October 2002
avatar

bamccaig said:

I think text mode is platform specific

That's the point.

Quote:

In theory, if you use binary mode and always use UNIX line endings then it shouldn't ever matter.

In theory, if you open text files in text mode it shouldn't ever matter. >.>

It should work. Maybe you are triggering a bug with the contents of the post.

Weird, I tried changing "penis" to "p3n1s" but still won't post. Just get a completely blank page... I think the speedhack website has turned into an evil dictator that refuses to let me criticize it... Oh well.

{"name":"604502","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/9\/19bcff1a59dd9c471d3af2e4f98a2a92.png","w":269,"h":445,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/9\/19bcff1a59dd9c471d3af2e4f98a2a92"}604502

23yrold3yrold
Member #1,134
March 2001
avatar

Would be epic if we could get Bob, 23, and X-G in on this. The world may end next year, after all. ;)

Heh; I've only entered one of these ever IIRC. The old six-hour Blitzhack.

I'm tempted to think about it. I actually don't know what kind of time I'll have this weekend. :-[

REVISION: Scratch that; didn't realize it already began.

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

Michael Jensen
Member #2,870
October 2002
avatar

Heh; I've only entered one of these ever IIRC. The old six-hour Blitzhack.

Weird. I thought sometime before 2004 (my first speedhack) you had done something. There was a speedhack where all the resource files were provided and everyone had to make do... Weird, I can't find that speedhack. Maybe it was something else. xD

23yrold3yrold
Member #1,134
March 2001
avatar

Yeah. That was the Blitzhack. :)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

bamccaig
Member #7,536
July 2006
avatar

In theory, if you open text files in text mode it shouldn't ever matter.

Not if the file was created on a different platform. ::) I think that if you open a Windows-style text file in Linux you will have trailing "\r" characters in your lines, which might be a problem if you don't account for it.

Michael Jensen
Member #2,870
October 2002
avatar

bamccaig said:

characters in your lines, which might be a problem if you don't account for it.

So what you're saying is, the text mode is a lie...?

Anyway, if I had to write one of these by hand (which I wouldn't, because that's just a waste of time) I would just treat \n or \r as new lines and ignore blank lines. Keep it simple stupid. ;-)

@ML: I still can't post blog updates. This one didn't even have any bad words. Just lost 5 minutes of typing. :o

Oh well, about to head home from work, in a few hours I'll be starting in on le hack de speed. ;)

edit:

Yeah. That was the Blitzhack.

Nice. I didn't even know there was a Blitzhack (at least, today I didn't; apparently years ago, I must have, if I downloaded and looked at the entries...) :)

edit: Okay, I guess I'll just tweet with "#speedhack" for my blog for now. Since I can post comments fine, but not new posts. It's super lame. >:(

bamccaig
Member #7,536
July 2006
avatar

So what you're saying is, the text mode is a lie...?

In a matter of speaking, yes. The only difference between text mode and binary mode (AFAIK) is that EOLs are converted to and from the native EOL sequence automagically. In Windows, this means converting 0A to 0D0A and back again. In Linux, it's effectively the same as binary mode, AFAIK, because the native newline is the same as the C newline (0A). Expecting anything more is ridiculous; in fact, even that much is ridiculous. :P If a Linux system encounters 0D0A in a text file there's no real way to know that it isn't supposed to literally be 0D0A. Converting it to just 0A might be wrong. Those aren't the only two EOL "sequences" either. Older Macs used 0D, and I think there might even be a few lesser known systems that use completely different bytes or sequences. You can't possibly expect for every operating system to know about every other operating system's conventions. The only solution is for the application to account for the difference in a special way or to standardize the format so that only one is ever encountered.

Michael Jensen
Member #2,870
October 2002
avatar

Grrraw 20 hours in and I haven't had a chance to write a single line of code yet. I'm so fucked this speed hack. Oh well, at least I got my computer working again. Will try to blog about it in a second. Shit better work or I'm just not even tryin'...
edit: Shit don't work. I get 500 errors in latest Chrome and IE, and just a blank page of emptyness in Firefox. >:(

bamccaig said:

Converting it to just 0A might be wrong.

Doesn't that fly in the face of having modes with well defined behaviors? Why isn't there a mode that does that, and if you don't want that behavior you don't set it? Seems trivially silly to me.

Slartibartfast
Member #8,789
June 2007
avatar

Grrraw 20 hours in and I haven't had a chance to write a single line of code yet. I'm so fucked this speed hack.

52 hours is still a lot of time, and it's not like you were awake the entire 20 hours :o

Meanwhile, my code looks like a steaming pile of shit with little C and C++ shaped corn, but so far it is working and looking fine :)

BAF
Member #2,981
December 2002
avatar

I started coding, but plans came up last night, and today is shot for some other plans. Tonight and Sunday will be a coding blitz, that's for sure.

Michael Jensen
Member #2,870
October 2002
avatar

CROSS-PLATFORM TIP:
I've been out of the C++ scene for awhile now, but it appears that MSVC doesn't have snprintf, instead it has sprintf_s (with about the same signature.) I'm guessing *nix doesn't have sprintf_s though, so try this:

#if _WIN32
  #define snprintf sprintf_s
#endif

52 hours is still a lot of time, and it's not like you were awake the entire 20 hours

Actually more like 28 hours with other weekend plans, but still, this is sweet, I'm glad I'm doing Speedhack again. :)

Thomas Fjellstrom
Member #476
June 2000
avatar

CROSS-PLATFORM TIP:
I've been out of the C++ scene for awhile now, but it appears that MSVC doesn't have snprintf, instead it has sprintf_s (with about the same signature.) I'm guessing *nix doesn't have sprintf_s though, so try this:

I think it has _snprintf.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

weapon_S
Member #7,859
October 2006
avatar

Stupid question here. Do you use fonts? With a small file-size...? Or is there a sane way to obtain the fonts installed on somebody's system?

MiquelFire
Member #3,110
January 2003
avatar

That's one thing lacking from A5, there's no default font you can use without including it.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

Matthew Leverton
Supreme Loser
January 1999
avatar

For SpeedHack, you need to use bitmap fonts.

Fishcake
Member #8,704
June 2007
avatar

My project has files grouped into directories (with .cpp and .h together), but it seems that the provided makefile doesn't detect files inside directories (inside src folder). This is a small issue for now, because I'm using Codeblocks without the makefile for the development, but I really should resolve it ASAP before the deadline. I did some search, and it seems that the way to go is to have a makefile for each folder. That seems a bit troublesome. Is there an easier way out? ???

Matthew Leverton
Supreme Loser
January 1999
avatar

As the readme says:

Quote:

3) Place all of your source code in the src folder as either .c or .cpp files.
Do not use any sub folders in the src folder.

There are a few lines in the Makefile that you could copy and paste for each sub folder to add support.

Or you could dump all your source files into the same main folder.

kenmasters1976
Member #8,794
July 2007

weapon_S said:

Stupid question here. Do you use fonts? With a small file-size...?

I'm using a TTF font. It's barely 20 KB and I'm sure it's smaller when compressed.

By the way, I just realized that it doesn't have some of the glyphs I need so I'll be needing another one.

Michael Jensen
Member #2,870
October 2002
avatar

For SpeedHack, you need to use bitmap fonts.

I'm assuming that's a joke (but I would like to confirm.)

weapon_S said:

Stupid question here. Do you use fonts? With a small file-size...? Or is there a sane way to obtain the fonts installed on somebody's system?

I wish there were, the MAllegro wrapper for .NET that I started writing could export them, but that source is long gone, and it was in VB.NET 2005. :-X

Anyway, most of the .ttf files I've found are ridiculously tiny... The font I'm using is 21K unzipped -- It's from some free-fonts archive (the same site that the allegro 5 tutorial that uses "pirulen.ttf" links to.)

Matthew Leverton
Supreme Loser
January 1999
avatar

For SpeedHack, you need to use bitmap fonts.

I'm assuming that's a joke (but I would like to confirm.)

I just mean that while verdana.ttf is 200KB, if you create a bitmap font with the size you need, it will be very small. Of course if you use a smaller TTF with less characters or whatever, then you'll be okay from a size perspective.

Bruce Perry
Member #270
April 2000

Are we allowed to submit as a 7-Zip archive?

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

MiquelFire
Member #3,110
January 2003
avatar

Nope.

---
Febreze (and other air fresheners actually) is just below perfumes/colognes, and that's just below dead skunks in terms of smells that offend my nose.
MiquelFire.red | +Me
Windows 8 is a toned, stylish, polished professional athlete. But it’s wearing clown makeup, and that creates a serious image problem. ~PCWorld Article

kenmasters1976
Member #8,794
July 2007

Are we allowed to submit as a 7-Zip archive?

The rules state that all entries must be supplied in a ZIP file. 7z might be problematic, particularly for some Linux users, I guess.

Bruce Perry
Member #270
April 2000

I thought Shawn once submitted as a tar.gz ;D

--
Bruce "entheh" Perry [ Web site | DUMB | Set Up Us The Bomb !!! | Balls ]
Programming should be fun. That's why I hate C and C++.
The brxybrytl has you.

LennyLen
Member #5,313
December 2004
avatar

particularly for some Linux users, I guess.

It shouldn't be, since there's a linux version.



Go to: