Putting the 'role' back in role-playing games since 2002.
Donate to Codex
Good Old Games
  • Welcome to rpgcodex.net, a site dedicated to discussing computer based role-playing games in a free and open fashion. We're less strict than other forums, but please refer to the rules.

    "This message is awaiting moderator approval": All new users must pass through our moderation queue before they will be able to post normally. Until your account has "passed" your posts will only be visible to yourself (and moderators) until they are approved. Give us a week to get around to approving / deleting / ignoring your mundane opinion on crap before hassling us about it. Once you have passed the moderation period (think of it as a test), you will be able to post normally, just like all the other retards.

Which programming language did you choose and why?

Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
Those languages are alll shit.
You should contact me and I will license you my own custom, high-level creation.
Its called Hashtagdefine and its has LLVM support, highly portable, stdlib, etc. Everything from C/C++!
Greatest Syntax Of All!
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
If you want to build a complex IA, for example in RTS games, then go for some language allowing great flexibility and easy writing of algorithms, such as Racket, Common Lisp or OCaml. They are designed to allow you to write code quickly and efficiently without having to deal with overly technical matters such as memory management.
Just wanted to disagree on this point (having worked on several AAA RTSs) : those games have many many things to manage so you need good-ish algorithms AND a good constant factor (sprinkled with parallelism would be better), so I'd definitely use C, C++, Rust, or Common Lisp there, but would avoid Racket and OCaml.
 

Hag

Arbiter
Patron
Joined
Nov 25, 2020
Messages
1,685
Location
Breizh
Codex Year of the Donut Codex+ Now Streaming!
If you want to build a complex IA, for example in RTS games, then go for some language allowing great flexibility and easy writing of algorithms, such as Racket, Common Lisp or OCaml. They are designed to allow you to write code quickly and efficiently without having to deal with overly technical matters such as memory management.
Just wanted to disagree on this point (having worked on several AAA RTSs) : those games have many many things to manage so you need good-ish algorithms AND a good constant factor (sprinkled with parallelism would be better), so I'd definitely use C, C++, Rust, or Common Lisp there, but would avoid Racket and OCaml.
Oh ok, wasn't aware of that. Maybe I was overeaching with Racket, but I thought OCaml could have pretty good performances.
 

Tramboi

Prophet
Patron
Joined
May 4, 2009
Messages
1,226
Location
Paris by night
Oh ok, wasn't aware of that. Maybe I was overeaching with Racket, but I thought OCaml could have pretty good performances.
Yes single-thread performance would be quite good indeed with OCaml!
But multicore OCaml is still not a thing (I think).
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
Where are all the auto-parallel super-concurent languages I heard about 15 years ago when the dualcores came (all over my face)?
I have 8 cores, why do I use OpenMP and think about data and racism?
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
Tour of our 250k line Clojure codebase (redplanetlabs.com)
roffles, they copied my macro language!!!1
Claimed a"100X decrease in application development cost" but then deleted it and I didnt care to snapshot, shame.
I'd cut off my pinky finger if they gave me 100X speed up. You wrote that app in 100 hours? Here is how you can do it in 1!
CLOJURE!
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,328
JBlow is working Jai, which, people claim, will be a better C++ for game development.

Let's hope so. I think it's frustrating to think about these modern languages that still fail in some aspects, because the language developers don't think things in practical way. It's like they don't even want to create a language for actual use, possibly their background is linux which has always been more specific than "mundane" desktop programs.
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
This is now a code thread!

Here is a shithouse thought I had for a regurgitated blogpost:
The famously "hardest thing in comp sci" being the "naming of things (and cache invalidation)" is ideologically/fundamentally the same as choosing the degree of "object" generalization, the degree of A-bstraction in APIE.
So object abstraction in typical OO languages is the hardest thing architecturally. And is impossible to do right on first try and remains impossible once the object environment starts to change, if you are too general/universal.

You can go from:
int convert_float_to_int(float); // which takes a float and converts to integer ...or does it...?
to ultimately:
void* convert_data(void*); // which takes abstract "data" and shits out abstract "data", very abstract, very OO factory generator base class

