It is currently Sat Jan 21, 2017 8:24 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 144 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10  Next
Author Message
PostPosted: Sat Dec 10, 2016 8:02 pm 
Offline

Joined: Mon Jul 02, 2012 7:46 am
Posts: 757
For graphics to be referenced in code, I forgo ASCII/hex representations and just output a binary file with a corresponding .inc file that defines a label and a size viable and then includes the binary file.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 4:55 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 283
koitsu wrote:
Yet, when it comes to the actual development process, whinging begins: "There isn't a C compiler! There's no PNG or JPG file support! How am I supposed to do all these graphics? Oh my god, ASSEMBLY LANGUAGE? Are you kidding me?" -- speaking generally here, not of you. These may be thoughts or feelings of the same person who intentionally chose they wanted to work on 20-year-old system.

You can't have your cake and eat it too when it comes to this. And I believe it to be truth -- the proof lies in the large number of indie games on Steam etc. that try to achieve a "SNES-esque 16-bit look" (aesthetically) but aren't on the actual SNES. Did they consider the SNES to develop on? Probably not (instead people just want "the look" because it's the hip/trendy thing), but there are certainly those who did, and shied away from it. Therein lines the conundrum: you can't blame the lack of a C compiler for the 65816 or SNES when a person chooses the console to develop on consciously. Maybe this is a chicken-vs-egg problem.

I'm not following your logic here. If a person goes "I'd like this game to run on the SNES", takes a look at the system, and stops due to the lack of a C compiler, how is it not due to lacking the compiler?

Do you mean to imply that the compiler is just an excuse, and they would give up due to other reasons if it existed? The Genesis scene is proof against that.

Quote:
And I'll again point out: even if you were to use C on the 65816 (or 6502/NES for that matter), to debug you STILL need to know assembly. There is no avoiding it; this fact cannot be ignored.

I've replied to this before, and byuu did as well. It's not true, barring compiler bugs.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 5:39 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 424
Location: Sweden
Espozo wrote:
Kismet wrote:
Espozo wrote:
I think the fact that even I know ASM (albeit, after loads of help) invalidates any argument that says it's too difficult to understand. :lol:


That's because High school and College programs that involve programming use Java (and have been since 1998.) Looking at the local University's webpage they only mention Java and Python. Java has no Assembly code to look at, and neither does Python.

Sad world. :( I guess that's better than my high school though; there isn't even a programming class. :lol: Assembly was the first (and only) thing I know. I still imagine it's easier to get into assembly after learning a higher level language than to have no programing experience, or do you still have to start from scratch?

I'm glad my high school taught me C++, it's one of the most useful languages to learn I think. You are forced to learn more about how computers work and it also has a common syntax used by many other languages, besides being very useful on its own. It's always easier to learn a new language the more programming you know before it (this goes for anything, it was much easier for me to learn Chinese because I already knew Swedish, English and Japanese which minimized the number of times I was shocked due to encountering a totally new kind of grammatical construction and the like), but learning a higher level language simply as a stepping stone in order to learn a lower level language and never use the higher level one again is a waste of time in my opinion. Sure you learn programming logic but you also waste a lot of time to learn a bunch of language-specefic things that you don't have any need of. In that case it would be better to just learn everything from the lower level language directly.

On the other hand, breaking down real applications (of anything) into abstract, "dumbed-down" components is a valid way of learning. For example in martial arts you first learn to use abstract movement schemes (kata and similar exercises) that, although not always directly realistic, contains ideal angles and muscle tension at ideal timing. At the same time they build up muscles, speed, breathing techniques and motor skills. When the body have stored this information correctly in muscle memory (after lots of repetitions and corrections), it is then easy to adapt a single one of these abstract component into many kinds of techniques (that needs to be practiced on its own as well though) that they form the basis of.

Back to programming, I don't know if high level programming can be used as a form of kata, or if low level programming is better suited for that. But I think it's best to focus on languages that you are interested in learning and that may be useful on their own.

BTW my C++ class was full of morons that had no will to learn anything. I'm probably the only one that learned to program C++ from it, not mentioning passing the course.


tomaitheous wrote:
Pokun wrote:
But how do you go and create the pcx files in the first place? No respectable image editor seems to be willing to even touch that format with a pair of pliers anymore.


Photoshop, Gimp, and a bunch of top tier open source graphic editors support it. Not sure what you mean.

Huh? You are right, I have no idea why I got the impression that it wasn't supported before.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 8:12 am 
Offline

Joined: Mon Mar 27, 2006 5:23 pm
Posts: 1230
Pokun wrote:
BTW my C++ class was full of morons that had no will to learn anything. I'm probably the only one that learned to program C++ from it, not mentioning passing the course.


C++ is a language for people who enjoy the art of programming for the sake of it.

It's no surprise at all that people who want to do the bare minimum and get paid the most for their work hate it.

It's the violin of the programming world. Most people are happy to play guitar tabs (Java), and few people can make a violin sound nice. And it really doesn't help that C++'s default standard library is entirely out of tune, and the bow string it comes with is made out of barbed wire.

The key to turning C++ into a diamond is ignoring both the haters and the so-called "experts."


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 4:02 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 4605
Location: Canada
Pokun wrote:
tomaitheous wrote:
Pokun wrote:
But how do you go and create the pcx files in the first place? No respectable image editor seems to be willing to even touch that format with a pair of pliers anymore.

Photoshop, Gimp, and a bunch of top tier open source graphic editors support it. Not sure what you mean.

Huh? You are right, I have no idea why I got the impression that it wasn't supported before.

I think web browsers are the big holdout for PCX support.

As a format, it doesn't really offer much advantage these days. If you just want raw data easy to work with TGA is probably easiest, followed by BMP, which is almost as easy and more common. If you want small data, you'd probably prefer PNG or sometimes GIF (now that its patent has expired).

PCX was popular during a time where we needed reasonably good compression that was still easy to implement and performed well with very modest resources (i.e. RLE). BMP technically had an RLE compression option (TGA too), but this extension wasn't widely supported. PCX was the one where RLE was its standard compression method.

These days, though, there are lots of good image loader libraries that handle PCX and a bunch of other formats. It should be easy enough to work with PCX for old processes, but if you're working on a new process for something it would seem like a bit of an "archaic" choice for format?


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 5:07 pm 
Offline

Joined: Wed Nov 30, 2016 9:59 pm
Posts: 27
rainwarrior wrote:
I think web browsers are the big holdout for PCX support.



There is a specific reason why web browsers support what they do. If only one web browser supports something (eg APNG, MNG), and nobody else does, the feature gets dropped.

Originally web browsers only supported JPG and GIF. The former was lossy and everything looked like garbage at 640x480 anyway. GIF was lossless, and could be animated, but was limited to 256 colors. There was no happy medium of lossless, non-animated, not patent-encumbered, true-color images. So PNG support eventually wound up in web browsers, but because MSIE didn't support the transparancy, nobody supported the transparency for a really long time.

Then comes google with it's microsoft-like attitude. WebP for everyone. What does WebP do? Nothing that JPG or PNG couldn't do, and by default it's more like JPEG. Go ahead and try to find libwebpdecoder by itself. Unlike PNG and GIF, it is threaded, and unlike JPG it can do lossless and some gif-like animation.

So what do you all think newbies are going to try and do with it? Yes, they will try to render animations to webp and use those as sprites in their HTML5 games. Bad idea. Unlike MNG, which was closer to a container for "muiltiple images" perfectly suitable for sprites, webp is just webm scaled back. So if you want to loop the same 2 seconds of video, that's exactly what you'll get. I've seen this kind of thing before back in some early 2D SNES-like RPG maker software, and also later with adventure game studio. The result is not good, and brings beefy desktops to a crawl because everything is being done in software on the CPU.

In the context of the SNES, at best you can get away with RLE without a performance impairment. If you want to get fancy you can do some lz compression of text and some kinds of bitmaps, but it comes with more loading time penalties.

Audio is an even worse monster. The SNES's APU is it's own separate cpu. So you're kinda at the whim of what the SPC700 can support, so when someone goes "gee I want to play that mp3/aac/flac/wav file" you can't just upload it and play it. The web browser's do not have any standard audio file or music file support. In the RPG Maker community, the latest MV version creates HTML5 games, but if you want to make a version that works on everything, you need to export the audio twice, once as mp3 and once as aac. You know what users of that software have a problem doing? Making sounds smaller so that the browser doesn't take 20 seconds to download, decompress and store in memory.

So yeah, web browsers are a holdout, but they are also the most sloppy things to code anything for. Look at it this way.
A web browser takes 1GB of ram, supports 95% of the stuff people want to do, but does all of it rather poorly. The web browser is trying to be the new "OS" layer.
ASM ->C libraries (dozens of them) -> C++ libraries/frameworks -> GUI ->DOM ->Javascript. To do one thing, you have to go through no less than 6 abstraction layers, and that doesn't include the OS and drivers. If someone is hellbent on using JQuery, or other javascript frameworks, that is yet more overhead.

If it feels like computers keep getting faster but software keeps getting slower, that is in fact what is happening. Throw cloud computing on top for yet another entire machine fabric's worth of abstraction.

_________________
I come from the net. Through systems, peoples and cities to this place.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 5:56 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 17603
Location: NE Indiana, USA (NTSC)
Some of the abstraction of the "web platform" exists for two reasons. One is to make convenience reasonably safe, as the other option requires users to download, elevate, install, and launch the program from the native menu. The other is to reach users of Windows, macOS, X11/Linux, iOS, Android, and possibly even game consoles without having to remake the thing five or more times using five or more platforms' C libraries and recurring payments for developer certificates for many of these platforms. Unlike web development, which has free and inexpensive domain-validated certificates, code signing certificates recognized by popular operating systems are at least organization-validated. This means there's no counterpart to Let's Encrypt for code signing.


Top
 Profile  
 
PostPosted: Sun Dec 11, 2016 5:57 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 4605
Location: Canada
Kismet wrote:
There is a specific reason why web browsers support what they do.

Yes, I absolutely didn't mean to imply that web browsers should have PCX. I just meant that I think they're the most visible place where they are conspicuously not supported.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 2:21 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 424
Location: Sweden
I don't remember where I got the impression that Gimp and Photshop couldn't do PCX out of the box (it was probably about a year ago I last touched SNES development). But yeah PNG is probably the image format of choice nowdays.

PCX2Snes actually works now! I also found nconvert that can be included in the compiling tool chain to convert PNG to PCX (my favourite image editor iDraw only does PNG and BMP). A bit clunky tool chain but it works until I'm ready for the dreaded Python.

byuu wrote:
Pokun wrote:
BTW my C++ class was full of morons that had no will to learn anything. I'm probably the only one that learned to program C++ from it, not mentioning passing the course.


C++ is a language for people who enjoy the art of programming for the sake of it.

It's no surprise at all that people who want to do the bare minimum and get paid the most for their work hate it.

It's the violin of the programming world. Most people are happy to play guitar tabs (Java), and few people can make a violin sound nice. And it really doesn't help that C++'s default standard library is entirely out of tune, and the bow string it comes with is made out of barbed wire.

The key to turning C++ into a diamond is ignoring both the haters and the so-called "experts."

We where all new to programming but I think many people in my class had gotten the impression that programming involved some kind of graphical interface with pointing and clicking, and that games were easy to make. When they realized the harsh reality they just lost all their will to learn. This is a common attitude in Swedish schools. The Swedish school system is going down the drain, and the authorities just pretends that we are the best in the world and that there is no problem... Bah!

tepples wrote:
Some of the abstraction of the "web platform" exists for two reasons. One is to make convenience reasonably safe, as the other option requires users to download, elevate, install, and launch the program from the native menu. The other is to reach users of Windows, macOS, X11/Linux, iOS, Android, and possibly even game consoles without having to remake the thing five or more times using five or more platforms' C libraries and recurring payments for developer certificates for many of these platforms. Unlike web development, which has free and inexpensive domain-validated certificates, code signing certificates recognized by popular operating systems are at least organization-validated. This means there's no counterpart to Let's Encrypt for code signing.

This is probably exactly why RPG Maker MV uses HTML5 and JavaScript. They ditched the RTP too (a run time package that you needed to install in order to play RPG Maker games earlier). I guess they assume people have faster computers with more harddisk space nowdays.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 10:27 am 
Offline

Joined: Mon Jul 01, 2013 11:25 am
Posts: 214
Well at least i can speak about my own experience.
I did lot of assembly back in time (mainly x86 but i touched also many other CPU) as i was really obsessed by performance. But with time i realized than assembly was a real pain to maintain and doing everything in assembly is just a *huge* waste of time compared to higher level language (as C). In almost case only 5% of the code is really performance critical so only that part need to be wrote in assembly if required.
So when i started to get interests in Megadrive programming, I immediately considered to code in C and i searched for a good C compiler for the Sega Megadrive. I started with SDCC which was terribly broken and bad... then i realized GCC was existing for m68K target so i compiled an old version of GCC which delivered "good enough" compiled code so i could use it for real development. And honestly without that GCC compiler i would have *never* attempted to do anything serious on that system...
I understand that with 8 bits systems you can eventually consider full assembly, because the system is so limited and C compilers are so bad you can't get anywhere, also project size is more limited so it's less problematic. But on a 16 bits system you should be able to stay with C for 90% of the code and only use assembly on critical parts...
I tried to code for the SNES but the fact there is no good C compiler was a terrible penalty for me, still i tried to use PVSnesLib and it was not that bad... but the SNES complex hardware and the poor performance and the compiled code ruined my motivations :p

Another point is that the language is nothing without a SDK, for me C is also good to provide a friendly and comprehensive API compared to ASM.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 11:19 am 
Offline

Joined: Mon Mar 27, 2006 5:23 pm
Posts: 1230
rainwarrior wrote:
Yes, I absolutely didn't mean to imply that web browsers should have PCX. I just meant that I think they're the most visible place where they are conspicuously not supported.


PNG is unfortunately a rather complicated format to implement. Specifically due to the use of the deflate algorithm, and the not-very-useful Adam7 deinterlacing. Paeth is weird but not that difficult.

I think it'd be very easy to write a format that's only a little more complicated than PCX, and results in files only a little larger than PNG. But of course there's no point since no one would use it (hi, BPS!)

Still, I'm always disappointed at complexity creep in file formats, protocols, etc. Now they're talking about using full-on video codecs to encode images on the web (eg WebP). FFS.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 11:25 am 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1966
If a compiler can optimize code for 16 registers, couldn't it also optimize code for just one?


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 12:05 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 5185
Location: Seattle
Yeah, it could, but it's a whole different league of difficult.

As a simplistic metaphor, consider the Tower of Hanoi puzzle. With a single "register", by which we mean "only one disc at a time", it takes 2ⁿ-1 moves to move a n-tall stack from one pile to another. But with n registers, it becomes trivial.


Top
 Profile  
 
PostPosted: Mon Dec 12, 2016 5:11 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 1966
I think I have an idea of how the optimizations would be done.

Code:
Step 1:
Divide code into uninterrupted blocks of code.

Step 2:
Simplify arithmetic, such as:
a + a = a << 1
a - a = 0
a + 0 = a
a + (b + c) = a + b + c
a - (b + c) = a - b - c
5 + 2 = 7

Step 3:
Rewrite code so that brackets () get replaced with temporary variables:
a = b & (c + d)
gets rewritten as:
temp1 = c + d
a = b & temp1

Step 4:
Reorder arithmetic/logic functions so that the first variable of the current line matches the destination variable of the previous line when possible:

Examples:
a = b | c
d = e & a
gets rewritten as
a = b | c
d = a & e

a = b | c
d = e - f + a & g
gets rewritten as
a = b | c
d = a + e - f & g

If it can't reorder code to have the destination to the previous line match the first variable of the current line, then match it with the most recent matching destination variable.

Step 5:
Allocate variables to A, X and Y

a = b | c
d = a & e
gets rewritten as
A = b | c                // A = a
a = A                     // A = a
A = A & e               // A = d
d = A                     // A = d

a = b | c
b = b + d
d = a & e
gets rewritten as
X = b                     // X = b
A = X | c                // A = a, X = b
Y = A                     // A = a, X = b, Y = a
A = X + d               // A = b, Y = a
b = A                     // A = b, Y = a
A = Y & e               // A = d, Y = a
d = A                     // A = d, Y = a
a = Y                     // A = d, Y = a


Top
 Profile  
 
PostPosted: Tue Dec 13, 2016 3:19 am 
Offline

Joined: Mon Jul 01, 2013 11:25 am
Posts: 214
As Byuu proposed, you could eventually try to write a customized/simplified compiler (using a syntax similar to C for convenience) specifically for the 65816 CPU. The optimizations psycopathicteen is speaking about are well known in compiler lands, you can probably use GCC to produce intermediate code and only do the last part to translate the GCC intermediate code to 65816 assembly (which is still a huge task).
https://en.wikipedia.org/wiki/Intermedi ... esentation
http://www.montefiore.ulg.ac.be/~geurts ... tecode.pdf


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 144 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group