Understand that this is a huge undertaking. The reason those custom-built castle beds are so expensive is because they require a lot of labor and a lot of materials. It will be a lot of work and the raw materials you need will be expensive as well. Building a castle shaped bed from scratch requires time, money and physical work, so make sure you have plenty of all three.
Sit down with your child and notepad and ask him would he'd like to see in the castle bed. Do some reflection and think of the ideas you'd like incorporated into the bed, as well.
Measure the room, and make a layout of the room (to scale, of course) on graph paper, so you know how much space you have to work with. Make sure to take note of windows, doors and closets when doing this.
Buy or download plans for a loft bed. Of course, if you wanted to totally do it yourself, you could design your own plans. That's not recommended unless you have extensive experience in woodworking. For the average parent, using ready-made plans is a better idea. You will most likely need to modify them or add on as necessary, as there are not many castle bed plans available. However, these plans will at least give you a good starting point, so they are still worthwhile to buy or download.
Design a front to the bed. This you can do on your own, since it's not weight bearing. Use graph paper so that you can draw it to scale. Some fun items to include might be windows, turrets, and flags.
Gather the materials you'll need. The best way to do this is to look at the plan you decided on and make a list of everything you'll need. Most of the plans will have a list for you to work from, but there are some basic tools you'll need as well. Try to have everything you need purchased and ready to go before you start the project.
Build the bed according to the plans you bought or downloaded. Make any necessary changes or modifications you want. Add on any extras, like a slide or tower that you think you child will really enjoy, and then nail the front design to the bed structure.
Paint the entire bed structure to look like a castle.