Sunday, July 5, 2015

SDL 2 (and extensions) on XCode 6 Tutorial

Hey all,

So I ran into an issue recently involving using SDL on Mac OSX and XCode, and would like to provide a tutorial showing my findings.

A Summary:

 XCode is not the best IDE in terms of telling you exactly what's going on. Apple forces you to create an app using their frameworks that aren't exactly practical in terms of multi-platform game creation, circumventing this is a real pain and causes a lot of headache.

I'm going to assume that you have some familiarity with XCode, I may skip over some details I consider trivial, like: "how to navigate a project". There are enough tutorials as it is on that subject matter.

Long story short, finding out all of this on my own:

IT SUCKED.

With that out of the way, let's dig in.

Getting Started:

1. Download XCode from the Mac App Store, it's not difficult, I'll wait here.
2. Install said XCode (lol this doesn't need to be said.)
3. In XCode, Go to File -> New -> Project, Application -> New Cocoa Application


4. Enter a name for your project, and create it! Yay! Step one!
5. See the files highlighted in the picture below? See them? Yeah? Delete them, XCode generates those and we don't need them. If you want test cases go ahead, but I'm not keeping them.

Delete these files.

Handling SDL:

1. Download SDL 2 here: SDL 2
2. Download any SDL 2 extensions that you plan to use.
Examples include: SDL_image, SDL_mixer, SDL_ttf
3. Drag and drop the .framework files from each of these downloads to /Library/Frameworks, congratulations, you just installed SDL 2!

This is what my /Library/Frameworks directory looks like.

XCode and SDL 2:

Now that you have XCode, SDL 2, and your project started, we can now configure the project itself! THE FUN PART! (For many definitions of fun.)

1. In XCode, click on your project file, navigate to "Build Phases", and add your SDL 2 libraries as such:

 You want to copy the SDL 2 libraries with your executable, else you user will need to have SDL 2 installed on their local machine, not ideal.
2. Next, go to "Build Settings" and set up you "Search Path" parameters as such:


3. Set LLVM as such: (Also in build settings)
Note the part about Prefix Headers, we're not using one.


4. Next, we need to kill the test build step, because who needs that?

Click that area, select the Test build phase and delete it!

5. Set "Enable Modules (C and Objective-C)" to No.
6. Boom! Done! That wasn't so bad right?

The Stupid Part

So, there's an interesting bug in XCode, where if you try to link a library with unsigned code, XCode will crash. Hard crash. As in, the app forcefully closes. It sucks, really bad. Unfortunately, SDL 2 and its extensions are all unsigned! So I will help you fix that.

The issue is referenced here: XCode crash

1. Open a Terminal and navigate to /Library/Frameworks (that's the 'cd' command for those who don't use the Terminal.)

Yes, my Terminal is black and blue like that.


2. Code Sign all of your SDL 2 frameworks (You may need to have XCode tools installed, there are tutorials on that as well.)


3. The command that you are looking for looks as such:

Modify as needed for other frameworks

Clapping Time!

Congratulations! You now have a project ready to write SDL related code in! You can reference SDL just like this:


Give yourself a pat on the back,  you just saved yourself a crap ton of time! If you have any questions let me know in the comments, and I'll adjust the tutorial accordingly! This is my first time writing a publicly accessible tutorial about project set up.

If you want to actually draws things, there are MANY tutorials on that subject matter, and would be another tutorial in its own right, for now, I'm gonna leave it to the setting up part.

Anyway, I hope I helped you out somehow, and thanks for reading!
Jimmy

Saturday, July 4, 2015

That moment when you realize...

Hey all,

Today I was brushing up on my pixel art techniques when I took a step back and realized something:

I made 192 tiles.

Check it out:

I told you once, I've told you a thousand times. No stealing.

These tiles were all drawn by me, if any of you have questions on how to get started doing pixel art, ask me. I'm still learning and by absolutely no means an expert, but I'd say after 192 doodles I may have a bearing on something.

As for how that new level is doing, check it:
Not even the full thing! NO STEALING.

But yeah, just a quick update.
Happy 4th of July!

Jimmy

Tuesday, June 30, 2015

So Jimmy, How'd You Do in Florida?

Hey all,

As an update for the tournament results, here's what happened:

I won my first two matches very easily, I got to practice my Chun Li lightning loops! For the uninitiated, "lightning loops" refers to a (rather difficult) technique where Chun Li can do massive damage and look stylish. It requires me to "slide" my finger down the buttons (that is easy to mess up) within a fraction of a second, followed by a brief pause, and then a tight 1/60th of a second link into the next move.

My next match was much harder, against a player named 801Strider from Utah. I got destroyed, I lost 4 rounds in a row. I did my best to keep the rounds close, and I succeeded, but his experience clearly was above and beyond what I could handle. The match was streamed here: Capcom Fighters on Twitch. I was overall happy with my performance despite losing, I gave him some difficulty. Also, 801Strider ended up getting 2nd place...

The match after that was against a player named AceUnlimited. I lost a close set... I really shouldn't have lost, I just panicked for no reason. I won't provide any excuses but... I'm not losing to him again, I'm better than that.

Overall I ended up 2-2, in losers semis. Not bad, but I could have done better.

Evo is next, and you can bet that I'll be practicing hard to climb out of pools and show the world what I've got!

Thanks,
Jimmy

Friday, June 26, 2015

While in Florida

Hey all,

So, on the plane to CEO 2015 (https://ceogaming.org/), I managed to get some reading done from this book: Shigeru Miyamoto book, and felt REALLY inspired. I felt so inspired that I redesigned the first level of Chang-e, it's based on my hometown and I plan to put in many interactables to give the universe a very "alive" feeling.

I want the player to feel like the world of Chang-e is one that is worth revisiting, sparks curiosity, rewards exploration, and has interesting people.

The "final" outlook came out like so:


(A friendly reminder to not steal! Please don't steal my content, I work very hard on it.)


P.S. If you want to know how I'm doing at the tournament, my pool starts at 2pm on Saturday, June 27th. I'm in pool 10, tag: JimLi. I was doing well in casual Street Fighter 4 matches, made one guy very angry. Wish me luck!

Wednesday, June 24, 2015

Off to Florida!

Hey all,

A quick update, I'm flying to Florida for a fighting game tournament, called CEO 2015. It's going to be a lot of fun!

I'm bring this baby with me: (Apologies for the rotation, I'm on the bus.)

Tuesday, June 16, 2015

MUSIC! PRODUCTION! MAKING THINGS!

Hey all,

So, I've reached the point in the process where the engine is pretty much done, the game code too. All that's left for me to do is make the freaking game, and I can't art, so that's been a rough process.

...BUT

I have been writing music, because I can do that!
Fun fact: I was classically trained during my time learning piano, so most of the stuff I write are lonely piano ballads.
I'll attach the link to my SoundCloud again, check out the two new tracks I uploaded for Chang-e:
DON'T STEAL, KIDS

Anyway, I got sidetracked. Basically I have to now work on the game, exclusively. No more engine work, or not much (cross compatibility restoration, it was working at one point, then I upgraded SDL and well, I'm here.) The last thing I really did for the engine was an optimization that allows for super huge maps, we're talking double the size of what I was working with before, it's amazing. Not to toot my own horn TOO much.

I've been working on the opening sequence to the game, and I think it will really introduce players to the concepts I want them to feel. I have to admit though, getting the tone right is difficult. That's the nature of working with an art form though, right?

From here on will mostly be art and music, screenshots etc. If anyone wants me to do a code article I'd be more than happy to, I love to share my experience with others, and perhaps you can teach me something as well!

I know these thoughts are a bit scattered, but I've been running on 3 hours of sleep, work has been stressful too. I'm surviving, but being the only engineer on a team really gets to you.

P.S. I have a YouTube channel that I'm running with a friend of mine, if you could check us out and maybe let us know how we're doing with this "Let's Plays" thing? I'd appreciate it. Shameless plug, I know. Forgive me.

P.S.S You get to hear my terrible voice!

Feasible Gamers

Thanks for reading!
Jimmy

Thursday, May 28, 2015

Moving Along

Hey all,

I've been really busy with work lately, someone left the team and now I'm the only engineer so... That's been a trip.

Anyway I finished writing a song (at least it's done for now.) and would love to share it with you all, and by share I mean that you can listen and you can't use it in any of your works!

Don't steal kids.

Also, Chang-e is moving along smoothly, I plan to take the weekend and design out the battle system properly, so that making battles from here on out is super easy. Wish me luck.

https://soundcloud.com/jimbobkr/mysterious/s-FYbx6

Jimmy