Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: DagronQwest - my first attempt at coding in [s]VB.[/s] C++ :/  (Read 7580 times)

bowdown2q

  • Bay Watcher
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #15 on: April 02, 2011, 03:36:13 pm »

Quote
Quote
How do you mean? Should I be nesting classes or something?
Yes, make it "Stats.vb", "Skills.vb", etc.
Hm. rather than bloat my file structure with another file with all of 8 member variables (and their properties), can I just...
Code: [Select]
Public Class clsCSpecs
        Private m_meat As Integer
        Private m_bones As Integer
        Private m_hide As Integer
        Private m_vore As String
        Private m_voreQty As Integer
        Private m_tags As String
    End Class
Inside the clsCritter?  I mean... aside from making the code easier to read, does separating out these sets make any difference to using those vars/props later?

Quote
Quote
Yeaahh I think i'll drop this and incorporate it into NPC AI. That or the combat code.
Probably "NPC.vb" class would be better 
It'll probably be in the NPC class later, but until I tackle sapient critters (NPCs), it'll hang out in the combat resolution. Bears eat people wearing shinies, after all!

Quote
Okay, have that as "WeapStats.vb" or something

No; equipment I haven't even thought about yet; that'll have to wait until after NPCs are in. skl_Atk and skl_Def are just the skill to attack, in the same way that "blades" is a skill in Oblivion, or "Melee" is a skill in Fallout. It'll probably function akin to a JRPG's "Strength" or "Power" attribute; that is, equipment will boost this (and therefore attack damage.)

Quote
Quote
Do I need to do anything else where the Player inherits the base class?
I dunno. Some events and such for both the critters and player
Hm. Should I put events handling creature death in here, or the combat code? I imagine the combat code is where it would be happening.
A lot of the game mechanics happen as time passes (via a button to end the month). A few things, like hunger, will occur inside the code for "ExecuteMonth(lstActionQueue.Items)" rather than in the code for the objects they modify. Idk what the normal way to organize this sort of thing is.

Thanks for the Beginner Dev Center. The MSDN site is... well, damn hard to use. It seems to lack an easy way to navigate the documentation without getting mired in not-VB or forum posts.

To those awaiting an update, I can't make an promises as to a release, but I'll tease you with the (rather grey) GUI:
Spoiler (click to show/hide)

« Last Edit: April 02, 2011, 03:38:54 pm by bowdown2q »
Logged

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #16 on: April 03, 2011, 12:41:41 am »

Well, I would personally suggest you make a whole framework of EVERYTHING you want to put in the game, try to use as many classes as possible (skills, stats, etc.) that logically make sense, then write psuedocode such as
Code: [Select]
'Randomly choose a targetor
Code: [Select]
'Go insaneor something. Then get onto writing code.
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

bowdown2q

  • Bay Watcher
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #17 on: April 03, 2011, 12:59:47 pm »

Alright, I think I got it right. I've got
Spoiler (click to show/hide)

The only problem now is that I can't access "array_bestiary" from another sub, and I know I shouldn't have to re-fill that array every time I want to look through it.
My plan is to now pull the first column of Array_bestiary (which is the 'name' field) into its own array, so I can use LINQ to search it for a specified creature type, then get that row, then pull that row from array_bestiary into another array. THAT array will be fed into the constructor Sub for a new creature object to define the new creature's stats (via properties).

Or is there a better way to query a rectangular array? I mean............ As far as I know, SQL databases are easily searchable, and I think XML ones are too... I don't know anything else about them though. As is, I've got a CSV file I built with googledocs.

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #18 on: April 03, 2011, 01:03:46 pm »

probably go with SQL server, that's what I do.
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

Fayrik

  • Bay Watcher
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #19 on: April 03, 2011, 04:46:03 pm »

The only problem now is that I can't access "array_bestiary" from another sub, and I know I shouldn't have to re-fill that array every time I want to look through it.
I'm not sure how you really want to do this, and I know this can open up a lot of cross-threading issues, however, the quickest way to grant access to that array would be to elevate it to a static status.
If the code was in C#, I'd post a snippet on how to do that, but I'm not exactly 100% on the way VB layout works. (Never really bothered with it, since it lacks { and }.)
Logged
So THIS is how migrations start.
"Hey, dude, there's this crazy bastard digging in the ground for stuff. Let's go watch."

bowdown2q

  • Bay Watcher
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #20 on: April 11, 2011, 10:54:58 pm »

UPDATE:

Status: DERP.

I've caved to changing the code to C++, as my VB prof. at school is not that helpful, and my 2 coder-friends can help me with C++ or java, but not VB.

I'll be teaching myself C++ over the course of this week. I think I'm going to write up a legit. dev document this time through; I want to make this code as modular and as easy to modify as possible.

I've had some plans for features, but I think I'm going to make a simple [player] v [monster] combat prog.

Dev document to follow.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #21 on: April 12, 2011, 12:14:06 am »

Hmm, c++? It is a bit of a step from VB. You will need to understand pointers and garbage collection for a start, and those cause some newer people a lot of problems. Java, however, does this for you, as such makes life easy. If you can handle c++ at this stage, all the better! But if it doesn't come to you then try getting better at Java first, instead of hitting your head against the learning curve.

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #22 on: April 12, 2011, 02:28:39 am »

