Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

OOP would work fine for a text adventure, such as Inform6 against the Z-Machine, which pretty much the gameplay rooms->objects it's perfect for this. For everything else... well... maybe just CLOS it's usable enough.


The MUD-family of games are usually built in a C-like OOP-language, LPC. I think it's rather nice.


Under Inform6 the inheritance and OOP features are literally that, objects have attributes and you can create in-game objects (rooms are objects too) which are instances of defined ones. Such as always 'lighted' rooms, a furniture class by defining as object as 'scenery' (you can't take it).

That's an elegant example on coding Inform6 which transpiles against the Z Machine, but overall I won't use OOP outside gaming.


Rather similar, then.

I've come across GUI and a database where I thought object orientation was nice, and I'm also fond of contemporary Smalltalk-like languages. I've made peace with Java, but if I have a choice I'll be in something Lisp-like or logic programming. Racket, Elixir, Scryer, that sort of thing.


Indeed, yes. You can create a text adventure with very little logic in place, by setting the winning flag when very few conditions match. Everything else it's predefined with objects with attributes. But, OFC, some small logic it's done to add realism to the game. Such as a TV showing messages upon entering a room, and so on. But compared to any other language, Inform6 makes that almost like editing a config file.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: