The Box, development tool, "Structural programming"

Re: The Box, development tool, "Structural programming"

Postby jdc » 20 Nov 2018, 10:04

outdate post...
Last edited by jdc on 14 Oct 2019, 16:57, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 20 Nov 2018, 12:17

outdated post...
Last edited by jdc on 14 Oct 2019, 15:13, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 20 Nov 2018, 15:31

outdate post...
Last edited by jdc on 22 Oct 2019, 05:03, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 20 Nov 2018, 18:02

outdated post...
Last edited by jdc on 14 Oct 2019, 16:58, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 24 Nov 2018, 14:05

outdate post
Last edited by jdc on 22 Oct 2019, 05:04, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby Lyberta » 24 Nov 2018, 18:50

jdc {l Wrote}:(don't imagine many ppl using linux):


I'm pretty sure for most people on this forum GNU/Linux is the only OS they use.
User avatar
Lyberta
 
Posts: 662
Joined: 19 Jun 2013, 10:45

Re: The Box, development tool, "Structural programming"

Postby jdc » 24 Nov 2018, 22:02

Good for them. Lyberta

T
Last edited by jdc on 14 Oct 2019, 17:02, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 25 Nov 2018, 09:53

outdated post...
Last edited by jdc on 14 Oct 2019, 17:05, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 27 Nov 2018, 11:20

post outdated...
Last edited by jdc on 14 Oct 2019, 17:07, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 27 Nov 2018, 13:46

outdated post...
Last edited by jdc on 14 Oct 2019, 17:08, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 28 Nov 2018, 16:21

outdate post
Last edited by jdc on 14 Oct 2019, 17:09, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby smcameron » 03 Dec 2018, 01:07

"smcameron", not "scamerson". Ranking 0.1 out of 5? Ha. Nice burn.
smcameron
 
Posts: 317
Joined: 29 Oct 2010, 23:44

Re: The Box, development tool, "Structural programming"

Postby jdc » 12 Dec 2018, 11:02

smcameron lol
Last edited by jdc on 14 Oct 2019, 17:11, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 07 Jan 2019, 14:13

Lunch a 0.0.1 version, is not a version is just a structure. If i can have things ready i will lunch 0.1.1 a working version.

The files i'm working are in google drive public folder, (some code are from other projects is there just to know how thing are done) https://drive.google.com/drive/folders/ ... ugL7glslMk

what is PHP ? - Hiper text Preprocessor Programing Language.

This means that PHP way of doing things can only be replicated with the Preprocessor which in C are the .H files.

For what i read C is a single treat language you only have main() to work with.

The structural programming can be achieved with this:

main (){
include "image.h"
include "image_JPG.h"
}

For what i tested both files .h can communicate with which other. The ".c" extension can't access which other files.

The .h files need to be in main, to work with variables, because of the single treat thing. People for what i read advice not to use variables inside .h but only declare them. This way we can use files like in PHP.

image_jpg.h is inheriting successfully from image.h

We can see now a structure in the main. Looks is like a configuration page. (is Tweakble in the code or lather outside with a interface.)


{l Code}: {l Select All Code}
   main(){
   #include "application_structures\time.h"
   #include "application_structures\error.h"
   #include "application_structures\file.h"
   #include "application_structures\string.h"
   #include "application_structures\paths.h"
   #include "application_structures\database.h"
   #include "application_structures\image.h"
   #include "application_structures\image_jpg.h"
   //#include "application_structures\image_png.h"
   //#include "application_structures\image_gif.h"
   
   #include "application_structures\sound.h"
   #include "application_structures\keys.h"
   #include "application_structures\resolution.c"
   //#include "application_structures\interface.c"

   #include "application_structures\model.h"
   #include "application_structures\model_textures.h"
   #include "application_structures\model_animation.h"
   #include "application_structures\model_particles.h"
   #include "application_structures\model_bounds.h"    //colision, triggers
   
   #include "application_structures\model_blend.c"
   //#include "application_structures\model_DAE.c"
   //#include "application_structures\model_FBX.c"
   //#include "application_structures\model_OBJ.c"
   
   #include "application_structures\camera.h
   #include "application_structures\camera_RTS.h
   //#include "application_structures\camera_FPS.h
   //#include "application_structures\camera_2D.h
   //#include "application_structures\camera_3Person.h
   
   #include "application_structures\print_screen.h
   

   #include "application_structures\movement_RPG.h"
   #include "application_structures\movement_Vehicles.h"
   
   #include "application_structures\AI.h"
   
   /* GAME STRUCTURE LIBRARY */
   
   #include "game_strutures\game.c"
   #include "game_strutures\money.c" //timers
   //#include "loots.c"
    #include "game_strutures\spells.c"
   #include "game_strutures\abilitys.c"
   #include "game_strutures\items.c"
   #include "game_strutures\items_sci_fi.c"   
   #include "game_strutures\items_rpg.c"
   #include "game_strutures\items_fantasy.c"
   
   /* TEST LIBRARY */

   //#include "variables_interface.c"
    //#include "interfaces/interface2.c"

   if (debug == 1){
      //fprintf (stderr, "%s:%d: %s: Assertion `%s' failed.\n", error_file, error_line, error_func, error_assert);
      //abort ();
   }

   printf("Choose interface : ");
    scanf("%s", str1);

   printf("Enter interface : %s", str1);

   interface = atoi (str1); // Convertes the string to a integer
   
   /*
   
      TOOLS LIBRARY
      -Interfaces can be in .c since they do not delegate any to other files.
      -The previous .h files cam delegate to .c files.
   */
   
   if(interface == 0){ // Main Menu
      //printf("Main Menu loading");
      
      #include "interfacces/main_menu_GTK.c"
      //#include "interfacces/main_menu_SDL.c"
      //#include "interfacces/main_menu_Free_GLUT.c"
   }
   else if(interface == 1){ // Character Creator

      //printf("Character Creator loading");

      #include "interfaces/character_generator_GTK.c"
   }
   else if(interface == 2){ // Shadder Tool
         //printf("Interface2");
         //#include "interfaces/interface2.c"
   }
   else if(interface == 3){ // Map Editor
         //printf("Interface3");
         //#include "interfaces/interface3.c"
   }
   else if(interface == 4){ // Variable Manager
         //printf("Interface3");
         //#include "interfaces/interface3.c"
   }
   else if(interface == 5){ // Generic Animation
         //printf("Interface3");
         //#include "interfaces/interface3.c"
   }
   else if(interface == 6){ // Particle Tool
         //printf("Interface3");
         //#include "interfaces/interface3.c"
   }
   else if(interface == 7){ // Particle Tool
         //printf("Interface3");
         //#include "interfaces/interface3.c"
   }
   else if(interface == 8){ // Level Models Position
         //printf("Interface3");
         //#include "applications/the_box/levels_models_position.c"
   }
   else if(interface == 9){ // Level Editor

         //printf("Interface9");

         //#include "applications/the_box/levels_models_position.c"
   }
   else if(interface == 10){ // Database tool
         //printf("Interface9");
         //#include "applications/the_box/levels_models_position.c"
   }
   else if(interface == 11){ // Options
         //printf("Interface9");
         //#include "applications/the_box/levels_models_position.c"
   }

   system("cls");
   system("pause");

    return 0; // Zero indicates success any other failed
}



The point of this is , if some one code a camera_RPG for their game if using a inheriting structure, can be use in your game also. A waste of time we all have to program that rpg camera again and again.
Last edited by jdc on 22 Oct 2019, 05:06, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby Octavekman22 » 07 Jan 2019, 15:13

I want to know about structural programming
Octavekman22
 
Posts: 1
Joined: 07 Jan 2019, 15:12

Re: The Box, development tool, "Structural programming"

Postby Lyberta » 08 Jan 2019, 11:20

jdc {l Wrote}:For what i read C is a single treat language you only have main() to work with.


Actually, ISO C supports multithreading since C11. But most people who write C still fallback to OS API for threading.

jdc {l Wrote}:For what i tested both files .h can communicate with which other. The ".c" extension can't access which other files.


#include directive is just textual inclusion. You can access stuff that was declared before in the same translation unit (read: .c file).

jdc {l Wrote}:The .h files need to be in main, to work with variables


You can use dependency injection to pass pointers to variables you need.

Octavekman22 {l Wrote}:I want to know about structural programming


Here: https://en.wikipedia.org/wiki/Structured_programming

Basically, it's a very old paradigm that produces unreadable code mostly because of ban on early exits.
User avatar
Lyberta
 
Posts: 662
Joined: 19 Jun 2013, 10:45

Re: The Box, development tool, "Structural programming"

Postby jdc » 09 Jan 2019, 07:17

Lyberta

din't know the concept already existed and using the same name lol. I didn't read the theory, just got it from programming. My first post called it something different, then get in to this name when i mature the concept.

But one thing they got it right in the Wikipedia article, is allow to use less functions and much more if/elses, which your code become simpler.

Octman

A practical example on the inherit.

image.h -> Contains the stuff that repeats. Variables and functions. For example the height and weight repeats in the other 2 files. A compress image function, may also repeat in the other 2 files.

image.h -> repeat variables and functions
image_JPG.h -> receives variables
image_PNG.h -> receives variables

image.h
//image_JPG.h
image_PNG.h

in this way we have less code, and can comment any library that those variables are still there. If we comment image_JPG there will be nothing there that affects our system, because we put the repeating stuff in to image.h, and they
don't collide, because both are using the same structure the "image.h".

Often we can use just use if and else, because of the inheriting, the variables are at image.h with default defaults, is just a meter of doing simple test with : if and else.

In may PHP code, i removed a great amount of functions in to if/elses.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 11 Jan 2019, 00:58

outdated post...
Last edited by jdc on 20 Oct 2019, 04:34, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 15 Jan 2019, 10:51

outdated post...
Last edited by jdc on 14 Oct 2019, 18:03, edited 1 time in total.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 29 Jan 2019, 08:12

I see a lot of interest of people in coding, but not that many are successful in doing some programming or learning.

I think the main aspect of programming is learning how to debug code. Because most of the problems are related to conflicts inside the code.


There are probably many approach to debugging was there is to programming.

But this is how i do it.

I separate the code in to library's, not just to do better programming but also to do better debugging.

I this error in c : "unexpected token in variables", since i read the tutorials and have some experience in programming i already know that is not related to variables.

how did i debug this error and in general?

I move the code to a smaller environment. like the file main_tests.c which i now updated it to the google drive project.

in the file you can post the stuff related to what you are doing.

For example if you are working with images. Post only image code.

"variables"

image.h
image_JPG.h

"functions"


So now you have only image related code in to do tests in 2º main file. In this case It will output no error because it was not related to variables.

In this way you can code like i do, can code large amounts of code, then debug bits. If you are not doing like this you need to program first and plan lather. But you need to plan first code lather. To have a better code need to plan first and prevent from having unmaintainable code.

This style of coding is good for debugging since every thing is modular, can test only the needed parts.

Is this need?

Compilers often send weird errors not always is related to any thing
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby Lyberta » 30 Jan 2019, 06:37

The idea is that you compile each cpp file separately.
User avatar
Lyberta
 
Posts: 662
Joined: 19 Jun 2013, 10:45

Re: The Box, development tool, "Structural programming"

Postby jdc » 04 Feb 2019, 06:06

Lyberta

all stuff is linked if you read the Make file in C it is linking stuff. High level languages have automated way to this stuff, in lower level you need to do all stuff by hand. So when people say to me that a lower language does not work in a way, it is much more likely that you make a low level language work the way you wanted then a high level language because. A high level my already have a very high level of nested stuff. In a PHP framework i could't even add a array unstructured to the framwork. It only handle logic connected stuff. That's why frameworks are so heavy they add layers of processing to the raw stuff, also hard to learn because they created a new set of rules.

this post address that issue.

https://forums.ogre3d.org/viewtopic.php?t=63153
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 20 Oct 2019, 04:56

Update : 0.0.2

Now it have a proper folder structure:

the box -> files
the box external librarys -> 3d models, images,
the box external projects -> engines
the box external tools -> libraries
the box project -> stuff made
the box tutorials -> all tutorials will go to here instead of being in the forums

Instead of having stuff in a file structure inside the game, i have the idea of having separated folders, this way several games can use the same model, art, etc...

putted all relevant projects engines in to external projects , if some one is starting at least have a good code base.

Move the tutorials to have a learning base also putting code examples.

all the librarys have been moved to tools, if some one is new to C it does not need to study library's it have them in there structured to be used.

Working on a low poly library, "the_box_external_librarys/3D_low_poly" so when we start a project we will have a nice structure to start, we can fill the hole game with models we know that work to minimize errors, and then lather update. Since now they are in their own separated folder this will prevent to move models back and forward.

*There are many posts that are outdated can't delete them
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 22 Oct 2019, 06:09

I was attempting to post a clean example in several times, but may lack of experience with the language, was making it a bit hard. But now i implement it in the software can explain.

the "project" object, which is a project map the "project.h" or a scheme of the project.

So we have several links that are tools and files with functionality : projects (our projects), projects add, project list, project database, project 3d models, project images, project sounds, etc...

They all use the variables from the object or map scheme the "project.h" which I call a structure (inherit directly from file, so there is the name structure), but people are more familiar with objects. If you don't want use a object even in procedural structure a simple file, (a hierarchy delegate to other). What will happen you have no track of variables, depend on the order that you are coding, but if you go to "list projects" file there are only 5 variables of the project.h object. If you go add project, in this case maybe 20 or 30 of the object, but not all variables are there for example "project ranking" is only in "project list".

Which variable is in where? How many times will you declare the variable? Do you remember if you have declared the variable? If the variable is not in the object, or structure file, you will put it there, declare one time and all others inherit. Big confusion in just 3 or 4 files imagine large blocks of code like quake engine which are 20 megas of code. How many time you will repeat code?

People create their own mechanism to go around, but not all do so. Many projects become unusable un maintain because of something this simple. Objects create a large complexity which i think is not that needed, create high consume of resources. So i adopted the "weird style of coding" was some call it, but it works. Is just a simple hierarchy in the files.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Re: The Box, development tool, "Structural programming"

Postby jdc » 14 Nov 2019, 10:45

Now we are coding the application:

If people don't know but, in other languages the while loop in "main.c" is implicit. In here in C we have to create one. To go throw the links.

I was in the forums asking how do we do a menu?! No one was answering but is something just this simple:

while (exit_program != 1)
{
links 1
link 2
link 3

break
}

The first version will be working just in the console. At least we will have all possible stuff working, with out complex stuff. Maybe i will lather leave it this way, if people do not have a machine to run certain parts like graphic cards 3D, it still will work with some parts of the program.
jdc
 
Posts: 72
Joined: 29 Jun 2017, 16:48

Who is online

Users browsing this forum: No registered users and 1 guest