Hmm, c++? It is a bit of a step from VB. You will need to understand pointers and garbage collection for a start, and those cause some newer people a lot of problems. Java, however, does this for you, as such makes life easy. If you can handle c++ at this stage, all the better! But if it doesn't come to you then try getting better at Java first, instead of hitting your head against the learning curve.
*ahem*
I am learning C++ after VB, before Java (well I know "hello world", that's about it in Java), and I'm pretty content.


well, I like C++ over java because it compiles ^^
(well not only, but mostly)
...
anyways, classes in C++ are a bit harder than in VB. just go steadily, you might want to put this off a bit...
... or if not, just make a sketch of how you want all the parts to work.

P.S. I'm working on a game myself (In VB though  :P)
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #23 on: April 12, 2011, 02:52:44 am »

If were pointing out good books on the subject, then although I have not got around to reading it myself (A sin, I know) everybody I have talked to who has, some of them being seasoned professional programmers, says you should read 'Design Patterns' by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. It will teach you how to 'program' rather then just show you the syntax of a language.

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #24 on: April 12, 2011, 02:55:59 am »

that's the next book on my list  :D
well, stroustrups book does that too (he gives chapter 0 and chapter 1 to discuss programming, why is it important, do we really want it (answer: yes), etc. and gives examples throughout. I would suggest reading it first (to get acquainted with good techniques and C++, then Design Patterns.
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: DagronQwest - my first attempt at coding in VB.
« Reply #25 on: April 12, 2011, 10:58:58 am »

Hmm, c++? It is a bit of a step from VB. You will need to understand pointers and garbage collection for a start, and those cause some newer people a lot of problems. Java, however, does this for you, as such makes life easy. If you can handle c++ at this stage, all the better! But if it doesn't come to you then try getting better at Java first, instead of hitting your head against the learning curve.
*ahem*
I am learning C++ after VB, before Java (well I know "hello world", that's about it in Java), and I'm pretty content.


well, I like C++ over java because it compiles ^^
(well not only, but mostly)
...
anyways, classes in C++ are a bit harder than in VB. just go steadily, you might want to put this off a bit...
... or if not, just make a sketch of how you want all the parts to work.

P.S. I'm working on a game myself (In VB though  :P)

You like c++ over java because it compiles? Java compiles to byte code, a binary machine language like any other. It is not interpreted, it runs in the Java Virtual Machine on most computers. It is also the native instruction set of various Java Real Machine computers.

If I were to suggest going to a different language, it would be c#. He already has visual studio, he won't have to deal with memory management and it is definitely better than vb. But there really isn't any reason he can't keep at it in vb until he is more comfortable programming.

The only problem with VB is that most of the "experts" here will be unwilling or unable to provide help and guidance as they avoid it like the plague.
« Last Edit: April 12, 2011, 11:03:28 am by Nadaka »
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #26 on: April 12, 2011, 11:00:36 am »

(I meant into binary executable, not .jar)
well, I can help with VB or C++.
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: DagronQwest - my first attempt at coding in VB.
« Reply #27 on: April 12, 2011, 11:14:18 am »

(I meant into binary executable, not .jar)
well, I can help with VB or C++.

a .jar is just a compressible archive containing other resources such as compiled code and data resources. You can change the extension of any .jar to .zip and inspect the files in any modern archive viewing program. A java .class file is just as compiled as a .exe.

I don't need to pollute this thread with language arguments though so I will post something on topic.

bowdown2q: from your last post you can make the subroutine return the array. You can then call the subroutine from any other piece of code to get a new copy of the array loaded from the file. The problem with this is that it isn't very efficient because it has to read the file all over again. So what you do is you make the array static and then in your subroutine, the first thing you do is check to see if it is empty and if it is you fill it, if it isn't you just return it. Don't start worrying about stuff like multi-threading yet, this array is mostly going to be read, so even if you do get to that point, you probably won't have any problems anyway.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

TolyK

  • Bay Watcher
  • Nowan Ilfideme
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #28 on: April 12, 2011, 11:20:36 am »

*facepalm*
I fail at reading books.
...
OP: consider using structs as well for data, include arrays and other things and just save/load the struct from a file.
Logged
My Mafia Stats
just do whatevery tolyK and blame it as a bastard mod
Shakerag: Who are you personally suspicious of?
At this point?  TolyK.

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: DagronQwest - my first attempt at coding in VB.
« Reply #29 on: April 12, 2011, 06:04:00 pm »

You like c++ over java because it compiles? Java compiles to byte code, a binary machine language like any other. It is not interpreted, it runs in the Java Virtual Machine on most computers. It is also the native instruction set of various Java Real Machine computers.

If I were to suggest going to a different language, it would be c#. He already has visual studio, he won't have to deal with memory management and it is definitely better than vb. But there really isn't any reason he can't keep at it in vb until he is more comfortable programming.

The only problem with VB is that most of the "experts" here will be unwilling or unable to provide help and guidance as they avoid it like the plague.

Well any expert would be able to help him with the logical side of things reguardless of language, working within a certain paradigm of course. And the VB syntax realy isn't that hard to understand, as it was built to be easy! A lot of people will rip on VB for all sorts of reasons, but in the end you can work with it, and if the solution meets the vision, job well done!

And yes, c# is awesome.
Pages: 1 [2] 3 4