Intel sponsors gamedev.net search:   
Adventures in Text-modeBy Twisol      
In order of no progress to done: Red, Orange, Yellow, Blue, Light blue, Green, Light green.

Last updated 2/12/09 at 12:01 am PST

Cripes! 2.0 -- See the Class Layout

Arenamatic Code w/ cConsole


Saturday, October 25, 2008
I haven't really done anything with ExplorerMUD lately, mostly because I want to try to understand boost::asio first. So it may be at least a week before I actually get something working. I'm sure it'll be worth it though.

In other news, I came up with a brilliant - at least, I think it is - storyline for a book, so I've been spending some of my time writing that out. My lips are sealed, though I may say occasionally if I've finished a chapter or something. :)

Lastly, while using the wonderful Pandora.com, I discovered a relatively new artist, Owl City. I'm listening to both albums pretty much non-stop right now... I'm sure I'll get sick of them eventually, but for now they sure keep my spirits up. I highly recommend "Designer Skyline" and "The Saltwater Room".

~Jonathan

Comments: 1 - Leave a Comment

Link



Thursday, October 23, 2008
I'm taking a Beginning C++ class at my community college right now. It's very basic, no classes or objects yet, even - that's for the next class - but it sort of helps when you have to do certain things. I'm definitely learning some minute details.

With my experience beforehand, though, I'm acing this class handily. Woohoo!

No further progress with eMUD yet, I'm giving it a day to rest. Though here's a free plug to Achaea, the MUD I play all the time. Check it out if you want to get an idea of a high-quality MUD. eMUD will take a lot of ideas from Achaea, mostly because it's such an awesome system, and also because I don't want to have to get used to something else unless it's superior.

~Jonathan

Comments: 0 - Leave a Comment

Link



Wednesday, October 22, 2008
ExplorerMUD is very volatile right now. Nothing's really laid in stone, and things change drastically every other day. Like today, I'm going to be replacing my Thread system with boost::asio.

Off-topic, why is it that everything I make that I think is "good" is sooner or later replaced by something better? *mutter* Worked the same with cConsole, if you remember: I replaced nearly the entire output side of things with three simple iostream manipulators which called Win32 functions. And "the entire output side of things" was pretty complex...

Anyways, I'm working on learning how exactly to use boost::asio for ExplorerMUD. One thing I immediately noticed is connect_pair. I think it's a POSIX-defined function anyways, but I had never heard about it until now anyways. I'd been trying to come up with a simple way to connect two sockets so my commandline and listener threads could communicate. This is massively simple, and I'm very happy. :)

Hopefully boost::asio will simplify some things. I'll still need to create Client objects for each connection and such, but now I don't think it will be so klutzy.

~Jonathan

Comments: 0 - Leave a Comment

Link



Tuesday, October 21, 2008
Alright, so I've been working on a command line back-end to ExplorerMUD. It's in its own separate thread so I can get input from the person running the server at the same time as other stuff is going on. I can probably merge it into the same thread as the listener now, since I'm select()ing on stdin anyways, but that's beside the point.

The problem: I need to be able to retrieve input from stdin without blocking, and I have to do it without cin because cin just doesn't work like that. If you cin.getline() or cin>>, it waits until the next enter-press even if there's text waiting already, because it wasn't TECHNICALLY <s>waiting</s>blocking for input at the time. It does get the text, but only after you hit enter again, which leaves a newline in there or some other junk, which you'll retrieve next time you enter something... it throws everything off.

Then I found a link that described how to turn off canonical mode on the terminal. It worked, but ugh, no backspace or anything? In fact, the mere attempt at a backspace puts an ugly character in you really don't care about instead of backspacing? There has to be a better way.

Using fcntl to set stdin to O_NONBLOCK, then getting the input char by char with fgetc() worked. So simple, yet so beyond me at first. What a noob! :D

~Jonathan

Comments: 6 - Leave a Comment

Link


I had to send my laptop in for repair recently, not to mention - if you haven't noticed - development has ground to a halt anyways. If and when I get back to Cripes!, I'll be doing an overhaul of the design, anyways.

My latest project is - of course - a MUD. How obvious... Well, I may as well post a bit of what's going on with that.


ExplorerMUD

((yes, that's what it's called >_>))

I'm going to try to work with a modular, object-oriented design. At the moment all I've got running is a basic listening server which creates a new thread for each client, sends "Hello World!" to the client, and disconnects. That's probably a good thing, because I left it on once when I went to school, and I had a connection from some person in Peru when I got back... what the?

Before I go on, I realized something about access specifiers and inheritance, which actually is very interesting and useful, although probably somewhat obvious if you think about it... a class with private and public members can be instantiated, and it works like you'd think, right? I don't really need (or want) to explain that. If you derive from that class, the public members remain usable within and outside the derived class, and the private members can't be used directly in either. But if the inherited public members access the private members, they still can! Like I said, it's obvious, but not really - in my case at least - something you'd think about most of the time.

This is one of those things where you have a - ha ha - paradigm shift. I've always thought (yes, I'm stupid), "what's the point of deriving from a class with private fields? If you can't use those it breaks the class." Well see, this is why it's useful to do that. It's another layer of encapsulation.

So, I've created a Thread class which can be used a bit like a Java thread: you just derive from it, and implement a Main() function. There's some encapsulated Thread info, like the thread ID, inside the base Thread class, but it's private so not even its derived classes can access it. But it defines protected and public members so they can be reached in some manner or other. There's a Start() function defined in Thread, for example, that starts a new thread as well as storing internal data about the thread. It starts the thread under a private member, Go(), which essentially encapsulates some ugly thread-specific calls and allows the virtual Main() to use the return keyword instead of, say, pthread_exit().

When you derive a Thread, you can create fields and functions within it, of course. Mutexes are a good example, as are functions that notify the thread in some manner that there's something to be done. The Thread class derivatives can allow for an inter-thread interface this way. You can also add fields to emulate arguments to Main() - pthread_create only accepts void functions accepting a void pointer, so for simplicity I do it this way - and create a constructor to fill those fields in before Create()ion.

That was long... >_>


I'll, um, save my speech on getting input from stdin via select() for later. Suffice to say, you can't use cin.

I'm doing all of this on Ubuntu, if you're wondering.
~Jonathan

Comments: 0 - Leave a Comment

Link


All times are ET (US)

 
S
M
T
W
T
F
S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
24
26
27
28
29
30
31

OPTIONS
Track this Journal

 RSS 

ARCHIVES
August, 2009
July, 2009
March, 2009
February, 2009
December, 2008
November, 2008
October, 2008
August, 2008
July, 2008
June, 2008
May, 2008
April, 2008
November, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
December, 2006
October, 2006
September, 2006
July, 2006
May, 2006
April, 2006