Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / [NaGaCreMo'15] Lightship in C!

Author
Message
TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Jan 2015 18:12 Edited at: 2nd Jan 2015 18:13


It's that time of the year again, National Game Creation Month! If you haven't already, sign up for it in this thread.

For this month, I'll be focusing my attention on the same game I was working on for last year's NaGaCreMo, the difference being this time around the game is implemented entirely in C. That's right, no C++, no Basic... C.

To see screenshots and read info on what this game is even about, head on over to my project's page on github. You can also download the code and compile it yourself, if you feel like it. Instructions are on the main page. There are no dependencies other than OpenGL so it should be quite easy to do. If you require help, ask me in this thread.

Goals

My goal is to get the game into Alpha stage. This means:
* A working menu
* Ability to connect over the internet
* A lobby where people can chat with each other
* A very basic map loader

Current State

Here's what it currently looks like. You can see I can draw a menu button without text (my windows don't have borders, don't be confused):



There's not much visual stuff going on, but here's what's happening in the background:
* Plugins! The game has the ability to load/unload plugins during runtime, allowing for high modability of the game.
* OpenGL 3.3! Modern GL code is being used to create the window and render stuff.
* Memory reports! There's a useful built-in memory tracker, able to print stack traces when memory leaks occur.

There's a whole lot of other stuff like vectors/lists/ptrees/YAML parsers, which is why it took a while to get it where it is now.

I like offending people. People who get offended should be offended. -- Linus Torvalds
Yodaman Jer
User Banned
Posted: 2nd Jan 2015 18:25
Looks great so far, Comet! What IDE is that?

You're now making me wish I could program in C

I will post a link of your WIP thread over in the main thread.


It's back, baby!
TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 2nd Jan 2015 19:01
Thanks!

The IDE is KDevelop, running on Gentoo Linux with awesome-wm.

I like offending people. People who get offended should be offended. -- Linus Torvalds
TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 3rd Jan 2015 23:21 Edited at: 3rd Jan 2015 23:23
Did no work on code today, more on the build system. A remote server automatically downloads the latest code from github whenever I push changes. It then cross compiles the code for multiple target systems (in this case win64 and linux64), packages everything, and uploads them to a distribution server which can be found here:

http://game.pixelcloud.ch/lightship/

This means you can always download the latest compiled version of lightship from that URL. If someone running windows could download the latest version and verify that it works, I'd greatly appreciate it.

Now, time to work on rendering text using OpenGL.

I like offending people. People who get offended should be offended. -- Linus Torvalds
swissolo
12
Years of Service
User Offline
Joined: 9th Jan 2010
Location:
Posted: 4th Jan 2015 23:53
I remember this Sadly this thread will probably have to move since it isn't built on TGC software Perhaps to the NaGaCreMo board

Chris Tate
DBPro Master
14
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 7th Jan 2015 18:19
I remember this . Good luck with it.

TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 7th Jan 2015 18:33 Edited at: 7th Jan 2015 18:38
Thank you!

Yes, if a moderator finds this thread to be off-topic then please do move it to the NaGaCreMo forum section. I didn't know that existed until after I created this thread. Of course, I'd be more than happy if it were allowed on the WIP board, as I do plan on working on this project for an extended amount of time.


Updates

I've been bashing my head over OpenGL for the past days and I've finally figured things out. This might not look like much but trust me when I say not even Confucius would have the ability to give advice on what was wrong. I had some weird problem where only the last object I created was drawn. OpenGL was all "multiple objects? lolnope, I'm rendering exactly one object and that's all you get".

After days of wrestling, OpenGL and I came to an agreement, so here are two to-be menu buttons instead of one! And yes, I can draw more than two.



My next step is to get OpenGL to render some text.

You, dear DBP/AGK users, may scoff at your screens as you read this, thinking "Text? Pff, just use print!". And I would laugh at you for your ignorance. Unfortunately, in the vast land of C/OpenGL, you are more or less screwed as far as high level support goes. Did you know every character is actually a plane object in the background textured with a specific texture?



The process of printing text is an adventure full of memory leaks and stack corrupted courage, but here are the basic steps:
1) Find a font library (freetype) and load a font you like
2) Extract all of the glyphs you need from the font
3) Generate an atlass and stuff all of the glyphs you extracted into it, making sure to record the specific offsets since every glyph has a different width/height
4) For every character you want to print a quad has to be generated, along with the correct UV coordinates for the target glyph on the atlass, and handed over to OpenGL.

I'm at step 3).

I like offending people. People who get offended should be offended. -- Linus Torvalds
Chris Tate
DBPro Master
14
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 7th Jan 2015 21:27
Quote: "You, dear DBP/AGK users, may scoff at your screens as you read this, thinking "Text? Pff, just use print!". And I would laugh at you for your ignorance."


lol. One of these days I will have to remove all of my print commands from my source code; they happen to cause such a performance hit.

TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Jan 2015 18:54
Finally making some progress!



I like offending people. People who get offended should be offended. -- Linus Torvalds
SoftMotion3D
AGK Developer
17
Years of Service
User Offline
Joined: 24th Aug 2005
Location: Calgary,Alberta
Posted: 9th Jan 2015 03:32
how long have you been using c#? i too someday would like to venture off behind basic syntax in a quest for speed.

www.sheldonscreations.com
Indicium
14
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 15th Jan 2015 03:54
Quote: "how long have you been using c#? i"


This is C. Make the jump, but to C++. TheComet is crazy writing anything in C.
TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 20th Jan 2015 23:51 Edited at: 21st Jan 2015 06:37
My program did a thing today...

[modedit] no [/modedit]

A real update is coming soon, hold tight.

Quote: "how long have you been using c#? i too someday would like to venture off behind basic syntax in a quest for speed."


This is C, not C#.

I do recommend people who want to try a new game dev language to start with C# though. I think it teaches very good OO (object oriented) programming habits, and those skills will be super useful when you go off to learn the more powerful C++, or decide to learn Java, or Python, or whatever.

When I started with C++ it took me nearly 2 years before I even understood the basics of the language. You have no idea how complicated C++ is until it smacks you in the face and blows your leg off a few times. Some mistakes you can make (such as heap corruption) have devastating consequences: Bugs that show up a lot later and in odd places. They're nearly impossible to debug, even for someone who has mastered the language.

The tools that come with C++/C programming are just as complicated. You will have to learn how to build and maintain a build system (using CMake, premake, etc.), you will have to learn how to properly link against libraries you want to use, you will have to learn the quirks of different compilers and their flags and such.

This is why I recommend you don't start with C++ unless you really feel like you've got it in you. It's a big leap into the far end of the pool, and if you aren't prepared or don't have the mental capacity, you will sink faster than the titanic.

So yeah.

I've been programming in C for 5 years, C++ for 2 years, and DBPro for 8 years.

I like offending people. People who get offended should be offended. -- Linus Torvalds
TheComet
14
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 1st Feb 2015 02:54
Decided to start making videos.



The only way to do great work is to love what you do -- Steve Jobs
Chris Tate
DBPro Master
14
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 2nd Feb 2015 21:27
Very good idea since the only constant in programming is change, being able to change what buttons do without changing source code is the way to go.

Login to post a reply

Server time is: 2022-09-28 10:47:28
Your offset time is: 2022-09-28 10:47:28