And the Art is finding the proper degree of generalization, "naming" it right.
And "naming" in OOP is harder.

Conclusion? Actionable Intelligence? -> idunnolol
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,950
You can go from:
int convert_float_to_int(float); // which takes a float and converts to integer ...or does it...?
to ultimately:
void* convert_data(void*); // which takes abstract "data" and shits out abstract "data", very abstract, very OO factory generator base class
You can use \[code\] tags to format your code.
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
Here is a cute anti-C++ OOP things I ran across:
https://toit.io/product/device
A startup SaaS that picked a common !specific! piece of hardware, an mcu with a wifi chip ESP32 (lookitup if you dont know),
developed a custom language (lock in, lol) where you pay $0.10 per MB data transfer through """Cloud""" roffles,
but the cute thing is, they limit inheritance to 1 level heh, smart:
https://docs.toit.io/language/objects-constructors-inheritance-interfaces/
Interfaces
A class can only extend one class, but can implement several interfaces. Like classes, interfaces act as types in Toit's type system, but unlike classes, they do not include implementations for the non-static methods they declare.
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,950
Code:
why the fuck would i format 2 lines?
Because whatever shit code you wrote is easier to read with code tags:

Code:
// which takes a float and converts to integer ...or does it...?

int convert_float_to_int(float);

// to ultimately:

void* convert_data(void*);

// which takes abstract "data" and shits out abstract "data",
// very abstract, very OO factory generator base class
 

Krice

Arcane
Developer
Joined
May 29, 2010
Messages
1,328
Anti-C++ rants are somewhat annoying, because I find that it's not C++ that is making (game) development difficult, it's pretty much everything else. Also those rants are quite dishonest or even worse the person who is ranting doesn't know how to code.
 

Catacombs

Arcane
Patron
Joined
Aug 10, 2017
Messages
5,950
fucking a, zoomer cuck, i was riting c in notepad.exe wihtout any dark theme, syntax highlights, m o n o s p a c e d font, language server, debugging, compiler error messages, and i liked it
while you hurr durr about 2 func decls, holy shit, having the !nerve!, go ask for [fag] tag...
I simply suggested code tags, and you sperg out like this is a /g/ thread. Seek help.
 

Hag

Arbiter
Patron
Joined
Nov 25, 2020
Messages
1,685
Location
Breizh
Codex Year of the Donut Codex+ Now Streaming!
This is what hard drugs do to people.
I've seen addicts much more articulate than this guy.

On the other hand, I'd be curious to read some of his code, must be a curiosity. Rewrite , would you share some of your code repo or sources ? I'm sure we can all learn from your knowledge.
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
I simply suggested code tags
and i told you discretely to fuck off and shut the fuck up
but you didnt get it on the first try
here is me simply suggesting it to simpleton a third time (a charm): suck my dick and kys
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
I'd be curious to read some of his code, must be a curiosity.
oh it aint pretty breh (but dont tell anyone) but how about you post some nice lines of yours?
 
Unwanted

Rewrite

Latest Doxxer Account
Dumbfuck
Joined
May 25, 2021
Messages
91
here is some python i had fun with, i remember because there was mistake in it that """test driven development""" pointed out,
and i had to debug lambdas,
have you tried to set a breakpoint on a lambda?:

