Hate: In love with C

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Hate: In love with C

Post by rude »

Ever since I discovered tcc, I've been toying with the idea of making a LÖVE-like thing going with pure C instead of Lua. Let's tentatively call it Hate. No umlaut. :ultraglee:

Tiny C Compiler can be embedded into other C programs and compile and run code dynamically. It should be pretty easy hook up PhysicsFS so that tcc can read the source from that archive. We could use .hate files with main.c and other source code along with all resources. From what I understand, tcc compiles really fast, so I don't think loading time is a problem except for really huge projects.

To run a .hate file, you would obviously need Hate installed. Hate would come with a standard set of libraries very similar to the way LÖVE does. The Hate tool would be capable of compiling a .hate into a stand-alone binary for the current platform. People will not need Hate installed to run the resulting binary.

There could also be a webpage where you submit your .hate file, and builds for all platforms appeared after a time, submitted by volunteers (semi-automatically by the hate binary?).

Code: Select all

/**
* Imaginary Hate code. Yes I realize this is just mimicing SDL. 
* This example is 2D only, but I do not rule out 3D support as
* a possibility.
**/

#include <hate>

int main(int argc, char ** argv)
{
	static hate_Event e;
	hate_Image * image;
	
	hate_init(argc, argv);
	hate_setdisplay(800, 600, 0);
	
	// Load.
	image = hate_newimage("hello.png");
	
	while(1)
	{
		while(hate_pollevent(&e))
		{
			switch(e.type)
			{
				case HATE_QUIT:
					hate_quit();
					return 0;
			}
		}
		
		hate_clear(); // Clear screen.
		hate_drawimage(image, 0, 0); // Draw the image.
		hate_present(); // Presents on screen.	
	}

	return 0;
}
I'm feeling a little conflicted by this "idea", because it is perhaps not substantially different from a normal C library. A hypothetical libhate would certainly be compilable and usable in other C compilers too (not that it would be a bad thing). On the other hand, LÖVE isn't substantially different from a normal Lua library either. Also, Lua is one of the most newbie friendly languages out there ... C isn't. I'm having a hard time imagining C programmers accepting anything except the way they've done things for the last 30 years.

Ok, I'll stop now, while it's still under the threshold of tl;dr. I realize that I haven't really asked any questions in this post, I'm just checking if someone finds this interesting. Hopefully I can supress my urge to find out whether I can pull it off or not so I can focus on LÖVE. :ultraglee:
User avatar
Sardtok
Party member
Posts: 108
Joined: Thu Feb 21, 2008 2:37 pm
Location: Norway/Norge/諾威/挪威 (Yes, I'm teh back!)
Contact:

Re: Hate: In love with C

Post by Sardtok »

Focus on LÖVE, not HATE. Heck, it doesn't even have the umlaut seal of quality.
And remember that not all C programmers are 50+ years old.
Take off every Zigg for great rapist.
Now, outgay that!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Hate: In love with C

Post by Robin »

Sardtok wrote:And remember that not all C programmers are 50+ years old.
But many of them are 30+ years old, and most of them have been programming since their birth, haven't they? ;)
Help us help you: attach a .love.
User avatar
Xcmd
Party member
Posts: 211
Joined: Fri Feb 13, 2009 10:45 pm

Re: Hate: In love with C

Post by Xcmd »

If you're going to gut Lua, then at least go with a better language. C is okay, but why not try strapping in Ruby to do thy bidding?
We don't borrow, we don't read, we don't rent, we don't lease, we take the minds!
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Hate: In love with C

Post by osgeld »

yea if i had my vote id say ruby too
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Hate: In love with C

Post by appleide »

Yes, ruby would definitely be interesting :)

If it was going to be another library for C (albeit comes with a cross platform binary tool), there are other libs I could use instead, like SDL.

Ruby on the other hand... I don't know it yet so it'll interest me alot.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Hate: In love with C

Post by bartbes »

Something that might integrate with LÖVE is if you allow certain parts of the game to be written in C, but not the entire game. (btw, what's wrong with C?)
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: Hate: In love with C

Post by appleide »

bartbes wrote:Something that might integrate with LÖVE is if you allow certain parts of the game to be written in C, but not the entire game. (btw, what's wrong with C?)
C is boring. :p
User avatar
sauer2
Citizen
Posts: 61
Joined: Tue Sep 02, 2008 4:15 pm

Re: Hate: In love with C

Post by sauer2 »

C is terrible, so the name fits well. :P
But there already is orx game engine for C.
If you want to choose, what about languages like Vala, Seed7, Objektpascal (Gnu/Freepascal), Oberon, Modula3 ,Scheme, Eiffel ,Erlang..?
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Hate: In love with C

Post by rude »

Whoa, whoa. I like C. C is awesome. :brows:

A lot of Ruby fans here, eh? I've never used it or seen any code. Read a bit about it just now and its semantics seems pretty nice, but its syntax will take some getting used to.

Xcmd: "gut Lua"? Blasphemy!
sauer2 wrote: Vala, Seed7, Objektpascal (Gnu/Freepascal), Oberon, Modula3 ,Scheme, Eiffel ,Erlang
Wow. I've never used any of those. Some of them I've never heard of.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests