[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/jp/ - Otaku Culture


View post   

File: 263 KB, 800x720, cirno sepples.png [View same] [iqdb] [saucenao] [google]
11308611 No.11308611 [Reply] [Original]

/jaypee/, have you ever read source code of japanese games/software?
I've been searching around, some of it is pretty damn awful
http://pastebin.com/mGZJY9gy

>> No.11308627

Some people can not into structs and encapsulation, jesus fuck, that mess of variables in a huge file.

>> No.11308643

>>11308627
A lot of the even use MSVC and Visual Studio for C development, despite the horrible C support.

>> No.11308782

>>11308627
>>11308643
I dont know what any of this means

How the fuck do you program? where do you even start with that shit?

>> No.11308795

Who actually gives a fuck though? A language is a tool and obviously they can use it well enough to make popular things.

Zun can even reuses the same engine and modifies it year after year so whatever he's doing at least it works for him.

>> No.11308807

Keep on criticizing Japanese programmers while they still make lots of cute and interesting doujins games.

This is why we can't have nice things here in the West, stop acting like assholes and start making games already.

>> No.11308818

>>11308782
https://mitpress.mit.edu/sicp/

>> No.11308830
File: 293 KB, 700x849, 1368999191598.jpg [View same] [iqdb] [saucenao] [google]
11308830

>>11308782
>>11308818
Patchy might be willing to help you out.

>> No.11308848

>>11308782
First you pick a language, there's a dozen popular ones out there to choose from.
Then you pick a compiler (it takes your code and turns it into a program you can run).

Then you write the code, its a text file so you can even use notepad.exe but you probably want something made for programming.

Then you write the logic

if (key down (right))
{
player move right
}


if (touch item(score Item))
score += amount

draw on screen(player image at position x, y)

Lots of little bits of code like that and you end up with a game or regular program

With modern computers, the barrier to get into programming is super easy because you can use high level languages that make everything simpler while still giving you enough to make a game that runs at 60fps.

Most doujin games are written in C/C++ with DirectX and usually only run on Windows.

>> No.11308861

>>11308848
>if (key down (right))
>{
>player move right
>}
Allow me to interject.

The right method would be to store all the inputs somewhere and then check the state, rather than doing it directly. Instead, he should try :

// Update function
bool keyRight = Input.isKeyDown(right);

// Behavior function
if (keyRight)
{
//logic
}

>> No.11308867 [DELETED] 

just because code is sloppy by your standards doesnt make it any less of a game. in fact i enjoy the sloppy coding, it leads tom hilarious glitches and exploits that would otherwise not be possible.

>> No.11308876

>>11308861
I store the states in an array and use a function to get the state using an index.
Its a lot less clutter than making a bool for that, especially if you only check if that key is down once in that area of code.

Also it was simple pseudo code to explain to someone without any knowledge of programming and the result is similar to your code

>> No.11309005

>>11308861
Excuse me, I happen to be a programming expert and the ``correct'' way would be to use FRP.

>> No.11309246
File: 197 KB, 614x768, 4138259419acc7a42c4ed118529b26d4.jpg [View same] [iqdb] [saucenao] [google]
11309246

Also "Software Development" by Some Guy, 199x Whichever Press
You can probably get an old physical copy for 75 cents at this point

>> No.11309278

>>11308861
If you store bool inside the update function itself it will only be accessible within the scope of that function itself, and become inaccessible in the behaviour function. You will need to make it global - at least within the scope of the program itself.
Also this heavily depends on whether you have a library that supports "triggers"/interrupts, which as far as I know is available in both openGL and directX, but for a device which supports neither you will have to code the triggers/interrupts as well then include it in your project (say, some sort of an embedded system).

>> No.11309284
File: 129 KB, 1280x720, 1374552021785.jpg [View same] [iqdb] [saucenao] [google]
11309284

>>11308611

>> No.11309314

>>11308807
>"There’s a pervasive elitism at work in the programming community. Add anonymity to the mix, and everyone is suddenly elite."

This.

>>11308848
>>11308861
>>11308876
Actually the best way is to use a mapping of key values to logic which would be O(log n) whereas if else if would be O(1) in best case and O(n) worst case where n is the number of conditional choices. Alternatively use a switch statement which makes it more trivial for a compiler to interpret the programmer's intent and optimize it to a jump lookup table which is O(1).

>> No.11309321

I bet they don't even use lisp.

>> No.11309323

>>11308861
>bool
Not ANSI C compliant; thus shit code. Would not compile. Begin extermination of yourself.

>> No.11309331

>>11309278
If the key 'K' is set the behavior function kick_ball() then you don't need to know that 'K' is pressed within the scope of kick_ball() in that particular instance.

>> No.11309332
File: 110 KB, 850x758, 1376063593601.jpg [View same] [iqdb] [saucenao] [google]
11309332

Maybe they should have spent more time reading the magicians book.

>> No.11309336

>>11309332
You can't read yourself into knowing how to do something.

>> No.11309334

>>11309332
>Lisp
>not superior Haskell
top lel

>> No.11309348

>>11309334
>Haskell
>not Fortran 2008
Checkmate atheists.

>> No.11309355

>>11309348
>Fortran 2008
>Not just plain ASM
Look at this code monkey.

>> No.11309357

>>11309332
Maybe someone should make a game where Patchouli teach you SICP fundamentals. Maybe it'll motivate people.

>> No.11309358

Who is the John Carmack of Japan, /jp/?

Oh wait, there isn't one, because they're shit.

USA.
USA.
USA.
USA.

>> No.11309368

>>11308627
Encapsulation is for retards. So are everything else that OOPLs feed you. Fuck off.

>> No.11309367

>>11309355
It's hard to believe somebody could be that stupid by suggesting a non-portable architecture-specific language is superior.

Not to mention that compilers are generally better at assembly than humans by several orders of magnitude.

>> No.11309370

>>11309367
Surely compiler's don't write themselves.

>> No.11309379

>>11309358
To be fair most Japanese aren't that good at English and most of the scientific papers and journals are published in English whether they're from the USA or not.

That means people like John Carmack have access to a lot more stuff than the Japanese.

>> No.11309378

>>11309367
>Complains about portability
>Suggests Fortran
topest kek

>> No.11309381

Is the joke in OP's image that only bakas use obtuse, bloated, poorly designed languages like C++?

>> No.11309383

>>11308611

Is this picture trying to imply that C++ is a horrible language? That it's made more horrible by the fact that a lot of substandard programmers use it, to the point where it's much much easier to generate total and utter crap with it? And that quite frankly, even if the choice of C were to do *nothing* but keep the C++ programmers out, that in itself would be a huge reason to use C?

>> No.11309389

>>11309381
No, the joke is that bakas usually start with cpp thanks to the retarded curricula in most universities.

>> No.11309385

Is there any 2hu, who knows a lot about programming? Except Patchy.

>> No.11309388

>>11309381
>>11309383

holy FUCK

>> No.11309391

>>11309355
>ASM
>needing machine translation to write 0s and 1s
step up son

>> No.11309392

>>11309383
No, I think it is suggesting that Cirno is an idiot savant and is really good at programming.

>> No.11309394

>>11309385

wouldn't be surprised if nitori had a bit of experience with embedded programming

>> No.11309401

>>11308627
It's C++. It's far worse. These people can't into fucking Object. They should lay down and die.

>> No.11309398

>2013
>not using Rpg Maker VX Ace or Game Maker Studio to makes games
Decrepit old conservationists detected.

>> No.11309399

>>11309378
Fortran is one of the most portable modern languages though.

>> No.11309402

>>11309355
Ah, fellow assemblerfag. What do you write in, ARM, MIPS, x86, 68k? Studying at&t x86 myself along with gas, it's quite enjoyable.

>> No.11309405

>>11309401

I want Java and C# devs to leave

>> No.11309409

>>11309385
Rika, probably.
Maybe Yumemi and Rikako, depending on which SCIENCE fields they know. They've all likely done a bit of Matlab and CAD, for instance.

>> No.11309425

>>11309331
I don't think we're thinking of the same program structure.
I'm thinking of the loop - behaviour function and drawing forms a loop by itself, then when a key is pressed the OS-link layer will call a function that you can override - something like glutKeyboardFunc, where the program loops itself until some interrupt happens, like a keypress. I store the keypress inside a boolean value, then I wait for the behaviour function to loop around again, which will check whether the value is true for a keypress.
I think you're talking about a different structure of things - the same interrupt whenever a key is pressed, but you invoke the behaviour function direct at the end of the interrupt function (probably with keyright as one of the arguments) instead of waiting for the behaviour function to loop around again.
Am I on the right track here?

>> No.11309427

>>11309402

I have experience with x86, but I write predominantly ARM.

>> No.11309432

>>11309370
No, of course not, that would be silly.

Compilers are written by compiler compilers.

>> No.11309457
File: 97 KB, 600x800, 7zcYA.jpg [View same] [iqdb] [saucenao] [google]
11309457

>DrawGameScleen
This is cute code.

>> No.11309468

>>11309425
No I think you're way off there. It actually sounds like you're trying to implement low level keyboard listener utility functions for your program and then handle the processing directly yourself.

Regardless of implementation I assume that when you get around to programming the actual game there is some form of stream, stack, or pump that provides input whether the OS provides it, you implement it yourself, or use a library that handles hardware input.

Store the key presses in any way you like. Then run the function that belongs to the key press. No need for global variables.

If you have a function that handles something asynchronously to the rest of your program and updates a global variable used by other parts of your program then it gets messy especially if you interrupt. You introduce undefined behavior or will also need to implement something like a mutex lock so that once updated it can't be changed until it has been checked.

>> No.11309469
File: 85 KB, 400x468, 1341911284131.jpg [View same] [iqdb] [saucenao] [google]
11309469

I can assure you OP, a lot of western game code is just as bad, if not, worse.

>> No.11309504

>>11309468
Ah, so instead of doing something like "overriding the function that gets called by glutKeyboardFunc", you have that interrupt function pump the key-related-events into a buffer/stream/stack/queue/whatever you want to use/call it, then read (in some sort of order, stack would be FILO, etc) and empty the buffer whenever the behaviour function is called.
In this case, the buffer itself is the global variable.
Or am I still off?

>> No.11309559

>>11309504
The main idea is to keep the rest of your program quiet so have it set up something similar to a state machine with a simplified logical model of your hardware. That way you separate the rest of your program from directly interacting with hardware and all the problems that come with it.

Ideally your main loop should only handle messages by calling whatever function maps to the message.

You don't have to make it global but it should be accessible to your main loop.

>> No.11310689

Man, fuck lisp
why does sicp have to teach through lisp

>> No.11310696

My SICP just came today. Am I going to become an expert programmer?

>> No.11310740

>>11309389
Jokes on you my uni starts with Haskell!
And then probably goes later with C++ because of company agenda, fuck them

>> No.11310750

The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will understand what is lacking in most other languages.

When you start a Lisp system, it enters a read-eval-print loop. Most other languages have nothing comparable to read, nothing comparable to eval, and nothing comparable to print. What gaping deficiencies!

Lisp is no harder to understand than other languages. So if you have never learned to program, and you want to start, start with Lisp. If you learn to edit with Emacs, you can learn Lisp by writing editing commands for Emacs. You can use the Introduction to Programming in Emacs Lisp to learn with: it is free as in freedom, and you can order printed copies from the FSF.

To study Scheme, and a deep understanding of program structures using Scheme as a vehicle, I recommend Structure and Interpretation of Computer Programs, by Abelson and Sussman. This too is now free as in freedom.

>> No.11310751

>>11310689
They have a python version.

>> No.11310791

>>11310689
MIT ditched lisp for python (faggots), like this >>11310751 anon has said.

>> No.11310803

>>11310791
Good riddance, no one uses lisp.
At least python will be valuable as an asset when they start looking for jobs.

>> No.11311044

the fuck? did everyone go to devry here?

>> No.11311061

>not learning c

>> No.11312234

>>11309409
>>>11309385
>Rika, probably.
>Maybe Yumemi and Rikako, depending on which SCIENCE fields they know. They've all likely done a bit of Matlab and CAD, for instance.
Real tohos pls

>> No.11313408

>>11310740
The jokes on you because you could have learned 5+ different programming languages before even going to university.

People that need university to teach in this day and age them are probably always going to be shit. So it's actually nice of them to give you some job security.

>> No.11314348

https://www.youtube.com/watch?v=x1TsOHyJPpw

>do I need to know C++?
>no
>I thought you were looking for a C++ programmer
>we are

>> No.11314350

>>11313408
A lot of people are too unmotivated to self-study.

>> No.11314376
File: 28 KB, 380x247, tom_delay.jpg [View same] [iqdb] [saucenao] [google]
11314376

>>11308611
>This paste has been removed!

>> No.11314382

>>11314350
That's a huge shame really because when you get down to it even if you went to university for just one thing and not several loosely related things you would only end up with enough hours to warrant intermediate competency at best.

For programming in computer science you would still be a beginner after a 3 year program, if you don't do stuff in your own free time.

>> No.11317620

>>11308611
>http://pastebin.com/mGZJY9gy
>This paste has been removed!

>>
Name
E-mail
Subject
Comment
Action