Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 287 288 [289] 290 291 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 882517 times)

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4320 on: April 09, 2013, 08:23:33 am »

You're using negative int values for ocean I take it. And that they showed up as white/yellow tells me you have an RGB color (and that it fits well tells me it probably has a byte of padding). So something along the lines of 0xXXRRGGBB will make up your 32 color bits, where X is padding. Integers are represented with 1 bit for the sign, and 31 bits for the unsigned portion. The sign bit is the highest order bit. Additionally, when counting in the negative values, you could downwards. -1 = 0xFFFFFFFF, -2 = 0xFFFFFFFE, -3 = 0xFFFFFFFD, and so on.

High values show up as yellow and white because the R and G channels are fully saturated until you go below -255 (and even still only change very slowly).
Low values show up as blue and black because the B value is able to change quickly, while again the R and G channels stay mostly constant, now at 0 and 0.
How you should set your colors is like so:
Code: [Select]
int colorValue = 0;
unsigned char red = redValue;
unsigned char blue = blueValue;
unsigned char green = greenValue;
colorValue += red << 16;
colorValue += green << 8;
colorValue += blue;
where 0 is no color and 255 is full saturation.

Making the gradients themselves is fairly easy; just pick a couple colors for the max and min, then do a linear interpolation between them based on the value.
« Last Edit: April 09, 2013, 08:25:45 am by alway »
Logged

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4321 on: April 09, 2013, 10:49:43 pm »

So a double post for something some of you may find useful/awesome.
Awesomium
It's an HTML5 based thing which integrates with native code. Incredibly simple to set up and use; great for UI.

It's built on top of Chromium, so it is literally a web browser for within your code, complete with everything that comes with that: javascript, CSS, HTML, WebGL, flash. Like any other web browser, it can access local stuff or from the internet (a group member was using it to watch youtube videos from within the game earlier today). It's awesome. It can either be tied directly to a window, allowing you to ignore handling its stuff almost entirely, or can be used to create a texture for other stuff in the application. Or in other words, you can not only use it for UIs, but you can also use it for a web browser within your game, be it a HUD element or an actual browser-in-a-texture which could then be placed in a 3D world. It allows for injection of mouse and keyboard events either from window messages and/or from code-specified stuff, giving a huge flexibility to how you use it. When it needs to update the image, it gives you a char array with the part of the texture to update, and specifies what rectangle needs to be updated with it.

Additionally, since you could in theory use WebGL with it, I'm pretty sure you could actually create something akin to a nested 3D world through a recursive implementation without any actual work (which would be hilarious and kinda awesome). :P
« Last Edit: April 09, 2013, 10:51:27 pm by alway »
Logged

Slayerhero90

  • Bay Watcher
  • Time for Taako's opinion.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4322 on: April 11, 2013, 06:58:10 pm »

I'm interested in learning how to code, but I don't know how to go about doing it, mainly with what language to use. I'm interested in making games, if that helps.
Logged
My tumblr.
Yeah no I don't haunt here anymore. Peace

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4323 on: April 11, 2013, 07:05:54 pm »

I'm interested in learning how to code, but I don't know how to go about doing it, mainly with what language to use. I'm interested in making games, if that helps.

Games can be made in any language. But good starting languages may include PHP, C#, Java, C++. That list is generally in order of simplicity to power. C++ is very powerful, but it can be very punishing, particularly in memory management. PHP on the other hand will never have the performance of the other languages but it is easy to use. The other two are somewhere in between, but they also represent decent options.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Slayerhero90

  • Bay Watcher
  • Time for Taako's opinion.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4324 on: April 11, 2013, 07:07:50 pm »

Which type would be best for someone with ideas for a sort of ascii game for practice?
Logged
My tumblr.
Yeah no I don't haunt here anymore. Peace

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4325 on: April 11, 2013, 07:29:02 pm »

I'm interested in learning how to code, but I don't know how to go about doing it, mainly with what language to use. I'm interested in making games, if that helps.

Games can be made in any language. But good starting languages may include PHP, C#, Java, C++. That list is generally in order of simplicity to power. C++ is very powerful, but it can be very punishing, particularly in memory management. PHP on the other hand will never have the performance of the other languages but it is easy to use. The other two are somewhere in between, but they also represent decent options.
Please don't start programming by learning PHP, it's the ugliest and most broken imaginable language and will cause you no end of frustration. Please also don't start learning programming in C++, it's simply not suited to learn programming (although it makes a very good intermediate language). Furthermore, please don't start programming by programming the game you have in mind, you won't make it and be frustrated to bits. Finally, don't expect learning programming to be easy or fast.

