• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Nathan2222_old

Just another thought (designing a fast but powerful language)

77 posts in this topic

Well, if we define a stupid metric, we'll get stupid code:

bool any(vector const&v){return find(v.begin(),v.end(),1)!=v.end();}
i don't like code like that and i could never write that. Code should be clearly written and understandable.
The any() wins in this case.
0

Share this post


Link to post
Share on other sites
{} to me makes code clearer and arranged even more than begin and end. If you removed the {} from all the code in that 390,000 LOC program, you could get >= 90,000 less lines of code but also an unfunctional and probably unreadable program.
@alvaro: after that, your program has 2 lines, the return part and the function name part.
0

Share this post


Link to post
Share on other sites


Perhaps you didn't mean to compare an iterator and a boolean constant...

 

Correct, I did not.  The perils of writing unchecked code (I went back and fixed it). ;)

 

As has been pointed out, it's also not the most efficient way of writing the function, but it served to illustrate the idea I was trying to get across.

 

Something I also meant to mention earlier, but forgot to, is that there is a downside to having a lot of built-in functions.  Sure it allows for writing less code, but imagine there was a language with 10,000 built-in functions.  Trying to remember them all would be near impossible, and implementations of the language would be too big to be usable.  The best languages strike a happy medium somewhere between that and assembly.

1

Share this post


Link to post
Share on other sites

Perhaps you didn't mean to compare an iterator and a boolean constant...

Sure it allows for writing less code, but imagine there was a language with 10,000 built-in functions. Trying to remember them all would be near impossible, and implementations of the language would be too big to be usable. The best languages strike a happy medium somewhere between that and assembly.
10,000 is huge! Assembly?
0

Share this post


Link to post
Share on other sites


10,000 is huge! Assembly?

 

Yes, 10,000 is huge.  I deliberately chose it as an over-exaggerated example.

 

Assembly is the complete opposite. It has an extremely limited number of commands.

0

Share this post


Link to post
Share on other sites

 


10,000 is huge! Assembly?

 

Yes, 10,000 is huge.  I deliberately chose it as an over-exaggerated example.

 

Assembly is the complete opposite. It has an extremely limited number of commands.

 

what? pc assembly got a hundreds of different commands with different adressing modes and many characteristics for me very hard to memorize (dont know how many but this is not small amount)

1

Share this post


Link to post
Share on other sites


what? pc assembly got a hundreds of different commands with different adressing modes and many characteristics for me very hard to memorize (dont know how many but this is not small amount)

 

Many of them are just variations of one another.

0

Share this post


Link to post
Share on other sites

i took a somewhat different approach to the issue of increasing productivity by reducing typing (lines of code).

 

i wrote a macro preprocessor for C/C++.

 

i can code in a shorthand macro language, then run it through the macro processor to expand it into full blown c++ code.

 

the macro language (Cscript) allows me to freely mix macro and c++ code for maximum flexibility.

 

translation speed for the macro processor is on the order of 100,000 lines per second. so it only adds a second or two to the build pipeline.

 

i now do all my coding this way.  

 

legacy code can be edited in c++ syntax.   new code or large changes can be done with the faster Cscript.  and complex expressions can always be done in c++, even in the middle of a block of Cscript code.

 

i considered writing a compiler, but determined that a macro processor got one the best of both worlds: an easy scripting language designed to minimize keystrokes, and the full power of commercial quality c++ compilers.

 

http://www.gamedev.net/gallery/image/4227-cscript-code-generator/

0

Share this post


Link to post
Share on other sites

After reading the wikipedia article on functional programming, i see that that's where c++ got recursivity from and functional programming seems to be concerned with only mathematics.

 

Functional programming is a programming paradigm and C++ inherit recursion directly from C and not from functional programming (officially C++ acquires functional programming capability  with the 2011 standard).

 

Recursion is a (powerful) methodology to find a solution of a problem starting from a mathematical definition of it, and it is not strictly dependent to functional programming paradigm. Note also most of times you can switch from recursion to iteration (and even vice versa) with just some "mechanical" steps..

 

@apochPiQ: that's why i started the thread. You could just talk about some things that are more important.
Thanks smile.png

 

