Tag: text

Kilo- a thousand lines text editor in C

Kilo- a thousand lines text editor in C

Antirez kilo text editorDeveloped by Salvatore Sanfilippo aka antirez and licensed under the BSD 2 licence, kilo is a simple text editor in one file.

If you are learning C and want to see how to write a utility, this might be a good example to follow. Warning though he does use pointers so make sure you’ve learnt them first!

I had a stab at writing one quite a few years ago but it wasn’t very good. I have a suspicion that writing a good text editor depends upon you first creating a good implementation of the text storage. Solve that and it’s downhill for the rest.

I’ve added this to my curated library of C code, on the C Code link on the top menu.

 

Rogue like – do you use graphics or text?

Rogue like – do you use graphics or text?

Rogue games search The original rogue used graphics. This was back in the era of terminals and home computers and graphics could be quite limited. So there’s a tradition of using text. However if you do a google image search for rogue game like I did here, you can see that while many of them are text there are a couple that are graphics.

So the question is do you use graphics or text?

Text has the advantage that its just there. All you have to do is choose the appropriate character.

Plus if you use Unicode (always a bit of a pain in C but doable) then you have access to hundreds of thousands of different characters. Like this one:

👾. Which is actually these

👾

👾

More information about this one from here.

Graphics on the other hand can be a lot more colourful but you have to get them drawn, or acquire them from somewhere like kenney.nl. So not an easy one to decide. If I had the resources I’d use graphics, but I’ll keep to the tradition of using Text.

A tip. When you have a question like “What characters are used in rogue” just try it. There is so much information on the web that there’s a good chance that someone will have done it. I’m finding this more and more and sure enough, I found this on Reddit. How would you have ever found that out before the web existed?

What is the best way to include text?

What is the best way to include text?

Words
Image by Free-Photos from Pixabay

One of the games I’m working on needs to include a 1.9 MB text file (200,000 words). Now it’s not that big a deal but using 7zip I can compress it down to 400 KB and that’s 20% of the uncompressed size. So I’m thinking of including some C# code to decompress it.

But I did wonder if there was any kind of built in decompression, so you could add it to say Resources and have it decompressed automatically when read. I haven’t seen anything like that but it would be cool if if existed.