Instead, start by learning a language where you can actually write programs that fit into one file and one page (Python or preferably Perl). Learn the features of the language one at a time, and for every feature you learn, write at least two complete programs from scratch using that feature in a creative way, so you get fluent in that language. Seriously, fluency is underrated. You can't write down large coherent thoughts if you have to stop and think at every other line. Write small console-based games or demos (with emphasis on "small") whenever you know how you can do them. Using a graphical display is way, way down the line, but if you repeatedly post updates on your progress, we can tell you when you're ready for them.

Good luck, Slayerhero. May the fu be with you.

EDIT:
Which type would be best for someone with ideas for a sort of ascii game for practice?
Console-based games? Imagine me shoving Perl in your face wholeheartedly.
« Last Edit: April 11, 2013, 07:30:48 pm by MagmaMcFry »
Logged

Slayerhero90

  • Bay Watcher
  • Time for Taako's opinion.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4326 on: April 11, 2013, 08:07:06 pm »

I'm still trying to figure out what I'm doing with Perl, so I guess I'll try Python?
Logged
My tumblr.
Yeah no I don't haunt here anymore. Peace

HopFlash

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4327 on: April 12, 2013, 03:47:34 am »

yes...look into Python.

it's a relative easy to learn but powerfull programming language.
And if you want to program games then look into PyGame (http://pygame.org/) and for roguelikes you can try libtcod (http://doryen.eptalys.net/libtcod/).

There are several good Python Tutorial out there (see http://python.org).
And if there are parts in your game that need high performance then you can relative easy outsource it to c-code. But for very much stuff there are already fast libs out there in the net or the parts of the standard lib are already written in fast c-code.
Logged
GENERATION 11: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Inactive Therian Saga Char: Stormhead
Dominions: 4.03 Berytos; 4.06 Pangaea; 4.08 Arcoscephale; 4.11 Shinuyama
Inactive Wurm Online Char: Stormhead

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4328 on: April 12, 2013, 05:00:20 am »

I don't know Python but do know Perl, and would still recommend Python for games what you want to do.

Also: start small, don't try to recreate DF on your first try ;)
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Slayerhero90

  • Bay Watcher
  • Time for Taako's opinion.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4329 on: April 13, 2013, 03:10:36 pm »

As it turns out, Python hates my keyboard. And my mouse.
Logged
My tumblr.
Yeah no I don't haunt here anymore. Peace

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4330 on: April 13, 2013, 03:12:18 pm »

As it turns out, Python hates my keyboard. And my mouse.
Wait, what are you using the mouse for?
Logged

Slayerhero90

  • Bay Watcher
  • Time for Taako's opinion.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4331 on: April 13, 2013, 03:15:01 pm »

Let me elaborate: I had both IDLE and some other things going on in the background, namely Last Stand: Dead Zone. LS:DZ requires a mouse. IDLE went and inverted the functions of both my mouse and keyboard. Fixed it by restarting.
Logged
My tumblr.
Yeah no I don't haunt here anymore. Peace

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4332 on: April 13, 2013, 03:18:26 pm »

Let me elaborate: I had both IDLE and some other things going on in the background, namely Last Stand: Dead Zone. LS:DZ requires a mouse. IDLE went and inverted the functions of both my mouse and keyboard. Fixed it by restarting.
Wat
Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4333 on: April 13, 2013, 04:17:18 pm »

Rawr! mvc.net 3 and later have some really awesome features that I want to use. But I can only use them in visual studio 2008 express... which is neutered to the point you can't effectively work with anything but a local access/sql server express db.

Oh, if I try to connect to the mysql database in visual studio 2008? the server connection dialog crashes.

I've already payed for new webspace/domain to move my site to and this is frustrating me to no end.

You know what? god damn java and php are easier to use than this Microsoft shit any day. Not really, but at least i can get shit to work as documented. It doesn't matter how much you polish a turd, its still a turd even if its shiny enough to see yourself reflected in it.

Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #4334 on: April 15, 2013, 04:36:41 am »

RAWWR! (a good one this time) I have battle microsoft for the entire weekend, and I emerge victorious...

The most raw scaffolding of the dicebox is online at the new website, and I managed to transfer all* the old rolls over just fine.

http://dicebox.org/Dice/Roll/List

Oh crap, I have to be at actual work soon.

*all meaning the subset that were made since the last time i updated the dicebox. The 10s of thousands of old rolls from the early part of the last decade can't effectively be moved.
« Last Edit: April 15, 2013, 04:39:02 am by Nadaka »
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.
Pages: 1 ... 287 288 [289] 290 291 ... 796