To begin, you should tell us what the goals of this "new programming language" are. And these are not:

 

Would it be possible to make a compiled language as fast as c and c++, multi paradigm like c++, less complex than them both and can be used like in really complex situations like in making an OS/game engine/IDE etc.

Edited by Alessio1989
0

Share this post


Link to post
Share on other sites

Ultimately, its my belief that for a new language to be successful today, it has to be compelling in a way that's not already cornered by existing languages. Its not enough to say "My language will be as fast as C++, just as general-purpose, but with a smaller, more-regular, and more-expressive syntax." Even if you achieved all those goals in spades, you will have only an "interesting" language -- one that can be admired for its achievements but still for which almost no one will be willing to retrain their programmers for, or use in production. All existing languages have momentum no matter how bad, your new language has effectively zero momentum no matter how good. Its exceedingly difficult to overcome that disparity without offering something more than a subjectively-better new-old-thing.

Most of the very successful languages have hitched their wagons to emerging/popularizing programming paradigms or development styles. Their sales-pitch was not "A better way to do the same old thing." but "The best way to do the hot new thing." C hitched its wagon to being the first truly usable high-level language that could achieve near-assembly-language levels of performance. C++ hitched its wagon to being the first usable OOP language that, was compatible with C and achieved basically the same performace. Java pitched itself as being the code you wrote once and ran everywhere. C# pitched itself as being the premier language for rapid application development. Perl pitched itself as being the premier language for text processing. Python as the universal scripting language. Lua as the scripting language for games. Javascript as the near-accidental king of client-side code on the internet.

Any new language today that cannot find its pitch, and a voice strong enough to shout above the cacophony of other boisterous languages is doomed.

so it has to do a whole new thing that no language has done.
Like 3sweep plans to do for the 3d world. It's doing the same thing 3d modelling software does but it a way that is new, unbelievably easy and shockingly awesome (I had the same idea until someone pointed me to 3sweep).
It does old things in a completely new way.
The 3sweep of the programming world.
0

Share this post


Link to post
Share on other sites
In my thoughts, i've created a google chrome style browser with less than 300 lines of code. It involves some sort of AI and the language uses specify a lot.

specify object:
specify object function
{
}
I can't seem to think of console programs in the language. Only GUI programs.
-1

Share this post


Link to post
Share on other sites

In my thoughts, i've created a google chrome style browser with less than 300 lines of code. It involves some sort of AI and the language uses specify a lot.

… and if you could actually do that sort of stuff in the real world instead of in your thoughts, Google (and lots of other companies) would throw so much money at you that you could end all poverty and still have more money than you could ever spend.

If we're going to go all dreamy, I can think of a machine that looks like a really cool hat that you can wear, and makes every game idea you'll ever think of magically appear fully created with the best graphics and gameplay ever. You don't even have to type a single line of code. How can any other invention ever beat that for game development? It'll use some clever neuro-science or something, and you have to focus on your idea for 10 seconds.

There is a world of difference between "I've got this fantastical magical thought-concept for something - I'm sure it's going to be awesome" and "This is a fully-functioning realization of an idea".
The former is easy. Ideas are generally easy.
Execution is hard.
it just seems right and mine involves coding.
I need to think more.
I heard never throw away an idea.
0

Share this post


Link to post
Share on other sites


I need to think more.

There is an old saying I've been told for years that I think applies nicely to that: "Think less, code more."


I heard never throw away an idea.

That is true. Every game idea I have had, I have wrote into a series of notebooks. If you don't have them, get notebooks to write the idea in or type up the idea, print it out, and then store them in a binder. Above all else, code, always code, even if you just do tests for ideas, you must always code something as it will help you improve.

0

Share this post


Link to post
Share on other sites

I need to think more.

There is an old saying I've been told for years that I think applies nicely to that: "Think less, code more."

I heard never throw away an idea.

That is true. Every game idea I have had, I have wrote into a series of notebooks. If you don't have them, get notebooks to write the idea in or type up the idea, print it out, and then store them in a binder. Above all else, code, always code, even if you just do tests for ideas, you must always code something as it will help you improve.
I will. I have several ideas in several notebooks, i don't really like typing down my ideas.
0

Share this post


Link to post
Share on other sites

