Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 449 450 [451] 452 453 ... 795

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

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6750 on: December 01, 2014, 10:11:48 pm »

There's a thread for it in the modding forum.
Best place to start would be to download the source and read through the existing plugins.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6751 on: December 01, 2014, 10:16:18 pm »

The closest you can probably come is reading the source code for something like DFHack: https://github.com/DFHack/dfhack

It's going to probably be hard to follow though and I've never peeked very closely myself.  I believe that DFHack at least uses a modified DLL file that DF loads (SDL.dll I think).  By doing this, DF will load DFHack's code into its own address space and make it possible to do memory modifications more easily and safely.  From there it's largely a matter of deciphering what the memory layout is, for which there is this.  When it comes to modifying the runtime behavior of DF, such as introducing binary patches or calling game code, I'm not really sure how it works.  There's some complexity involved with vtable pointers that I don't know enough about the lower level implementations of C++ to really understand that well.  That's for virtual class members anyway, so far as I know it's entirely possible that the entry points to most other functions aren't even known because they could be optimized in various ways.
Logged
Through pain, I find wisdom.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6752 on: December 02, 2014, 05:52:22 am »

Databases are very strange...

My dad offered a sort of job to make a thing that records information and runs analysis on it on demand, and I'm hesitant to do it because (1) databases are hard, and the easiest database (MongoDB) also has many problems like unreliability and performance, (2) my language and framework of choice (Python/Cherrypy) might be too slow to handle large scale operations (3) not sure if I can finish it :P
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6753 on: December 03, 2014, 12:23:55 am »

Hey I'm thinking of making a browser game or two on paid hosting, and I'm wondering what languages or frameworks people would recommend to set that up on the server end (it's a unix-based server, probably linux) ? Turn-based sort of thing, but an in-game chat system is a goal too.

One main thing is I want to have a nice robust user-accounts system with the usual bells and whistles like email verification and using social media like Facebook as your login option.

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6754 on: December 03, 2014, 12:35:50 am »

I know that libraries exist to do the shared login stuff for PHP, but I don't know if I'd want to build a game backend in PHP, especially with chat.  I assume you want to do something with web sockets?  That would be ideal for the chat features and wouldn't be bad for the other aspects.  JavaScript with Node.js is probably the easiest way to get a web socket server running, but on Linux it won't be so bad with Python either.

PHP actually might not be so bad for a turn based game if you just do it with AJAX and use a database to store persistent data.  It depends on how responsive it needs to be and if you need to keep a lot of global state accessible to all clienets.
Logged
Through pain, I find wisdom.

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6755 on: December 03, 2014, 01:04:11 am »

No experience on the matter (though it's something I'm interested in) but I've heard good things about node.js and socket.io.

There's probably a wrapper for node.js in Python or C# or whatever if you are sensible and don't want to use Javascript.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6756 on: December 05, 2014, 04:22:09 am »

It appears that I'll want to learn C++ now. I wasn't really planning on that for a while, but hey :D

Anybody know a good tutorial?
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6757 on: December 05, 2014, 04:49:33 am »

Haven't needed a tutorial in a long time, and back then it was a textbook. Try something from this list of tutorials:

https://www.udemy.com/topic/C-plus-plus-tutorials/

Working through one or two of those should be enough. Once you have the basics down there's the whole issue of the best way to solve particular problems, but that's not something most tutorials cover.

My main advice is: don't use the inheritance mechanism very much. Use data inside objects to customize behavior instead of inheritance (those data are objects themselves though). When you learn about object oriented design there's a tempation to make everything into deeply-nested inheritance trees. This is just a bad idea for effective programming in general.

Design pattern theory is the next step after basic c++. Sample link:

C++ Programming/Code/Design Patterns

Design Patterns aren't tied to any language or even object-oriented languages, they're best-practice general structures to solve specific problems. There are a lot of patterns available, and they basically structure how to think about specific problems so that you're not re-inventing the wheel or making stupid newbie mistakes. There are a lot of known patterns, but like many things, some are more common than others, and you'll end up rolling out the same few patterns for 90% of things you need to make.

If you're doing a programming olympiad, you would probably benefit from knowing this approach to program design.
« Last Edit: December 05, 2014, 04:57:37 am by Reelya »
Logged

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6758 on: December 05, 2014, 05:02:02 am »

Most C++ tutorials will also teach you the older C++'98, not the new C++'11 or C++'14. As a general rule, in modern C++, you should avoid ever using "new" and "delete" (once thought to almost be the defining characteristic of C++), and instead use std::make_shared<T>() and std::make_unique<T>(), which return "smart pointers" (std::shared_ptr<T> and std::unique_ptr<T> respectively) which will delete the object for you when it's no longer referenced.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6759 on: December 05, 2014, 05:30:54 am »

dude ... malloc, free and sizeof(type) are the only memory tools you need.

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6760 on: December 05, 2014, 05:39:29 am »

Unless you need to worry about alignment... both malloc and new don't handle that at all, which is total crap.

There are custom-allocator versions of both make_shared (allocate_shared) and make_unique (surprisingly, allocate_unique) which are far superior if you really need fine control over allocation (e.g. using a pool). But if you don't have to write it, why bother? delete/free don't know how you allocated the object, and so can go disastrously wrong at deallocation time. The smart pointers track that too. Use smart pointers, get less bugs. Win!
« Last Edit: December 05, 2014, 05:44:04 am by Thief^ »
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6761 on: December 05, 2014, 06:33:07 am »

I think that was sarcasm.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6762 on: December 05, 2014, 06:35:20 am »

Yeah I did think so, but it was a good opportunity to rant about the fact that new doesn't allocate at the right alignment for the type you're creating. Seriously?
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6763 on: December 05, 2014, 08:33:35 am »

On the note of tutorials, anybody know some good ones for javascript that are aimed towards developing more fully fledged apps? (rather than simple page interactivity)
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #6764 on: December 05, 2014, 09:08:49 am »

You could try the Angular.js or jQuery tutorials. Those two frameworks are widely used in web apps and I think their tutorials are leaned to the practical side.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward
Pages: 1 ... 449 450 [451] 452 453 ... 795