P = lambda a, b, c: sum(((-1)**k) * comb(a,k,True) * comb((c-b*k-1),a-1,True) for k in range(0, max(1,(c-a)//b+1)))
...
for m in range(0, x * y + 1): mean += max(0, m+mind-u) * (P(y, x, m) / x**y)
 

Hag

Arbiter
Patron
Joined
Nov 25, 2020
Messages
1,685
Location
Breizh
Codex Year of the Donut Codex+ Now Streaming!
I'd be curious to read some of his code, must be a curiosity.
oh it aint pretty breh (but dont tell anyone) but how about you post some nice lines of yours?
Ok, I'm game.
Here is the main logic file of my current game project :

Code:
#include <stdio.h>
#include "../include/linmath.h"
#include "bigh.h"
#include GLAD_PATH
#include SDL_PATH


void reset_game_state(GameWorld* GW, GameVars* GV, GameData* GD) {
   GW->level = GD->levels[GV->current_level];
   GV->game_state = IN_PROGRESS;
   GV->continues = 3;
   GV->bricks_left = GW->level.bricks_count;
   GV->score = 0;
}

void set_texture(GameData* GD, int index, unsigned int texture) {
   GD->res.textures[index] = texture;
}
void set_shape(GameData* GD, int index, Shape shape) {
   GD->res.shapes[index] = shape;
}

void game_init(GameWorld* GW, GameVars* GV, GameData* GD) {
   float w = (float)GD->width;
   float h = (float)GD->height;
   unsigned int shader_sprite = shader_create("src/shaders/vs_cube.glsl", "src/shaders/fs_sprite.glsl");
   unsigned int shader_text = shader_create("src/shaders/vs_text.glsl", "src/shaders/fs_text.glsl");
   unsigned int shader_tile = shader_create("src/shaders/vs_cube.glsl", "src/shaders/fs_tile.glsl");

   mat4x4 mat_proj;
   mat4x4_identity(mat_proj);
   mat4x4_ortho(mat_proj, -(float)GD->interface_size, w, 0.0f, h, -10.0f, 10.0f);
   // mat4x4_perspective(mat_proj, deg_to_rad(45), w/h, 0.1f, 100000.0f);
   
   glUseProgram(shader_sprite);
   shader_set_int(shader_sprite, "image", 0);
   shader_set_mat4x4(shader_sprite, "projection", mat_proj);
   Shape basic_obj = sprite_init(shader_sprite);
   
   glUseProgram(shader_text);
   shader_set_int(shader_text, "image", 0);
   shader_set_mat4x4(shader_text, "projection", mat_proj);   
   Shape text_obj = sprite_init(shader_text);
   
   glUseProgram(shader_tile);
   shader_set_int(shader_tile, "image", 0);
   vec2 tile_size = {1.f, 900.f/64.f};
   shader_set_vec2(shader_tile, "tex_ratio", tile_size);
   shader_set_mat4x4(shader_tile, "projection", mat_proj);   
   Shape tiled_obj = sprite_init(shader_tile);
   
   set_texture(GD, GO_BLOCK,        texture_load("img/block.png"));
   set_texture(GD, GO_BLOCK_SOLID, texture_load("img/tex2.png"));
   set_texture(GD, GO_BACKGROUND,    texture_load("img/tile_grass1.png"));
   set_texture(GD, GO_PADDLE,        texture_load("img/paddle2.png"));
   set_texture(GD, GO_BALL,        texture_load("img/goatball.png"));
   set_texture(GD, GO_TEXT,       texture_load("img/font.png"));
   set_texture(GD, GO_INTERFACE,    texture_load("img/tile_border.png"));
   set_texture(GD, GO_POPUP,        texture_load("img/popup.png"));
   
   set_shape(GD, GO_EMPTY,        basic_obj);
   set_shape(GD, GO_BLOCK,        basic_obj);
   set_shape(GD, GO_BLOCK_SOLID,    basic_obj);
   set_shape(GD, GO_BACKGROUND,    basic_obj);
   set_shape(GD, GO_PADDLE,        basic_obj);
   set_shape(GD, GO_BALL,            basic_obj);
   set_shape(GD, GO_TEXT,            text_obj);
   set_shape(GD, GO_INTERFACE,    tiled_obj);   
   set_shape(GD, GO_POPUP,        basic_obj);
   
   init_text(GW, GV, GD);
   init_interface(GW, GV, GD);
   reset_paddle(GW, GV, GD);
   reset_ball(GW, GV, GD);
   
   GV->wireframe = 0;
   GV->timing = 1.0f;
   GV->paddle_max_speed = 1.7f;
   GV->paddle_acceleration = 0.8f;
   GV->current_level = 0;
   GV->score = 0;
   GV->score_bonus = 0;
   
   reset_game_state(GW, GV, GD);
   // GW->popup.state = ENABLED;
   // GW->text_popup.m.state = ENABLED;
}


void game_update(GameWorld* GW, GameVars* GV, GameData* GD, float dt) {
   
   switch (GV->game_state) {
       case IN_PROGRESS :   
           GV->timing = 1.0f;
           GW->ball.timing = 1.0f;
           ball_move(GW, GV, GD, dt);
           paddle_move(GW, GV, GD, dt);
           if (GV->bricks_left == 0) {
               GV->game_state = WON;
           }
           for (int i=0; i < GW->level.obj_count; ++i) {
               WO_update(GW, GV, GD, &(GW->level.bricks[i]), dt);
           }
           break;
       case WON :
           GW->popup.state = ENABLED;
           GW->text_popup.m.state = ENABLED;
           if (GV->score > GD->levels[GV->current_level].highscore) {
               GD->levels[GV->current_level].highscore = GV->score;
           }
           ball_move(GW, GV, GD, dt);
           break;
       case NEXT :
           GW->popup.state = DISABLED;
           GW->text_popup.m.state = DISABLED;
           if (GV->current_level < GD->level_count - 1) {
               ++ GV->current_level;
               // GW->level = GD->levels[GV->current_level];
               reset_game_state(GW, GV, GD);
               reset_paddle(GW, GV, GD);
               reset_ball(GW, GV, GD);
           } else {
               GW->background.rotation += 0.5f;
           }
           break;
       case OUT :
           GV->continues -= 1;
           if (GV->continues <= 0) {
               GV->game_state = LOST;
           } else {
               reset_ball(GW, GV, GD);
               reset_paddle(GW, GV, GD);
               GV->game_state = IN_PROGRESS;
           }
           break;
       case PAUSE1 :
           // GV->timing = 0.0f;
           GW->ball.timing = 0.0f;
           ball_move(GW, GV, GD, dt);
           paddle_move(GW, GV, GD, dt);
           for (int i=0; i < GW->level.obj_count; ++i) {
               WO_update(GW, GV, GD, &(GW->level.bricks[i]), dt);
           }
           break;
       case LOST :
           GV->game_state = QUIT;
           break;
       default :
           break;
   }
}

void game_render(GameWorld* GW, GameVars* GV, GameData* GD) {
   if (GV->wireframe == 1) {
       glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
   } else {
       glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
   }
   
   shape_draw(GD, &GW->interface);
   shape_draw(GD, &GW->background);
   shape_draw(GD, &GW->paddle);
   
   for (int i=0; i < GW->level.obj_count; ++i) {
       shape_draw(GD, &(GW->level.bricks[i]));
       // shape_draw(GD, &(GD->levels[GV->current_level].bricks[i]));
   }
   shape_draw(GD, &GW->ball.m);
   
   shape_draw(GD, &GW->popup);
   
   sprintf(GW->text_level.text, "LEVEL %d/%d", GV->current_level+1, GD->level_count);
   WO_text_draw(GD, &GW->text_level);
   
   sprintf(GW->text_score.text, "Score");
   WO_text_draw_xy(GD, &GW->text_score, -180.f, 310.f);
   sprintf(GW->text_score.text, "%d", GV->score);
   WO_text_draw_xy(GD, &GW->text_score, -180.f, 240.f);
   sprintf(GW->text_score.text, "Top ");
   WO_text_draw_xy(GD, &GW->text_score, -180.f, 170.f);
   sprintf(GW->text_score.text, "%d", GD->levels[GV->current_level].highscore);
   WO_text_draw_xy(GD, &GW->text_score, -180.f, 100.f);
   
   if (GV->score > GW->level.highscore) {
       sprintf(GW->text_popup.text, "Nouveau record !\n%d points !", GV->score);
   } else {
       sprintf(GW->text_popup.text, "Ouais ! Ca vous fait %d points bien merites.", GV->score);
   }
   WO_text_boxdraw(GD, &GW->text_popup, 450.f);
}

Come on everybody ! Code showdown !
 

Twiglard

Poland Stronk
Patron
Staff Member
Joined
Aug 6, 2014
Messages
7,239
Location
Poland
Strap Yourselves In Codex Year of the Donut
Virgin `unsigned int' user vs the chad `unsigned'.
 

As an Amazon Associate, rpgcodex.net earns from qualifying purchases.
Back
Top Bottom