In my thoughts, i've created a google chrome style browser with less than 300 lines of code. It involves some sort of AI and the language uses specify a lot.

specify object:specify object function{}
I can't seem to think of console programs in the language. Only GUI programs.

Are you planning to write a compiler for this language you have in mind?

Yeah. An ide.
Won't i have to?
0

Share this post


Link to post
Share on other sites

 

 

Yersterday, i read an article saying that ruby/python programs involve 5x less lines than c and c++ programs. What does this mean?

 

 

dont think so, I was not using python to much but this would

meen (if the function of your code will stay the same and they

if they doing something nontrivial but real code - stay the same)

that every of such function will be compressed  5X of 4X

- i dont see it - it will be about the same [esp if you will remove the blank lines and move code like

 

void f()           {

  if(a==0)        {

      b++;            } }

 

(years ago i was using thic convention, this is not so bad imo)

 

what else python make to short sources compared to c ?

(maybe something but it would be imo more like 20% shorter not 5X 

 

 

You do realize that when we say that Python code is shorter than e.g. C code we're not talking about removing the curly braces and a few comments, right? We're talking about the high-level structure of the code - Python is typically more expressive in less code, because it has a lot of stuff built-in (and cross-platform, for the most part), it's designed for short and concise syntax so that you don't have to implement all the stuff you need manually or use an external library (if even possible, like syntactic sugar).

 

 

 


(if the function of your code will stay the same and they
if they doing something nontrivial but real code - stay the same

 

That's the point - the code doesn't stay the same. It becomes shorter as a lot of the low-level complexity you have to deal with in C or C++ for instance is handled by the language and the runtime itself. Functions disappear because they become built-in, paragraphs of code become shorter because you don't need many lines to declare, initialize and populate a dictionary (key-value store) from a file, you can do it in one, you don't need to formally define complex object relations and dependencies since you have duck typing, variables are automatically freed, nontrivial command-line parsing is built-in and you don't have to go dig up a library on the internet and learn how to use it (more or less everyone uses argparse), big integers are built-in, you can even run Python code dynamically from existing code, etc, etc...

 

If you think Python is just C minus the curly braces then you clearly have never used it. It has its failings and doesn't work for everything (writing a large business application would probably get messy, and it has its warts) but when you use it - or Ruby, by the way, everything I said above almost certainly applies to Ruby even though I've never used it - for what it's meant for, the resulting code is surprisingly short and fluent.

 

 

well, i dont know (i used a python to wrote a simple mandelbrot set viewer a couple of years ago and that is all my knowledge of python)

 

i think 90% of c programs length are user defined labels, the rest is keywords (mostly return float double int) and a dust of symbols (overpresent in c imo)  [your very right about this that declaration 

lines consume space in c thats good point]

 

one could move some code lines by makin things built-in as you said

but could you give some some examples for things that are biult in 

in ptyhon and canot by shortened in c by moving them to library and

just use library (It is maybe possible but i dont see it because idont

know python to this extent)

 

after all i still doubt if python can shorten sources even 3 times not to mention 5 times - the main fail of c is maybe its overuse of symbols here

0

Share this post


Link to post
Share on other sites


one could move some code lines by makin things built-in as you said
but could you give some some examples for things that are biult in 
in ptyhon and canot by shortened in c by moving them to library and
just use library (It is maybe possible but i dont see it because idont
know python to this extent)

 

You can move the entirety of your program into a library and call it in a single line from your main function. Does that make it the shortest program ever?

1

Share this post


Link to post
Share on other sites

 


one could move some code lines by makin things built-in as you said
but could you give some some examples for things that are biult in 
in ptyhon and canot by shortened in c by moving them to library and
just use library (It is maybe possible but i dont see it because idont
know python to this extent)

 

You can move the entirety of your program into a library and call it in a single line from your main function. Does that make it the shortest program ever?

 

you could also built-in your program in python so it wold be 1:1

python wouldnt be 5 times shorter or it will be?

 

Im saing that defining things and moving them away of the code 

should be excluded from comparison - I mean if you confront some 

python builtins compare tham against c with library 

 

except when you give examples of things that python could really short and this would be hard to achive in c + lib (Im just interested in examples on this)

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0